diff options
author | Keith Seitz <keiths@redhat.com> | 2008-03-07 08:03:19 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2008-03-07 08:03:19 +0000 |
commit | 7cc457d5c725934198e3e7e49a57c713dd8553c0 (patch) | |
tree | a214ac6fa69a74b92b3a395b273ba8aae926e4ec | |
parent | 0176cf5a89978aaa27424369d4209716a2fda350 (diff) | |
download | gdb-7cc457d5c725934198e3e7e49a57c713dd8553c0.tar.gz |
* generic/gdbtk-register.c (map_arg): New data type
for passing arguments to mapping functions.
(map_func): New definition of mapping function.
Changed all callers to use these new types.
* generic/gdbtk-stack.c (gdb_get_vars_command): Change
cast to int to dereference of int *.
* generic/gdbtk-wrapper.c: Change all casts to char * for
results and args to use pointer or integer flavor of
gdb_wrapper_args.results and .args.
* generic/gdbtk-wrapper.h: struct gdb_wrapper_arguments
members result and args now return a union of void * and int.
-rw-r--r-- | gdb/gdbtk/ChangeLog | 14 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-register.c | 58 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-stack.c | 2 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-wrapper.c | 236 | ||||
-rw-r--r-- | gdb/gdbtk/generic/gdbtk-wrapper.h | 12 |
5 files changed, 177 insertions, 145 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index 70dedac7ee9..1e9ce8c9fd6 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,17 @@ +2008-03-07 Keith Seitz <kseitz@sourceware.org> + + * generic/gdbtk-register.c (map_arg): New data type + for passing arguments to mapping functions. + (map_func): New definition of mapping function. + Changed all callers to use these new types. + * generic/gdbtk-stack.c (gdb_get_vars_command): Change + cast to int to dereference of int *. + * generic/gdbtk-wrapper.c: Change all casts to char * for + results and args to use pointer or integer flavor of + gdb_wrapper_args.results and .args. + * generic/gdbtk-wrapper.h: struct gdb_wrapper_arguments + members result and args now return a union of void * and int. + 2008-03-03 Keith Seitz <keiths@redhat.com> From Dave Murphy <davem@devkitpro.org>: diff --git a/gdb/gdbtk/generic/gdbtk-register.c b/gdb/gdbtk/generic/gdbtk-register.c index 0e40fa4ea4c..1753120f694 100644 --- a/gdb/gdbtk/generic/gdbtk-register.c +++ b/gdb/gdbtk/generic/gdbtk-register.c @@ -30,24 +30,34 @@ #include "gdbtk.h" #include "gdbtk-cmds.h" +/* Argument passed to our register-mapping functions */ +typedef union +{ + int integer; + void *ptr; +} map_arg; + +/* Type of our mapping functions */ +typedef void (*map_func)(int, map_arg); + /* This contains the previous values of the registers, since the last call to gdb_changed_register_list. It is an array of (NUM_REGS+NUM_PSEUDO_REGS)*MAX_REGISTER_RAW_SIZE bytes. */ static int gdb_register_info (ClientData, Tcl_Interp *, int, Tcl_Obj **); -static void get_register (int, void *); -static void get_register_name (int, void *); -static void get_register_size (int regnum, void *arg); +static void get_register (int, map_arg); +static void get_register_name (int, map_arg); +static void get_register_size (int, map_arg); static int map_arg_registers (Tcl_Interp *, int, Tcl_Obj **, - void (*)(int, void *), void *); -static void register_changed_p (int, void *); + map_func, map_arg); +static void register_changed_p (int, map_arg); static void setup_architecture_data (void); static int gdb_regformat (ClientData, Tcl_Interp *, int, Tcl_Obj **); static int gdb_reggroup (ClientData, Tcl_Interp *, int, Tcl_Obj **); static int gdb_reggrouplist (ClientData, Tcl_Interp *, int, Tcl_Obj **); -static void get_register_types (int regnum, void *arg); +static void get_register_types (int regnum, map_arg); static char *old_regs = NULL; static int *regformat = (int *)NULL; @@ -116,8 +126,8 @@ gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj **objv) { int index; - void *argp; - void (*func)(int, void *); + map_arg arg; + map_func func; static const char *commands[] = {"changed", "name", "size", "value", "type", "format", "group", "grouplist", NULL}; enum commands_enum { REGINFO_CHANGED, REGINFO_NAME, REGINFO_SIZE, REGINFO_VALUE, @@ -144,7 +154,7 @@ gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, { case REGINFO_CHANGED: func = register_changed_p; - argp = NULL; + arg.ptr = NULL; break; case REGINFO_NAME: @@ -153,12 +163,12 @@ gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, char *s = Tcl_GetStringFromObj (objv[0], &len); if (objc != 0 && strncmp (s, "-numbers", len) == 0) { - argp = (void *) 1; + arg.integer = 1; objc--; objv++; } else - argp = NULL; + arg.ptr = NULL; func = get_register_name; } @@ -166,17 +176,17 @@ gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, case REGINFO_SIZE: func = get_register_size; - argp = NULL; + arg.ptr = NULL; break; case REGINFO_VALUE: func = get_register; - argp = NULL; + arg.ptr = NULL; break; case REGINFO_TYPE: func = get_register_types; - argp = NULL; + arg.ptr = NULL; break; case REGINFO_FORMAT: @@ -192,11 +202,11 @@ gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, return TCL_ERROR; } - return map_arg_registers (interp, objc, objv, func, argp); + return map_arg_registers (interp, objc, objv, func, arg); } static void -get_register_size (int regnum, void *arg) +get_register_size (int regnum, map_arg arg) { Tcl_ListObjAppendElement (gdbtk_interp, result_ptr->obj_ptr, Tcl_NewIntObj (register_size (current_gdbarch, regnum))); @@ -207,7 +217,7 @@ get_register_size (int regnum, void *arg) /* special registers. */ static void -get_register_types (int regnum, void *arg) +get_register_types (int regnum, map_arg arg) { struct type *reg_vtype; int i,n; @@ -256,7 +266,7 @@ get_register_types (int regnum, void *arg) static void -get_register (int regnum, void *arg) +get_register (int regnum, map_arg arg) { int realnum; CORE_ADDR addr; @@ -342,10 +352,10 @@ get_register (int regnum, void *arg) } static void -get_register_name (int regnum, void *argp) +get_register_name (int regnum, map_arg arg) { /* Non-zero if the caller wants the register numbers, too. */ - int numbers = (int) argp; + int numbers = arg.integer; Tcl_Obj *name = Tcl_NewStringObj (gdbarch_register_name (current_gdbarch, regnum), -1); Tcl_Obj *elt; @@ -370,7 +380,7 @@ get_register_name (int regnum, void *argp) static int map_arg_registers (Tcl_Interp *interp, int objc, Tcl_Obj **objv, - void (*func) (int regnum, void *argp), void *argp) + map_func func, map_arg arg) { int regnum, numregs; @@ -391,7 +401,7 @@ map_arg_registers (Tcl_Interp *interp, int objc, Tcl_Obj **objv, if (gdbarch_register_name (current_gdbarch, regnum) == NULL || *(gdbarch_register_name (current_gdbarch, regnum)) == '\0') continue; - func (regnum, argp); + func (regnum, arg); } return TCL_OK; } @@ -413,7 +423,7 @@ map_arg_registers (Tcl_Interp *interp, int objc, Tcl_Obj **objv, } if (regnum >= 0 && regnum < numregs) - func (regnum, argp); + func (regnum, arg); else { Tcl_SetStringObj (result_ptr->obj_ptr, "bad register number", -1); @@ -424,7 +434,7 @@ map_arg_registers (Tcl_Interp *interp, int objc, Tcl_Obj **objv, } static void -register_changed_p (int regnum, void *argp) +register_changed_p (int regnum, map_arg arg) { char raw_buffer[MAX_REGISTER_SIZE]; diff --git a/gdb/gdbtk/generic/gdbtk-stack.c b/gdb/gdbtk/generic/gdbtk-stack.c index 9f0c815aea1..bc5bcfbcaf4 100644 --- a/gdb/gdbtk/generic/gdbtk-stack.c +++ b/gdb/gdbtk/generic/gdbtk-stack.c @@ -295,7 +295,7 @@ gdb_get_vars_command (ClientData clientData, Tcl_Interp *interp, return TCL_ERROR; } - arguments = (int) clientData; + arguments = *(int*) clientData; /* Initialize the result pointer to an empty list. */ diff --git a/gdb/gdbtk/generic/gdbtk-wrapper.c b/gdb/gdbtk/generic/gdbtk-wrapper.c index 77f2c286d77..7168208f5e0 100644 --- a/gdb/gdbtk/generic/gdbtk-wrapper.c +++ b/gdb/gdbtk/generic/gdbtk-wrapper.c @@ -152,10 +152,10 @@ GDB_type_print (value_ptr val, char *varstring, { struct gdb_wrapper_arguments args; - args.args[0] = (char *) val; - args.args[1] = varstring; - args.args[2] = (char *) stream; - args.args[3] = (char *) show; + args.args[0].ptr = val; + args.args[1].ptr = varstring; + args.args[2].ptr = stream; + args.args[3].integer = show; return call_wrapped_function ((catch_errors_ftype *) wrap_type_print, &args); } @@ -163,10 +163,10 @@ static int wrap_type_print (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; - value_ptr val = (value_ptr) (*args)->args[0]; - char *varstring = (*args)->args[1]; - struct ui_file *stream = (struct ui_file *) (*args)->args[2]; - int show = (int) (*args)->args[3]; + value_ptr val = (value_ptr) (*args)->args[0].ptr; + char *varstring = (*args)->args[1].ptr; + struct ui_file *stream = (struct ui_file *) (*args)->args[2].ptr; + int show = (*args)->args[3].integer; type_print (value_type (val), varstring, stream, show); return 1; } @@ -183,14 +183,14 @@ GDB_val_print (struct type *type, { struct gdb_wrapper_arguments args; - args.args[0] = (char *) type; - args.args[1] = (char *) valaddr; - args.args[2] = (char *) &address; - args.args[3] = (char *) stream; - args.args[4] = (char *) format; - args.args[5] = (char *) deref_ref; - args.args[6] = (char *) recurse; - args.args[7] = (char *) pretty; + args.args[0].ptr = type; + args.args[1].ptr = valaddr; + args.args[2].ptr = &address; + args.args[3].ptr = stream; + args.args[4].integer = format; + args.args[5].integer = deref_ref; + args.args[6].integer = recurse; + args.args[7].integer = pretty; return call_wrapped_function ((catch_errors_ftype *) wrap_val_print, &args); } @@ -208,14 +208,14 @@ wrap_val_print (char *a) int recurse; enum val_prettyprint pretty; - type = (struct type *) (*args)->args[0]; - valaddr = (gdb_byte *) (*args)->args[1]; - address = *(CORE_ADDR *) (*args)->args[2]; - stream = (struct ui_file *) (*args)->args[3]; - format = (int) (*args)->args[4]; - deref_ref = (int) (*args)->args[5]; - recurse = (int) (*args)->args[6]; - pretty = (enum val_prettyprint) (*args)->args[7]; + type = (struct type *) (*args)->args[0].ptr; + valaddr = (gdb_byte *) (*args)->args[1].ptr; + address = *(CORE_ADDR *) (*args)->args[2].ptr; + stream = (struct ui_file *) (*args)->args[3].ptr; + format = (*args)->args[4].integer; + deref_ref = (*args)->args[5].integer; + recurse = (*args)->args[6].integer; + pretty = (enum val_prettyprint) (*args)->args[7].integer; val_print (type, valaddr, 0, address, stream, format, deref_ref, recurse, pretty); @@ -227,7 +227,7 @@ GDB_value_fetch_lazy (value_ptr value) { struct gdb_wrapper_arguments args; - args.args[0] = (char *) value; + args.args[0].ptr = value; return call_wrapped_function ((catch_errors_ftype *) wrap_value_fetch_lazy, &args); } @@ -236,7 +236,7 @@ wrap_value_fetch_lazy (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; - value_fetch_lazy ((value_ptr) (*args)->args[0]); + value_fetch_lazy ((value_ptr) (*args)->args[0].ptr); return 1; } @@ -245,13 +245,13 @@ GDB_evaluate_expression (struct expression *exp, value_ptr *value) { struct gdb_wrapper_arguments args; gdb_result result; - args.args[0] = (char *) exp; + args.args[0].ptr = exp; result = call_wrapped_function ((catch_errors_ftype *) wrap_evaluate_expression, &args); if (result != GDB_OK) return result; - *value = (value_ptr) args.result; + *value = (value_ptr) args.result.ptr; return GDB_OK; } @@ -260,8 +260,8 @@ wrap_evaluate_expression (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; - (*args)->result = - (char *) evaluate_expression ((struct expression *) (*args)->args[0]); + (*args)->result.ptr = + evaluate_expression ((struct expression *) (*args)->args[0].ptr); return 1; } @@ -274,14 +274,14 @@ GDB_value_equal (val1, val2, result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) val1; - args.args[1] = (char *) val2; + args.args[0].ptr = val1; + args.args[1].ptr = val2; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_equal, &args); if (r != GDB_OK) return r; - *result = (int) args.result; + *result = args.result.integer; return GDB_OK; } @@ -291,10 +291,10 @@ wrap_value_equal (char *a) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; value_ptr val1, val2; - val1 = (value_ptr) (*args)->args[0]; - val2 = (value_ptr) (*args)->args[1]; + val1 = (value_ptr) (*args)->args[0].ptr; + val2 = (value_ptr) (*args)->args[1].ptr; - (*args)->result = (char *) value_equal (val1, val2); + (*args)->result.integer = value_equal (val1, val2); return 1; } @@ -305,15 +305,15 @@ GDB_parse_exp_1 (char **stringptr, struct block *block, struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) stringptr; - args.args[1] = (char *) block; - args.args[2] = (char *) comma; + args.args[0].ptr = stringptr; + args.args[1].ptr = block; + args.args[2].integer = comma; r = call_wrapped_function ((catch_errors_ftype *) wrap_parse_exp_1, &args); if (r != GDB_OK) return r; - *result = (struct expression *) args.result; + *result = (struct expression *) args.result.ptr; return GDB_OK; } @@ -325,11 +325,11 @@ wrap_parse_exp_1 (char *opaque_arg) char **stringptr; int comma; - stringptr = (char **) (*args)->args[0]; - block = (struct block *) (*args)->args[1]; - comma = (int) (*args)->args[2]; + stringptr = (char **) (*args)->args[0].ptr; + block = (struct block *) (*args)->args[1].ptr; + comma = (*args)->args[2].integer; - (*args)->result = (char *) parse_exp_1 (stringptr, block, comma); + (*args)->result.ptr = parse_exp_1 (stringptr, block, comma); return 1; } @@ -339,13 +339,13 @@ GDB_evaluate_type (struct expression *exp, value_ptr *result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) exp; + args.args[0].ptr = exp; r = call_wrapped_function ((catch_errors_ftype *) wrap_evaluate_type, &args); if (r != GDB_OK) return r; - *result = (value_ptr) args.result; + *result = (value_ptr) args.result.ptr; return GDB_OK; } @@ -355,8 +355,8 @@ wrap_evaluate_type (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct expression *exp; - exp = (struct expression *) (*args)->args[0]; - (*args)->result = (char *) evaluate_type (exp); + exp = (struct expression *) (*args)->args[0].ptr; + (*args)->result.ptr = evaluate_type (exp); return 1; } @@ -366,13 +366,13 @@ GDB_block_for_pc (CORE_ADDR pc, struct block **result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) &pc; + args.args[0].ptr = &pc; r = call_wrapped_function ((catch_errors_ftype *) wrap_block_for_pc, &args); if (r != GDB_OK) return r; - *result = (struct block *) args.result; + *result = (struct block *) args.result.ptr; return GDB_OK; } @@ -382,8 +382,8 @@ wrap_block_for_pc (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; CORE_ADDR pc; - pc = *(CORE_ADDR *) (*args)->args[0]; - (*args)->result = (char *) block_for_pc (pc); + pc = *(CORE_ADDR *) (*args)->args[0].ptr; + (*args)->result.ptr = block_for_pc (pc); return 1; } @@ -393,13 +393,13 @@ GDB_block_innermost_frame (struct block *block, struct frame_info **result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) block; + args.args[0].ptr = block; r = call_wrapped_function ((catch_errors_ftype *) wrap_block_innermost_frame, &args); if (r != GDB_OK) return r; - *result = (struct frame_info *) args.result; + *result = (struct frame_info *) args.result.ptr; return GDB_OK; } @@ -409,8 +409,8 @@ wrap_block_innermost_frame (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct block *block; - block = (struct block *) (*args)->args[0]; - (*args)->result = (char *) block_innermost_frame (block); + block = (struct block *) (*args)->args[0].ptr; + (*args)->result.ptr = block_innermost_frame (block); return 1; } @@ -439,13 +439,13 @@ GDB_value_ind (value_ptr val, value_ptr *rval) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) val; + args.args[0].ptr = val; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_ind, &args); if (r != GDB_OK) return r; - *rval = (value_ptr) args.result; + *rval = (value_ptr) args.result.ptr; return GDB_OK; } @@ -455,8 +455,8 @@ wrap_value_ind (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; - val = (value_ptr) (*args)->args[0]; - (*args)->result = (char *) value_ind (val); + val = (value_ptr) (*args)->args[0].ptr; + (*args)->result.ptr = value_ind (val); return 1; } @@ -466,15 +466,15 @@ GDB_value_slice (value_ptr val, int low, int num, value_ptr *rval) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) val; - args.args[1] = (char *) &low; - args.args[2] = (char *) # + args.args[0].ptr = val; + args.args[1].integer = low; + args.args[2].integer = num; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_slice, &args); if (r != GDB_OK) return r; - *rval = (value_ptr) args.result; + *rval = (value_ptr) args.result.ptr; return GDB_OK; } @@ -485,10 +485,10 @@ wrap_value_slice (char *opaque_arg) value_ptr val; int low, num; - val = (value_ptr) (*args)->args[0]; - low = *(int *) (*args)->args[1]; - num = *(int *) (*args)->args[2]; - (*args)->result = (char *) value_slice (val, low, num); + val = (value_ptr) (*args)->args[0].ptr; + low = (*args)->args[1].integer; + num = (*args)->args[2].integer; + (*args)->result.ptr = value_slice (val, low, num); return 1; } @@ -500,14 +500,14 @@ GDB_value_coerce_array (val, rval) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) val; + args.args[0].ptr = val; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_coerce_array, &args); if (r != GDB_OK) return r; - *rval = (value_ptr) args.result; + *rval = (value_ptr) args.result.ptr; return GDB_OK; } @@ -517,8 +517,8 @@ wrap_value_coerce_array (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; - val = (value_ptr) (*args)->args[0]; - (*args)->result = (char *) value_coerce_array (val); + val = (value_ptr) (*args)->args[0].ptr; + (*args)->result.ptr = value_coerce_array (val); return 1; } @@ -533,16 +533,16 @@ GDB_value_struct_elt (value_ptr *argp, struct gdb_wrapper_arguments argss; gdb_result r; - argss.args[0] = (char *) argp; - argss.args[1] = (char *) args; - argss.args[2] = name; - argss.args[3] = (char *) static_memfunc; - argss.args[4] = err; + argss.args[0].ptr = argp; + argss.args[1].ptr = args; + argss.args[2].ptr = name; + argss.args[3].ptr = static_memfunc; + argss.args[4].ptr = err; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_struct_elt, &argss); if (r != GDB_OK) return r; - *rval = (value_ptr) argss.result; + *rval = (value_ptr) argss.result.ptr; return GDB_OK; } @@ -555,13 +555,13 @@ wrap_value_struct_elt (char *opaque_arg) int *static_memfunc; char *err; - argp = (value_ptr *) (*argss)->args[0]; - args = (value_ptr *) (*argss)->args[1]; - name = (*argss)->args[2]; - static_memfunc = (int *) (*argss)->args[3]; - err = (*argss)->args[4]; + argp = (value_ptr *) (*argss)->args[0].ptr; + args = (value_ptr *) (*argss)->args[1].ptr; + name = (char *) (*argss)->args[2].ptr; + static_memfunc = (int *) (*argss)->args[3].ptr; + err = (char *) (*argss)->args[4].ptr; - (*argss)->result = (char *) value_struct_elt (argp, args, name, static_memfunc, err); + (*argss)->result.ptr = value_struct_elt (argp, args, name, static_memfunc, err); return 1; } @@ -571,14 +571,14 @@ GDB_value_cast (struct type *type, value_ptr val, value_ptr *rval) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) type; - args.args[1] = (char *) val; + args.args[0].ptr = type; + args.args[1].ptr = val; r = call_wrapped_function ((catch_errors_ftype *) wrap_value_cast, &args); if (r != GDB_OK) return r; - *rval = (value_ptr) args.result; + *rval = (value_ptr) args.result.ptr; return GDB_OK; } @@ -589,9 +589,9 @@ wrap_value_cast (char *opaque_arg) value_ptr val; struct type *type; - type = (struct type *) (*args)->args[0]; - val = (value_ptr) (*args)->args[1]; - (*args)->result = (char *) value_cast (type, val); + type = (struct type *) (*args)->args[0].ptr; + val = (value_ptr) (*args)->args[1].ptr; + (*args)->result.ptr = value_cast (type, val); return 1; } @@ -602,13 +602,13 @@ GDB_get_frame_block (struct frame_info *fi, struct block **rval) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) fi; + args.args[0].ptr = fi; r = call_wrapped_function ((catch_errors_ftype *) wrap_get_frame_block, &args); if (r != GDB_OK) return r; - *rval = (struct block *) args.result; + *rval = (struct block *) args.result.ptr; return GDB_OK; } @@ -618,8 +618,8 @@ wrap_get_frame_block (char *opaque_arg) struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct frame_info *fi; - fi = (struct frame_info *) (*args)->args[0]; - (*args)->result = (char *) get_frame_block (fi, NULL); + fi = (struct frame_info *) (*args)->args[0].ptr; + (*args)->result.ptr = get_frame_block (fi, NULL); return 1; } @@ -630,12 +630,12 @@ GDB_get_prev_frame (struct frame_info *fi, struct frame_info **result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) fi; + args.args[0].ptr = fi; r = call_wrapped_function ((catch_errors_ftype *) wrap_get_prev_frame, &args); if (r != GDB_OK) return r; - *result = (struct frame_info *) args.result; + *result = (struct frame_info *) args.result.ptr; return GDB_OK; } @@ -643,9 +643,9 @@ static int wrap_get_prev_frame (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; - struct frame_info *fi = (struct frame_info *) (*args)->args[0]; + struct frame_info *fi = (struct frame_info *) (*args)->args[0].ptr; - (*args)->result = (char *) get_prev_frame (fi); + (*args)->result.ptr = get_prev_frame (fi); return 1; } @@ -655,12 +655,12 @@ GDB_get_next_frame (struct frame_info *fi, struct frame_info **result) struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) fi; + args.args[0].ptr = fi; r = call_wrapped_function ((catch_errors_ftype *) wrap_get_next_frame, &args); if (r != GDB_OK) return r; - *result = (struct frame_info *) args.result; + *result = (struct frame_info *) args.result.ptr; return GDB_OK; } @@ -668,9 +668,9 @@ static int wrap_get_next_frame (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; - struct frame_info *fi = (struct frame_info *) (*args)->args[0]; + struct frame_info *fi = (struct frame_info *) (*args)->args[0].ptr; - (*args)->result = (char *) get_next_frame (fi); + (*args)->result.ptr = get_next_frame (fi); return 1; } @@ -681,15 +681,15 @@ GDB_find_relative_frame (struct frame_info *fi, int *start, struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) fi; - args.args[1] = (char *) start; + args.args[0].ptr = fi; + args.args[1].ptr = start; r = call_wrapped_function ((catch_errors_ftype *) wrap_find_relative_frame, &args); if (r != GDB_OK) return r; - *result = (struct frame_info *) args.result; + *result = (struct frame_info *) args.result.ptr; return GDB_OK; } @@ -697,10 +697,10 @@ static int wrap_find_relative_frame (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; - struct frame_info *fi = (struct frame_info *) (*args)->args[0]; - int *start = (int *) (*args)->args[1]; + struct frame_info *fi = (struct frame_info *) (*args)->args[0].ptr; + int *start = (int *) (*args)->args[1].ptr; - (*args)->result = (char *) find_relative_frame (fi, start); + (*args)->result.ptr = find_relative_frame (fi, start); return 1; } @@ -715,7 +715,7 @@ GDB_get_current_frame (struct frame_info **result) if (r != GDB_OK) return r; - *result = (struct frame_info *) args.result; + *result = (struct frame_info *) args.result.ptr; return GDB_OK; } @@ -724,7 +724,7 @@ wrap_get_current_frame (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; - (*args)->result = (char *) get_current_frame (); + (*args)->result.ptr = get_current_frame (); return 1; } @@ -735,15 +735,15 @@ GDB_varobj_update (struct varobj **varp, struct varobj ***changelist, struct gdb_wrapper_arguments args; gdb_result r; - args.args[0] = (char *) varp; - args.args[1] = (char *) changelist; - args.args[2] = (char *) explicit; + args.args[0].ptr = varp; + args.args[1].ptr = changelist; + args.args[2].integer = explicit; r = call_wrapped_function ((catch_errors_ftype *) wrap_varobj_update, &args); if (r != GDB_OK) return r; - *result = (int) args.result; + *result = args.result.integer; return GDB_OK; } @@ -751,10 +751,10 @@ static int wrap_varobj_update (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; - struct varobj **varp = (struct varobj **) (*args)->args[0]; - struct varobj ***changelist = (struct varobj ***) (*args)->args[1]; - int explicit = (int) (*args)->args[2]; + struct varobj **varp = (struct varobj **) (*args)->args[0].ptr; + struct varobj ***changelist = (struct varobj ***) (*args)->args[1].ptr; + int explicit = (*args)->args[2].integer; - (*args)->result = (char *) varobj_update (varp, changelist, explicit); + (*args)->result.integer = varobj_update (varp, changelist, explicit); return 1; } diff --git a/gdb/gdbtk/generic/gdbtk-wrapper.h b/gdb/gdbtk/generic/gdbtk-wrapper.h index 4ff5e4f8e18..57d7eabfbac 100644 --- a/gdb/gdbtk/generic/gdbtk-wrapper.h +++ b/gdb/gdbtk/generic/gdbtk-wrapper.h @@ -26,10 +26,18 @@ Boston, MA 02110-1301, USA. */ struct gdb_wrapper_arguments { /* Pointer to some result from the gdb function call, if any */ - char *result; + union + { + int integer; + void *ptr; + } result; /* The list of arguments. */ - char *args[10]; + union + { + void *ptr; + int integer; + } args[10]; }; /* FIXME: cagney/2002-01-04: GDB no longer uses or supplies the |