diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-12-03 23:54:14 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-12-03 23:54:14 +0000 |
commit | 4721cf1ecb949b37c98b6fce79163541711de2e5 (patch) | |
tree | a89f2bef604b2ddf22b262fe6115d9f75c952781 /c/src/lib/librdbg/servutil.c | |
parent | Removed spaces. (diff) | |
download | rtems-4721cf1ecb949b37c98b6fce79163541711de2e5.tar.bz2 |
Patch from Emmanuel Raguet <raguet@crf.canon.fr> to add remote debug server
and RPC support to RTEMS. Thanks. :) Email follows:
Hello,
For Xmas, here is the Remote Debugger on RTEMS !
Here are 2 patches for the Remote Debugger on RTEMS for pc386 from Linux
host :
- one for RTEMS it self,
- one for GDB-4.17.
1/ RTEMS patch
--------------
This patch adds 2 libraries :
- a simplified SUN RPC library
- the Remote Debugger library
The configuration command is the following :
../rtems4/configure --target=i386-rtemself --enable-rtemsbsp=pc386
--enable-rdbg
The SUN RPC library is built only if networking is set.
The RDBG library is built if networking and enable-rdbg are set.
The function used to initialize the debugger is :
rtems_rdbg_initialize ();
A special function has been created to force a task to be
in a "debug" state : enterRdbg().
The use of this function is not mandatory.
2/ GDB-4.17 patch
-----------------
This patch create a new RTEMS target for GDB-4.17.
The configuration command is the following :
./configure --enable-shared --target=i386RTEMS
To connect to a target, use :
target rtems [your_site_address]
Then, attach the target using : attach 1
And... Debug ;)
You can obtain the original GDB-4.17 on
ftp://ftp.debian.org/debian/dists/stable/main/source/devel/gdb_4.17.orig.tar.gz
This has been tested from a Debian 2.0.1 linux host.
Diffstat (limited to 'c/src/lib/librdbg/servutil.c')
-rw-r--r-- | c/src/lib/librdbg/servutil.c | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/c/src/lib/librdbg/servutil.c b/c/src/lib/librdbg/servutil.c new file mode 100644 index 0000000000..40187faead --- /dev/null +++ b/c/src/lib/librdbg/servutil.c @@ -0,0 +1,130 @@ +/* + ********************************************************************** + * + * Component: RDB + * Module: servutil.c + * + * Synopsis: Various utility routines + * + ********************************************************************** + */ + +#include <string.h> +#include <rdbg/rdbg.h> +#include <rdbg/servrpc.h> + +/*----- Management of per-process list ----*/ + + /* + * ListAlloc - build up list entry. + * + * Notes: + * - this is a generic routine to build up entries in the per-connection + * list. The fields list, list_sz and list_alloc are affected. + */ + + Boolean +ListAlloc(buff, clst) + char *buff; + CONN_LIST *clst; /* place to copy it */ +{ + int tmp; + char* name; + int new_len; + int len; + + tmp = strlen(buff); + new_len = (int)clst->list_sz + 1 + tmp; + if (clst->list_alloc < (unsigned)new_len) { + /* need more space */ + name = (char *)Realloc(clst->list, len = new_len + MAX_FILENAME); + if (name == NULL) { + return(False); /* failed, no space */ + } + clst->list_alloc = len; + clst->list = name; + } + strcpy(clst->list + clst->list_sz, buff); + clst->list_sz += tmp; + return(True); +} + +/*----- Management of processes -----*/ + + /* + * FindPidEntry - locate pid_list entry from pid + */ + + int +FindPidEntry (pid) + int pid; /* process identifier */ +{ + int idx; + + /* pid 0 is invalid, and signals a free slot */ + if (pid_list == NULL || pid == 0) { + return -1; + } + for (idx = 0; idx < pid_list_cnt; idx++) { + if (pid_list [idx].pid == pid ) + return idx; + } + return -1; +} + +/*----- Debug suport -----*/ + +#ifdef DDEBUG + + /* + * Names of debug primitives + */ + +const char* PtraceNames [] = { + +"RPT_TRACEME", "RPT_PEEKTEXT", "RPT_PEEKDATA", "RPT_PEEKUSER", +"RPT_POKETEXT", "RPT_POKEDATA", "RPT_POKEUSER", "RPT_CONT", +"RPT_KILL", "RPT_SINGLESTEP", "RPT_ATTACH", "RPT_DETACH", +"RPT_GETREGS", "RPT_SETREGS", "RPT_GETFPREGS", "RPT_SETFPREGS", +"RPT_READDATA", "RPT_WRITEDATA", "RPT_READTEXT", "RPT_WRITETEXT", +"RPT_GETFPAREGS", "RPT_SETFPAREGS", "RPT_22", "RPT_23", +"RPT_SYSCALL", "RPT_DUMPCORE", "RPT_26", "RPT_27", +"RPT_28", "RPT_GETUCODE", "RPT_30", "RPT_31", +"RPT_32", "RPT_33", "RPT_34", "RPT_35", +"RPT_36", "RPT_37", "RPT_38", "RPT_39", +"RPT_40", "RPT_41", "RPT_42", "RPT_43", +"RPT_44", "RPT_45", "RPT_46", "RPT_47", +"RPT_48", "RPT_49", "RPT_GETTARGETTHREAD", "RPT_SETTARGETTHREAD", +"RPT_THREADSUSPEND", "RPT_THREADRESUME", "RPT_THREADLIST", "RPT_GETTHREADNAME", +"RPT_SETTHREADNAME", "RPT_SETTHREADREGS", "RPT_GETTHREADREGS", + "RPT_59", +"RPT_60", "RPT_61", "RPT_62", "RPT_63", +"RPT_64", "RPT_65", "RPT_66", "RPT_67", +"RPT_68", "RPT_69", "RPT_70", "RPT_71", +"RPT_72", "RPT_73", "RPT_74", "RPT_STEPRANGE", +"RPT_CONTTO", "RPT_SETBREAK", "RPT_CLRBREAK", "RPT_GETBREAK", +"RPT_GETNAME", "RPT_STOP", +"RPT_PGETREGS", "RPT_PSETREGS", +"RPT_PSETTHREADREGS", "RPT_PGETTHREADREGS" +}; + +const char* +PtraceName(req) + int req; +{ + static char bufret[40]; + + if ((req < 0) || (req >= sizeof(PtraceNames)/sizeof(char*))) { + sprintf(bufret, "BAD_REQ_%d", req); + return bufret; + } + return PtraceNames[req]; +} + +const char* BmsgNames [] = { + "?", "WARM", "WAIT", "BREAK", + "EXEC_FAIL", "DETACH", "KILLED", "NOT_PRIM", + "NEW_PID" +}; + +#endif /* DDEBUG */ |