From 261f99bdac9a995f8b2740b7ae52c8ad81001132 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 2 Aug 2007 15:00:07 +0000 Subject: 2007-08-02 Joel Sherrill * configure.ac, wrapup/Makefile.am: Remove RDBG. * aclocal/check-rdbg.m4, aclocal/enable-rdbg.m4, librdbg/.cvsignore, librdbg/Makefile.am, librdbg/preinstall.am, librdbg/include/rdbg/rdbg.h, librdbg/include/rdbg/servrpc.h, librdbg/include/rdbg/i386/rdbg_f.h, librdbg/include/rdbg/i386/reg.h, librdbg/include/rdbg/m68k/rdbg_f.h, librdbg/include/rdbg/m68k/reg.h, librdbg/include/rdbg/powerpc/rdbg_f.h, librdbg/include/rdbg/powerpc/reg.h, librdbg/src/_servtgt.c, librdbg/src/awk.svc, librdbg/src/excep.c, librdbg/src/ptrace.c, librdbg/src/rdbg.c, librdbg/src/remdeb.x, librdbg/src/servbkpt.c, librdbg/src/servcon.c, librdbg/src/servrpc.c, librdbg/src/servtgt.c, librdbg/src/servtsp.c, librdbg/src/servutil.c, librdbg/src/i386/excep_f.c, librdbg/src/i386/rdbg_cpu_asm.S, librdbg/src/i386/rdbg_f.c, librdbg/src/i386/any/remdeb.h, librdbg/src/i386/any/remdeb_f.x, librdbg/src/i386/any/remdeb_svc.c, librdbg/src/i386/any/remdeb_xdr.c, librdbg/src/m68k/excep_f.c, librdbg/src/m68k/rdbg_cpu_asm.S, librdbg/src/m68k/rdbg_f.c, librdbg/src/m68k/any/remdeb.h, librdbg/src/m68k/any/remdeb_f.x, librdbg/src/m68k/any/remdeb_svc.c, librdbg/src/m68k/any/remdeb_xdr.c, librdbg/src/powerpc/excep_f.c, librdbg/src/powerpc/rdbg_cpu_asm.S, librdbg/src/powerpc/rdbg_f.c, librdbg/src/powerpc/new_exception_processing/remdeb.h, librdbg/src/powerpc/new_exception_processing/remdeb_f.x, librdbg/src/powerpc/new_exception_processing/remdeb_svc.c, librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c: Removed. --- c/src/librdbg/src/ptrace.c | 328 --------------------------------------------- 1 file changed, 328 deletions(-) delete mode 100644 c/src/librdbg/src/ptrace.c (limited to 'c/src/librdbg/src/ptrace.c') diff --git a/c/src/librdbg/src/ptrace.c b/c/src/librdbg/src/ptrace.c deleted file mode 100644 index f77d1dc2ff..0000000000 --- a/c/src/librdbg/src/ptrace.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - ************************************************************************** - * - * Component = - * - * Synopsis = rkdb/rkdb.c - * - * $Id$ - * - ************************************************************************** - */ - -#include -#include -#include -#include -#include - -extern rtems_id serializeSemId; -extern rtems_id wakeupEventSemId; -extern rtems_id eventTaskId; -extern rtems_id debugId; -extern Exception_context *FirstCtx; -extern Exception_context *LastCtx; -extern CPU_Exception_frame SavedContext; -extern unsigned int NbExceptCtx; - -/* - * return a pointer to the Thread Control structure of the specified - * Id - */ - - Thread_Control * -Thread_Get_RDBG (Objects_Id Id) -{ - unsigned index; - - if (Id < _Objects_Information_table[OBJECTS_CLASSIC_API][1]->maximum_id && - Id > _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id) { - - index = Id - _Objects_Information_table[OBJECTS_CLASSIC_API][1]->minimum_id; - if (_Objects_Information_table[OBJECTS_CLASSIC_API][1]->local_table[1 + index] != NULL) { - return (Thread_Control*) (_Objects_Information_table[OBJECTS_CLASSIC_API][1]->local_table[1 + index]); - } - } - - if (Id < _Objects_Information_table[OBJECTS_POSIX_API][1]->maximum_id && - Id > _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id) { - - index = Id - _Objects_Information_table[OBJECTS_POSIX_API][1]->minimum_id; - if (_Objects_Information_table[OBJECTS_POSIX_API][1]-> - local_table[1 + index] != NULL) - return (Thread_Control*) (_Objects_Information_table[OBJECTS_POSIX_API][1]->local_table[1 + index]); - } - - return 0; - -} - - int -safeMemRead (void *src, void *dest, int nbBytes) -{ - - /* - * safe because if it generates an exception, - * it must return normally - * TBD - */ - - memcpy (dest, src, nbBytes); - return 0; -} - - int -safeMemWrite (void *src, void *dest, int nbBytes) -{ - - /* - * safe because if it generates an exception, - * it must return normally - * TBD - */ - - memcpy (dest, src, nbBytes); - return 0; -} - - int -ptrace (int request, int pid, char *addr, int data, char *addr2) -{ - int diag; - errno = 0; - if (pid != 1) { - errno = ESRCH; - return -1; - } - switch (request) { - - case RPT_SINGLESTEP:{ - Exception_context *ctx; - - if (CannotRestart == 1) { - setErrno (EIO); - return -1; - } - - if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) { - Single_Step (ctx->ctx); - rtems_semaphore_release (ctx->semaphoreId); - return 0; - } - break; - } - - case RPT_PEEKTEXT: - case RPT_PEEKDATA:{ - diag = safeMemRead (addr, &data, sizeof data); - if (diag == 0) - return data; - mem_error: - return -1; - } - - case RPT_POKETEXT:{ - diag = safeMemWrite (&data, addr, sizeof data); - - /* - * We must flush the INSTR and DATA cache to be sure the - * opcode modification is taken into account, because - * the breakpoint opcode is written via the data cache - * while execution code is fetched via the instruction - * cache - */ - - if (diag == 0) { - copyback_data_cache_and_invalidate_instr_cache( - (unsigned char *)addr, sizeof data); - return 0; - } - goto mem_error; - } - case RPT_POKEDATA:{ - diag = safeMemWrite (&data, addr, sizeof data); - if (diag == 0) - return 0; - goto mem_error; - } - case RPT_CONT:{ - Exception_context *ctx; - - if (CannotRestart == 1) { - setErrno (EIO); - return -1; - } - - ctx = GetExceptCtx (currentTargetThread); - if (ctx == NULL) - ctx = GetExceptCtx (debugId); - - if (ctx != NULL) { - - if (!isRdbgException (ctx)) { - CannotRestart = 1; - setErrno (EIO); - return -1; - } - - assert (data == 0); - assert (ExitForSingleStep == 0); - - rtems_semaphore_release (ctx->semaphoreId); - } - rtems_semaphore_release (serializeSemId); - return 0; - } - - case RPT_ATTACH: - return 0; - - case RPT_DETACH:{ - Exception_context *ctx; - - if (NbExceptCtx || NbSerializedCtx) { - ctx = FirstCtx; - rtems_task_delete (eventTaskId); - rtems_semaphore_delete (serializeSemId); - rtems_semaphore_delete (wakeupEventSemId); - } - return 0; - } - - case RPT_GETREGS:{ - Exception_context *ctx; - - if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) { - CtxToRegs (ctx->ctx, (xdr_regs *) addr); - return 0; - } - break; - } - - case RPT_SETREGS:{ - Exception_context *ctx; - - if ((ctx = GetExceptCtx (currentTargetThread)) != NULL) { - RegsToCtx ((xdr_regs *) addr, ctx->ctx); - return 0; - } - break; - } - - case RPT_READTEXT: - case RPT_READDATA:{ - diag = safeMemRead (addr, addr2, data); - if (diag == 0) - return 0; - goto mem_error; - } - case RPT_WRITETEXT: - case RPT_WRITEDATA:{ - diag = safeMemWrite (addr2, addr, data); - if (diag == 0) - return 0; - goto mem_error; - } - - case RPT_GETTARGETTHREAD: - if (!NbExceptCtx) { - errno = EBUSY; - return -1; - } - return currentTargetThread; - - case RPT_SETTARGETTHREAD: - if (!NbExceptCtx) { - errno = EBUSY; - return -1; - } - currentTargetThread = data; - return 0; - - case RPT_GETTHREADNAME:{ - return TgtGetThreadName (NULL, (unsigned) (data), (char *) addr); - } - - case RPT_THREADLIST:{ - int count = TgtThreadList (NULL, (unsigned *) addr, UTHREAD_MAX - * sizeof (unsigned)); - if (count < 0) { - errno = EINVAL; - return -1; - } - return count; - } - - case RPT_SETTHREADREGS:{ - Exception_context *ctx; - CPU_Exception_frame Ectx; - Thread_Control *thread; - rtems_id id; - - rtems_task_ident (RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id); - if (data == (unsigned) id) - break; - - if ((ctx = GetExceptCtx (data)) != NULL) { - RegsToCtx ((xdr_regs *) addr, ctx->ctx); - return 0; - } - thread = Thread_Get_RDBG ((Objects_Id) (data)); - if (thread != NULL) { - RegsToCtx ((xdr_regs *) addr, &Ectx); - set_ctx_thread (thread, &Ectx); - return 0; - } - break; - } - - case RPT_GETTHREADREGS:{ - Exception_context *ctx; - CPU_Exception_frame Ectx; - Thread_Control *thread; - rtems_id id; - - rtems_task_ident (RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &id); - if (data == (unsigned) id) { - justSaveContext = 1; - enterRdbg (); - CtxToRegs (&(SavedContext), (xdr_regs *) addr); - return 0; - } - - if ((ctx = GetExceptCtx (data)) != NULL) { - CtxToRegs (ctx->ctx, (xdr_regs *) addr); - return 0; - } - thread = Thread_Get_RDBG ((Objects_Id) (data)); - if (thread != NULL) { - get_ctx_thread (thread, &Ectx); - CtxToRegs (&Ectx, (xdr_regs *) addr); - return 0; - } - break; - } - - case RPT_KILL: - TotalReboot = 1; - return 0; - - case RPT_TRACEME: - case RPT_PEEKUSER: - case RPT_POKEUSER: - case RPT_GETFPREGS: - case RPT_SETFPREGS: - case RPT_GETFPAREGS: - case RPT_SETFPAREGS: - case RPT_SYSCALL: - case RPT_DUMPCORE: - case RPT_GETUCODE: - case RPT_THREADSUSPEND: - case RPT_THREADRESUME: - case RPT_SETTHREADNAME: - default: - break; - } - errno = EINVAL; - return -1; -} -- cgit v1.2.3