summaryrefslogtreecommitdiffstats
path: root/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-01-13 21:07:22 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-01-13 21:07:22 +0000
commit4c3ab8463610365de864b0f769d210ee914a71ec (patch)
tree3888952129deab34466f212e5293446a19b5763a /c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c
parentAll m68k BSPs now build with new ELF style linkcmds. (diff)
downloadrtems-4c3ab8463610365de864b0f769d210ee914a71ec.tar.bz2
Patch rtems-rc-20000104-17.diff from Ralf Corsepius <corsepiu@faw.uni-ulm.de>
that addresses the librdbg/rpcgen related problems: Changes: * All rpcgen generated files are now kept inside of the source tree * Fix librdbg/configure to correctly detect presence of rpcgen and awk * Use rpcgen -m to generated remdeb_svc.c * Remove msgout/_msgout from awk.svc * minor cleanups to librdbg/configure.in ATTENTION --- IMPORTANT: * With keeping rpc-generated files pre-build inside of the source tree, you as the packager of RTEMS have to ensure that timestamps are correctly set up: The generated files must not be older than the *.x files. * This is extraordinarily important when - putting the package on read-only media - after checking out from CVS - after modifications to the *.x files * If one of the *.x files is modified you have to either - build for i386/pc386 and powerpc/mcp750 - or to invoke the same rpcgen calls as the librdbg/src/<cpu>/<bsp>/Makefile.am do manually before checking-in the files to CVS. Proposal: We could add something to bootstrap for touching the rpcgen-generated sources and/or to manually regenerate them. NOTE FROM JOEL: Ralf proposed modifying bootstrap to handle rpcgen. I think this is the best solution as it is something already done in the snapshot procedure.
Diffstat (limited to 'c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c')
-rw-r--r--c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c122
1 files changed, 122 insertions, 0 deletions
diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c
new file mode 100644
index 0000000000..2e5b3725e4
--- /dev/null
+++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c
@@ -0,0 +1,122 @@
+#include <rpc/types.h>
+#include <rpc/rpc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <bsp.h>
+#include <rdbg/servrpc.h>
+#include <rdbg/remdeb.h>
+#define fprintf(a,b) printf(b)
+/*HEADER_START*/
+#define RTEMS_PORT 2071
+#define RTEMS_BACK_PORT 2073
+/*
+ * Sun request values for the remote ptrace system call
+ */
+
+ /*
+ * Memory data for read/write text or data. The size is in data. The target
+ * addr is in the addr field.
+ * Be careful before modifying because this value goes into internal
+ * pipes and is allocated on stack too. Pipes and/or the stack could
+ * become too small if this value gets incremented.
+ */
+#ifndef XRY_MAX_CMD_STR
+#endif /* REMDEB_H */
+ /* now open_connex() routine which establishes a connection to server */
+#define DEBUGGER_IS_GDB 0x2 /* */
+ /* now close_connex() routine which detaches from server */
+ /* now send_signal() routine which sends signals to processes like kill(2) */
+ /* now wait_info() routine which returns results of polling the wait status
+ of a process/actor. It may return 0 if running, else pid or -1 */
+ /* now ptrace() routine. This matches the Sun UNIX ptrace as well as
+ some additions */
+ /* now define the actual calls we support */
+const char* names [] = {
+ "NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
+ "name4", "name5", "name6", "name7",
+ "name8", "name9", "CLOSE_CONNEX", "PTRACE",
+ "name12", "WAIT_INFO", "name14", "name15",
+ "name16", "GET_SIGNAL_NAMES", "name18"
+};
+
+void
+remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ open_in open_connex_2_arg;
+ signal_in send_signal_2_arg;
+ close_in close_connex_2_arg;
+ ptrace_in ptrace_2_arg;
+ wait_in wait_info_2_arg;
+ } argument;
+ char *result;
+ xdrproc_t _xdr_argument, _xdr_result;
+ char *(*local)(char *, struct svc_req *);
+
+ DPRINTF (("remotedeb_2: %s (%d)\n",
+ (unsigned) rqstp->rq_proc <
+ (unsigned) (sizeof names / sizeof names[0]) ?
+ names [rqstp->rq_proc] : "???",
+ (int) rqstp->rq_proc));
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case OPEN_CONNEX:
+ _xdr_argument = (xdrproc_t) xdr_open_in;
+ _xdr_result = (xdrproc_t) xdr_open_out;
+ local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
+ break;
+
+ case SEND_SIGNAL:
+ _xdr_argument = (xdrproc_t) xdr_signal_in;
+ _xdr_result = (xdrproc_t) xdr_signal_out;
+ local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
+ break;
+
+ case CLOSE_CONNEX:
+ _xdr_argument = (xdrproc_t) xdr_close_in;
+ _xdr_result = (xdrproc_t) xdr_void;
+ local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
+ break;
+
+ case PTRACE:
+ _xdr_argument = (xdrproc_t) xdr_ptrace_in;
+ _xdr_result = (xdrproc_t) xdr_ptrace_out;
+ local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
+ break;
+
+ case WAIT_INFO:
+ _xdr_argument = (xdrproc_t) xdr_wait_in;
+ _xdr_result = (xdrproc_t) xdr_wait_out;
+ local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
+ break;
+
+ case GET_SIGNAL_NAMES:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_get_signal_names_out;
+ local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ result = (*local)((char *)&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "unable to free arguments");
+ exit (1);
+ }
+ return;
+}