source: rtems/c/src/librdbg/src/powerpc/new_exception_processing/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.6 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 printf(c)
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  /* now open_connex() routine which establishes a connection to server */
25#define DEBUGGER_IS_GDB 0x2    /* */
26  /* now close_connex() routine which detaches from server */
27  /* now send_signal() routine which sends signals to processes like kill(2) */
28  /* now wait_info() routine which returns results of polling the wait status
29        of a process/actor. It may return 0 if running, else pid or -1 */
30  /* now ptrace() routine. This matches the Sun UNIX ptrace as well as
31        some additions */
32  /* now define the actual calls we support */
33const char* names [] = {
34    "NULLPROC", "OPEN_CONNEX", "SEND_SIGNAL", "name3",
35    "name4", "name5", "name6", "name7",
36    "name8", "name9", "CLOSE_CONNEX", "PTRACE",
37    "name12", "WAIT_INFO", "name14", "name15",
38    "name16", "GET_SIGNAL_NAMES", "name18"
39};
40
41void
42remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp)
43{
44        union {
45                open_in open_connex_2_arg;
46                signal_in send_signal_2_arg;
47                close_in close_connex_2_arg;
48                ptrace_in ptrace_2_arg;
49                wait_in wait_info_2_arg;
50        } argument;
51        char *result;
52        xdrproc_t _xdr_argument, _xdr_result;
53        char *(*local)(char *, struct svc_req *);
54
55        DPRINTF (("remotedeb_2: %s (%d)\n",
56                (unsigned) rqstp->rq_proc <
57                (unsigned) (sizeof names / sizeof names[0]) ?
58                names [rqstp->rq_proc] : "???",
59                (int) rqstp->rq_proc));
60
61        switch (rqstp->rq_proc) {
62        case NULLPROC:
63                (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
64                return;
65
66        case OPEN_CONNEX:
67                _xdr_argument = (xdrproc_t) xdr_open_in;
68                _xdr_result = (xdrproc_t) xdr_open_out;
69                local = (char *(*)(char *, struct svc_req *)) open_connex_2_svc;
70                break;
71
72        case SEND_SIGNAL:
73                _xdr_argument = (xdrproc_t) xdr_signal_in;
74                _xdr_result = (xdrproc_t) xdr_signal_out;
75                local = (char *(*)(char *, struct svc_req *)) send_signal_2_svc;
76                break;
77
78        case CLOSE_CONNEX:
79                _xdr_argument = (xdrproc_t) xdr_close_in;
80                _xdr_result = (xdrproc_t) xdr_void;
81                local = (char *(*)(char *, struct svc_req *)) close_connex_2_svc;
82                break;
83
84        case PTRACE:
85                _xdr_argument = (xdrproc_t) xdr_ptrace_in;
86                _xdr_result = (xdrproc_t) xdr_ptrace_out;
87                local = (char *(*)(char *, struct svc_req *)) ptrace_2_svc;
88                break;
89
90        case WAIT_INFO:
91                _xdr_argument = (xdrproc_t) xdr_wait_in;
92                _xdr_result = (xdrproc_t) xdr_wait_out;
93                local = (char *(*)(char *, struct svc_req *)) wait_info_2_svc;
94                break;
95
96        case GET_SIGNAL_NAMES:
97                _xdr_argument = (xdrproc_t) xdr_void;
98                _xdr_result = (xdrproc_t) xdr_get_signal_names_out;
99                local = (char *(*)(char *, struct svc_req *)) get_signal_names_2_svc;
100                break;
101
102        default:
103                svcerr_noproc (transp);
104                return;
105        }
106        memset ((char *)&argument, 0, sizeof (argument));
107        if (!svc_getargs (transp, _xdr_argument, (caddr_t) &argument)) {
108                svcerr_decode (transp);
109                return;
110        }
111        result = (*local)((char *)&argument, rqstp);
112        if (result != NULL && !svc_sendreply(transp, _xdr_result, result)) {
113                svcerr_systemerr (transp);
114        }
115        if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) {
116                printf( "unable to free arguments");
117                exit (1);
118        }
119        return;
120}
Note: See TracBrowser for help on using the repository browser.