source: rtems/c/src/librdbg/src/i386/any/remdeb_svc.c @ 40cf43ea

4.104.114.84.95
Last change on this file since 40cf43ea was 40cf43ea, checked in by Joel Sherrill <joel.sherrill@…>, on 02/01/02 at 17:00:01
  • So many patches have been posted recently on the mailing list and because we were unable to find correct solution to compile on various linux distros (due to rpcgen incompatibilities), and because the coding style of rdbg was rather inconsistant among various pieces of code, I decided to:

1) make some cleaning regarding global coding style (using

indent + manual edits),

2) incorporate/review the paches send by various people

(S. Holford, T. Strauman),

3) Fix the bug due to varying rpcgen code generation

in remdeb_svc.c,

4) Remove some dead code,
5) Apply a patches enabling to call enterRdbg imediately

after rdbg initialization is done,

NB : the paches is huge but it is mainly due to coding styke chnages.
Only few lines of codes have been really changed and they do not impact
rdbg functionnality (AFAIKT).

  • include/rdbg/servrpc.h, include/rdbg/i386/rdbg_f.h, include/rdbg/m68k/rdbg_f.h, include/rdbg/powerpc/rdbg_f.h, src/_servtgt.c, src/awk.svc, src/excep.c, src/ptrace.c, src/rdbg.c, src/remdeb.x, src/servbkpt.c, src/servcon.c, src/servrpc.c, src/servtgt.c, src/servtsp.c, src/servutil.c, src/i386/excep_f.c, src/i386/rdbg_f.c, src/i386/any/Makefile.am, src/i386/any/remdeb.h, src/i386/any/remdeb_svc.c, src/i386/any/remdeb_xdr.c, src/m68k/excep_f.c, src/m68k/rdbg_f.c, src/m68k/any/Makefile.am, src/m68k/any/remdeb.h, src/m68k/any/remdeb_svc.c, src/m68k/any/remdeb_xdr.c, src/powerpc/excep_f.c, src/powerpc/rdbg_f.c, src/powerpc/new_exception_processing/Makefile.am, src/powerpc/new_exception_processing/remdeb.h, src/powerpc/new_exception_processing/remdeb_svc.c, src/powerpc/new_exception_processing/remdeb_xdr.c: Modified.
  • Property mode set to 100644
File size: 3.8 KB
Line 
1#include <rpc/types.h>
2#include <rpc/rpc.h>
3#include <stdio.h>
4#include <stdlib.h>
5#include <string.h>
6#include <bsp.h>
7#include <rdbg/servrpc.h>
8#include <rdbg/remdeb.h>
9#define fprintf(a,b) printf(b)
10/*HEADER_START*/
11#define RTEMS_PORT 2071
12#define RTEMS_BACK_PORT 2073
13/*
14 * Sun request values for the remote ptrace system call
15 */
16
17  /*
18   * Memory data for read/write text or data. The size is in data. The target
19   * addr is in the addr field.
20   * Be careful before modifying because this value goes into internal
21   * pipes and is allocated on stack too. Pipes and/or the stack could
22   * become too small if this value gets incremented.
23   */
24#ifndef XRY_MAX_CMD_STR
25#endif /* REMDEB_H */
26  /*
27   * now open_connex() routine which establishes a connection to server
28   */
29#define DEBUGGER_IS_GDB 0x2     /* */
30  /*
31   * now close_connex() routine which detaches from server
32   */
33  /*
34   * now send_signal() routine which sends signals to processes like kill(2)
35   */
36  /*
37   * now wait_info() routine which returns results of polling the wait status
38   * of a process/actor. It may return 0 if running, else pid or -1
39   */
40  /*
41   * now ptrace() routine. This matches the Sun UNIX ptrace as well as
42   * some additions
43   */
44  /*
45   * now define the actual calls we support
46   */
47const char *names[] = {
48  "NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
49  "name4", "name5", "name6", "name7",
50  "name8", "name9", "CLOSE_CONNEX", "PTRACE",
51  "name12", "WAIT_INFO", "name14", "name15",
52  "name16", "GET_SIGNAL_NAMES", "name18"
53};
54
55void
56remotedeb_2 (struct svc_req *rqstp, register SVCXPRT * transp)
57{
58  union {
59    open_in open_connex_2_arg;
60    signal_in send_signal_2_arg;
61    close_in close_connex_2_arg;
62    ptrace_in ptrace_2_arg;
63    wait_in wait_info_2_arg;
64  } argument;
65  char *result;
66  xdrproc_t _xdr_argument, _xdr_result;
67  char *(*local) (char *, struct svc_req *);
68
69  DPRINTF (("remotedeb_2: %s (%d)\n",
70            (unsigned) rqstp->rq_proc <
71            (unsigned) (sizeof names / sizeof names[0]) ?
72            names[rqstp->rq_proc] : "???", (int) rqstp->rq_proc));
73
74  switch (rqstp->rq_proc) {
75  case NULLPROC:
76    (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *) NULL);
77    return;
78
79  case OPEN_CONNEX:
80    _xdr_argument = (xdrproc_t) xdr_open_in;
81    _xdr_result = (xdrproc_t) xdr_open_out;
82    local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
83    break;
84
85  case SEND_SIGNAL:
86    _xdr_argument = (xdrproc_t) xdr_signal_in;
87    _xdr_result = (xdrproc_t) xdr_signal_out;
88    local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
89    break;
90
91  case CLOSE_CONNEX:
92    _xdr_argument = (xdrproc_t) xdr_close_in;
93    _xdr_result = (xdrproc_t) xdr_void;
94    local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
95    break;
96
97  case PTRACE:
98    _xdr_argument = (xdrproc_t) xdr_ptrace_in;
99    _xdr_result = (xdrproc_t) xdr_ptrace_out;
100    local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
101    break;
102
103  case WAIT_INFO:
104    _xdr_argument = (xdrproc_t) xdr_wait_in;
105    _xdr_result = (xdrproc_t) xdr_wait_out;
106    local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
107    break;
108
109  case GET_SIGNAL_NAMES:
110    _xdr_argument = (xdrproc_t) xdr_void;
111    _xdr_result = (xdrproc_t) xdr_get_signal_names_out;
112    local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
113    break;
114
115  default:
116    svcerr_noproc (transp);
117    return;
118  }
119  memset ((char *) &argument, 0, sizeof (argument));
120  if (!svc_getargs (transp, _xdr_argument, (caddr_t) & argument)) {
121    svcerr_decode (transp);
122    return;
123  }
124  result = (*local) ((char *) &argument, rqstp);
125  if (result != NULL && !svc_sendreply (transp, _xdr_result, result)) {
126    svcerr_systemerr (transp);
127  }
128  if (!svc_freeargs (transp, _xdr_argument, (caddr_t) & argument)) {
129    fprintf (stderr, "unable to free arguments");
130    exit (1);
131  }
132  return;
133}
Note: See TracBrowser for help on using the repository browser.