diff options
Diffstat (limited to 'c/src/librdbg/src/powerpc/new_exception_processing')
4 files changed, 99 insertions, 195 deletions
diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/Makefile.am b/c/src/librdbg/src/powerpc/new_exception_processing/Makefile.am index 7ff7edceee..6f72c853bf 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/Makefile.am +++ b/c/src/librdbg/src/powerpc/new_exception_processing/Makefile.am @@ -71,6 +71,8 @@ if RPCTOOLS -o powerpc/new_exception_processing/tmpSvc.c remdeb.x; \ $(AWK) -f ./awk.svc THEPROG="remdeb.h" powerpc/new_exception_processing/tmpSvc.c \ > powerpc/new_exception_processing/remdeb_svc.c; \ + $(SED) -e 's/fprintf.*,/printf(/' powerpc/new_exception_processing/remdeb_svc.c; > powerpc/new_exception_processing/remdeb_svc.tmp; \ + mv powerpc/new_exception_processing/remdeb_svc.tmp powerpc/new_exception_processing/remdeb_svc.c; \ rm -f powerpc/new_exception_processing/tmpSvc.c ) endif diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h index ebbb44eaa1..07f50eed15 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb.h @@ -16,7 +16,7 @@ extern "C" { #define RTEMS_PORT 2071 #define RTEMS_BACK_PORT 2073 #ifndef REMDEB_H -#define RPCGENSRVNAME(a) a +#define RPCGENSRVNAME(a) a enum rpc_type { SUNRPC = 0, @@ -99,62 +99,62 @@ struct xdr_regs { typedef struct xdr_regs xdr_regs; /* now define register macros to apply to xdr_regs struct */ -#define R_PC 0 -#define R_MSR 1 -#define R_EXCEPNB 2 -#define R_R0 3 -#define R_R1 (R_R0 + 1) -#define R_R2 (R_R0 + 2) -#define R_R3 (R_R0 + 3) -#define R_R4 (R_R0 + 4) -#define R_R5 (R_R0 + 5) -#define R_R6 (R_R0 + 6) -#define R_R7 (R_R0 + 7) -#define R_R8 (R_R0 + 8) -#define R_R9 (R_R0 + 9) -#define R_R10 (R_R0 + 10) -#define R_R11 (R_R0 + 11) -#define R_R12 (R_R0 + 12) -#define R_R13 (R_R0 + 13) -#define R_R14 (R_R0 + 14) -#define R_R15 (R_R0 + 15) -#define R_R16 (R_R0 + 16) -#define R_R17 (R_R0 + 17) -#define R_R18 (R_R0 + 18) -#define R_R19 (R_R0 + 19) -#define R_R20 (R_R0 + 20) -#define R_R21 (R_R0 + 21) -#define R_R22 (R_R0 + 22) -#define R_R23 (R_R0 + 23) -#define R_R24 (R_R0 + 24) -#define R_R25 (R_R0 + 25) -#define R_R26 (R_R0 + 26) -#define R_R27 (R_R0 + 27) -#define R_R28 (R_R0 + 28) -#define R_R29 (R_R0 + 29) -#define R_R30 (R_R0 + 30) -#define R_R31 (R_R0 + 31) -#define R_CR 35 -#define R_CTR 36 -#define R_XER 37 -#define R_LR 38 -#define R_MQ 39 +#define R_PC 0 +#define R_MSR 1 +#define R_EXCEPNB 2 +#define R_R0 3 +#define R_R1 (R_R0 + 1) +#define R_R2 (R_R0 + 2) +#define R_R3 (R_R0 + 3) +#define R_R4 (R_R0 + 4) +#define R_R5 (R_R0 + 5) +#define R_R6 (R_R0 + 6) +#define R_R7 (R_R0 + 7) +#define R_R8 (R_R0 + 8) +#define R_R9 (R_R0 + 9) +#define R_R10 (R_R0 + 10) +#define R_R11 (R_R0 + 11) +#define R_R12 (R_R0 + 12) +#define R_R13 (R_R0 + 13) +#define R_R14 (R_R0 + 14) +#define R_R15 (R_R0 + 15) +#define R_R16 (R_R0 + 16) +#define R_R17 (R_R0 + 17) +#define R_R18 (R_R0 + 18) +#define R_R19 (R_R0 + 19) +#define R_R20 (R_R0 + 20) +#define R_R21 (R_R0 + 21) +#define R_R22 (R_R0 + 22) +#define R_R23 (R_R0 + 23) +#define R_R24 (R_R0 + 24) +#define R_R25 (R_R0 + 25) +#define R_R26 (R_R0 + 26) +#define R_R27 (R_R0 + 27) +#define R_R28 (R_R0 + 28) +#define R_R29 (R_R0 + 29) +#define R_R30 (R_R0 + 30) +#define R_R31 (R_R0 + 31) +#define R_CR 35 +#define R_CTR 36 +#define R_XER 37 +#define R_LR 38 +#define R_MQ 39 #include <libcpu/raw_exception.h> -#define REG_PC tabreg[R_PC] /* PC register offset */ -#define REG_SP tabreg[R_R1] /* SP register offset */ -#define REG_FP tabreg[R_R1] /* SP register offset (no FP on PPC) */ -#define BREAK_SIZE 4 /* Breakpoint occupies 4 bytes */ -#define BREAK_ADJ 0 /* Nothing to subtract from address after bp */ -#define IS_BREAK(l) ((l) == 0x7d8d6808) -#define SET_BREAK(l) (0x7d8d6808) +#define REG_PC tabreg[R_PC] /* PC register offset */ +#define REG_SP tabreg[R_R1] /* SP register offset */ +#define REG_FP tabreg[R_R1] /* SP register offset (no FP on PPC) */ +#define BREAK_SIZE 4 /* Breakpoint occupies 4 bytes */ +#define BREAK_ADJ 0 /* Nothing to subtract from address after bp */ +#define IS_BREAK(l) ((l) == 0x7d8d6808) +#define SET_BREAK(l) (0x7d8d6808) #define ORG_BREAK(c,p) (p) -#define IS_STEP(regs) (regs.tabreg[R_EXCEPNB] == ASM_TRACE_VECTOR) /* Was step and not break */ -#define TARGET_PROC_TYPE 3 +#define IS_STEP(regs) (regs.tabreg[R_EXCEPNB] == ASM_TRACE_VECTOR) /* Was step and not break */ +#define TARGET_PROC_TYPE 3 #define MAXDEBUGGEE 150 #define NAMEMAX 17 - /* + /* * 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 @@ -250,40 +250,9 @@ typedef struct { u_int CHAR_DATA_len; char *CHAR_DATA_val; } CHAR_DATA; -#define XRY_MAX_INST_BUFF 128 -#define XRY_MAX_INSTANCES 16 -#ifndef XRY_MAX_CMD_STR -#define XRY_MAX_CMD_STR 320 -#endif /* REMDEB_H */ - -struct xry_inst { - u_char flags; - u_char type; - u_char sub_type; - u_char res_type; - u_long value; - u_long value2; -}; -typedef struct xry_inst xry_inst; - -struct instance { - struct xry_inst instances[XRY_MAX_INSTANCES]; - u_char buffer[XRY_MAX_INST_BUFF]; -}; -typedef struct instance instance; - -struct instance_union { - bool_t instances; - union { - instance inst; - char *buffer; - } instance_union_u; -}; -typedef struct instance_union instance_union; typedef char *one_arg; -#define XRY_MAX_OBJ_NAME 32 - /* now open_connex() routine which establishes a connection to server */ + /* now open_connex() routine which establishes a connection to server */ enum debug_type { DEBTYP_PROCESS = 0, @@ -292,7 +261,7 @@ enum debug_type { DEBTYP_OTHER = 3, }; typedef enum debug_type debug_type; -#define DEBUGGER_IS_GDB 0x2 /* */ +#define DEBUGGER_IS_GDB 0x2 /* */ struct open_in { u_char back_port[16]; @@ -312,7 +281,7 @@ struct open_out { u_short server_vers; }; typedef struct open_out open_out; - /* now close_connex() routine which detaches from server */ + /* now close_connex() routine which detaches from server */ enum close_control { CLOSE_IGNORE = 0, @@ -325,7 +294,7 @@ struct close_in { close_control control; }; typedef struct close_in close_in; - /* now send_signal() routine which sends signals to processes like kill(2) */ + /* now send_signal() routine which sends signals to processes like kill(2) */ struct signal_in { int pid; @@ -338,7 +307,7 @@ struct signal_out { int errNo; }; typedef struct signal_out signal_out; - /* now wait_info() routine which returns results of polling the wait status + /* 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 */ enum stop_code { @@ -373,8 +342,8 @@ struct wait_out { u_long thread; }; typedef struct wait_out wait_out; - /* now ptrace() routine. This matches the Sun UNIX ptrace as well as - some additions */ + /* now ptrace() routine. This matches the Sun UNIX ptrace as well as + some additions */ #define PTRFLG_FORCE 1 #define PTRFLG_NON_OWNER 2 #define PTRFLG_FREE 4 @@ -442,7 +411,7 @@ struct get_signal_names_out { all_signals signals; }; typedef struct get_signal_names_out get_signal_names_out; - /* now define the actual calls we support */ + /* now define the actual calls we support */ #define REMDEB_H #endif @@ -508,9 +477,6 @@ extern bool_t xdr_thread_list (XDR *, thread_list*); extern bool_t xdr_ptrace_addr_data_in (XDR *, ptrace_addr_data_in*); extern bool_t xdr_ptrace_addr_data_out (XDR *, ptrace_addr_data_out*); extern bool_t xdr_CHAR_DATA (XDR *, CHAR_DATA*); -extern bool_t xdr_xry_inst (XDR *, xry_inst*); -extern bool_t xdr_instance (XDR *, instance*); -extern bool_t xdr_instance_union (XDR *, instance_union*); extern bool_t xdr_one_arg (XDR *, one_arg*); extern bool_t xdr_debug_type (XDR *, debug_type*); extern bool_t xdr_open_in (XDR *, open_in*); @@ -547,9 +513,6 @@ extern bool_t xdr_thread_list (); extern bool_t xdr_ptrace_addr_data_in (); extern bool_t xdr_ptrace_addr_data_out (); extern bool_t xdr_CHAR_DATA (); -extern bool_t xdr_xry_inst (); -extern bool_t xdr_instance (); -extern bool_t xdr_instance_union (); extern bool_t xdr_one_arg (); extern bool_t xdr_debug_type (); extern bool_t xdr_open_in (); 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 index e06aef7620..88c15cc708 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_svc.c @@ -6,7 +6,7 @@ #include <bsp.h> #include <rdbg/servrpc.h> #include <rdbg/remdeb.h> -#define fprintf(fp, ...) printf(__VA_ARGS__) +#define printf(c) /*HEADER_START*/ #define RTEMS_PORT 2071 #define RTEMS_BACK_PORT 2073 @@ -14,30 +14,28 @@ * 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 + /* 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 */ + /* 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" + "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 @@ -115,7 +113,7 @@ remotedeb_2(struct svc_req *rqstp, register SVCXPRT *transp) svcerr_systemerr (transp); } if (!svc_freeargs (transp, _xdr_argument, (caddr_t) &argument)) { - fprintf (stderr, "%s", "unable to free arguments"); + printf( "unable to free arguments"); exit (1); } return; diff --git a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c index 45a41ae35e..defadeca19 100644 --- a/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c +++ b/c/src/librdbg/src/powerpc/new_exception_processing/remdeb_xdr.c @@ -97,7 +97,7 @@ xdr_xdr_regs (XDR *xdrs, xdr_regs *objp) return FALSE; return TRUE; } - /* + /* * 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 @@ -105,16 +105,16 @@ xdr_xdr_regs (XDR *xdrs, xdr_regs *objp) * become too small if this value gets incremented. */ bool_t xdr_xdr_mem(xdrs, objp) - XDR *xdrs; - struct xdr_mem *objp; + XDR *xdrs; + struct xdr_mem *objp; { - if (!xdr_u_long(xdrs, &objp->addr)) { - return (FALSE); - } - if (!xdr_u_int(xdrs, &objp->dataNb)) { - return(FALSE); - } - return (xdr_opaque(xdrs, objp->data, objp->dataNb)); + if (!xdr_u_long(xdrs, &objp->addr)) { + return (FALSE); + } + if (!xdr_u_int(xdrs, &objp->dataNb)) { + return(FALSE); + } + return (xdr_opaque(xdrs, objp->data, objp->dataNb)); } bool_t @@ -262,11 +262,11 @@ xdr_KernThread (XDR *xdrs, KernThread *objp) return TRUE; } bool_t xdr_thread_list(xdrs, objp) - XDR *xdrs; - struct thread_list *objp; + XDR *xdrs; + struct thread_list *objp; { - return (xdr_array(xdrs, (char**)&objp->threads, &objp->nbThread, - UTHREAD_MAX, sizeof(KernThread), xdr_KernThread)); + return (xdr_array(xdrs, (char**)&objp->threads, &objp->nbThread, + UTHREAD_MAX, sizeof(KernThread), xdr_KernThread)); } bool_t @@ -386,65 +386,6 @@ xdr_CHAR_DATA (XDR *xdrs, CHAR_DATA *objp) return FALSE; return TRUE; } -#ifndef XRY_MAX_CMD_STR -#endif /* REMDEB_H */ - -bool_t -xdr_xry_inst (XDR *xdrs, xry_inst *objp) -{ - register int32_t *buf; - - if (!xdr_u_char (xdrs, &objp->flags)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->sub_type)) - return FALSE; - if (!xdr_u_char (xdrs, &objp->res_type)) - return FALSE; - if (!xdr_u_long (xdrs, &objp->value)) - return FALSE; - if (!xdr_u_long (xdrs, &objp->value2)) - return FALSE; - return TRUE; -} - -bool_t -xdr_instance (XDR *xdrs, instance *objp) -{ - register int32_t *buf; - - int i; - if (!xdr_vector (xdrs, (char *)objp->instances, XRY_MAX_INSTANCES, - sizeof (xry_inst), (xdrproc_t) xdr_xry_inst)) - return FALSE; - if (!xdr_vector (xdrs, (char *)objp->buffer, XRY_MAX_INST_BUFF, - sizeof (u_char), (xdrproc_t) xdr_u_char)) - return FALSE; - return TRUE; -} - -bool_t -xdr_instance_union (XDR *xdrs, instance_union *objp) -{ - register int32_t *buf; - - if (!xdr_bool (xdrs, &objp->instances)) - return FALSE; - switch (objp->instances) { - case TRUE: - if (!xdr_instance (xdrs, &objp->instance_union_u.inst)) - return FALSE; - break; - case FALSE: - if (!xdr_string (xdrs, &objp->instance_union_u.buffer, XRY_MAX_CMD_STR)) - return FALSE; - break; - default: - return FALSE; - } - return TRUE; -} bool_t xdr_one_arg (XDR *xdrs, one_arg *objp) @@ -455,7 +396,7 @@ xdr_one_arg (XDR *xdrs, one_arg *objp) return FALSE; return TRUE; } - /* now open_connex() routine which establishes a connection to server */ + /* now open_connex() routine which establishes a connection to server */ bool_t xdr_debug_type (XDR *xdrs, debug_type *objp) @@ -466,7 +407,7 @@ xdr_debug_type (XDR *xdrs, debug_type *objp) return FALSE; return TRUE; } -#define DEBUGGER_IS_GDB 0x2 /* */ +#define DEBUGGER_IS_GDB 0x2 /* */ bool_t xdr_open_in (XDR *xdrs, open_in *objp) @@ -573,7 +514,7 @@ xdr_open_out (XDR *xdrs, open_out *objp) return FALSE; return TRUE; } - /* now close_connex() routine which detaches from server */ + /* now close_connex() routine which detaches from server */ bool_t xdr_close_control (XDR *xdrs, close_control *objp) @@ -594,7 +535,7 @@ xdr_close_in (XDR *xdrs, close_in *objp) return FALSE; return TRUE; } - /* now send_signal() routine which sends signals to processes like kill(2) */ + /* now send_signal() routine which sends signals to processes like kill(2) */ bool_t xdr_signal_in (XDR *xdrs, signal_in *objp) @@ -619,7 +560,7 @@ xdr_signal_out (XDR *xdrs, signal_out *objp) return FALSE; return TRUE; } - /* now wait_info() routine which returns results of polling the wait status + /* 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 */ bool_t @@ -744,8 +685,8 @@ xdr_wait_out (XDR *xdrs, wait_out *objp) return FALSE; return TRUE; } - /* now ptrace() routine. This matches the Sun UNIX ptrace as well as - some additions */ + /* now ptrace() routine. This matches the Sun UNIX ptrace as well as + some additions */ bool_t xdr_ptrace_in (XDR *xdrs, ptrace_in *objp) @@ -925,4 +866,4 @@ xdr_get_signal_names_out (XDR *xdrs, get_signal_names_out *objp) return FALSE; return TRUE; } - /* now define the actual calls we support */ + /* now define the actual calls we support */ |