From 5de4b2db74fb8727a303324809d62c863167620c Mon Sep 17 00:00:00 2001 From: Martin Hunt Date: Thu, 7 Feb 2002 05:05:06 +0000 Subject: 2002-02-06 Martin M. Hunt * generic/gdbtk.c, generic/gdbtk-bp.c, generic/gdbtk-cmds.c, generic/gdbtk-hooks.c, generic/gdbtk-register.c, generic/gdbtk-stack.c, generic/gdbtk-varobj.c, generic/gdbtk-wrapper.c: Cleanup. Fix indentation. Fix function declarations. Remove unused variables. Add 2002 copyrights. --- gdb/gdbtk/ChangeLog | 9 + gdb/gdbtk/generic/gdbtk-bp.c | 141 +++---- gdb/gdbtk/generic/gdbtk-cmds.c | 732 ++++++++++++++++--------------------- gdb/gdbtk/generic/gdbtk-hooks.c | 77 ++-- gdb/gdbtk/generic/gdbtk-register.c | 34 +- gdb/gdbtk/generic/gdbtk-stack.c | 104 ++---- gdb/gdbtk/generic/gdbtk-varobj.c | 113 +++--- gdb/gdbtk/generic/gdbtk-wrapper.c | 152 +++----- gdb/gdbtk/generic/gdbtk.c | 59 ++- 9 files changed, 579 insertions(+), 842 deletions(-) (limited to 'gdb/gdbtk') diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index 11e49d50c96..896f8e2b38e 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,12 @@ +2002-02-06 Martin M. Hunt + + * generic/gdbtk.c, generic/gdbtk-bp.c, generic/gdbtk-cmds.c, + generic/gdbtk-hooks.c, generic/gdbtk-register.c, + generic/gdbtk-stack.c, generic/gdbtk-varobj.c, + generic/gdbtk-wrapper.c: Cleanup. Fix indentation. Fix + function declarations. Remove unused variables. Add 2002 + copyrights. + 2002-02-06 Keith Seitz * library/images/cygnus.gif: Remove. diff --git a/gdb/gdbtk/generic/gdbtk-bp.c b/gdb/gdbtk/generic/gdbtk-bp.c index dde0416891e..61ee861d911 100644 --- a/gdb/gdbtk/generic/gdbtk-bp.c +++ b/gdb/gdbtk/generic/gdbtk-bp.c @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight - Breakpoints. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -41,17 +41,17 @@ extern void report_error (void); They are also used in gdbtk-hooks.c */ char *bptypes[] = -{"none", "breakpoint", "hw breakpoint", "until", - "finish", "watchpoint", "hw watchpoint", - "read watchpoint", "acc watchpoint", - "longjmp", "longjmp resume", "step resume", - "sigtramp", "watchpoint scope", - "call dummy", "shlib events", "catch load", - "catch unload", "catch fork", "catch vfork", - "catch exec", "catch catch", "catch throw" -}; + {"none", "breakpoint", "hw breakpoint", "until", + "finish", "watchpoint", "hw watchpoint", + "read watchpoint", "acc watchpoint", + "longjmp", "longjmp resume", "step resume", + "sigtramp", "watchpoint scope", + "call dummy", "shlib events", "catch load", + "catch unload", "catch fork", "catch vfork", + "catch exec", "catch catch", "catch throw" + }; char *bpdisp[] = -{"delete", "delstop", "disable", "donttouch"}; + {"delete", "delstop", "disable", "donttouch"}; /* Is this breakpoint interesting to a user interface? */ #define BREAKPOINT_IS_INTERESTING(bp) \ @@ -189,16 +189,16 @@ Gdbtk_Breakpoint_Init (Tcl_Interp *interp) disable, Disable it donttouch Leave it alone }; - */ +*/ /* This implements the tcl command "gdb_find_bp_at_addr" - * Tcl Arguments: - * addr: address - * Tcl Result: - * It returns a list of breakpoint numbers - */ +* Tcl Arguments: +* addr: address +* Tcl Result: +* It returns a list of breakpoint numbers +*/ static int gdb_find_bp_at_addr (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) @@ -228,23 +228,19 @@ gdb_find_bp_at_addr (ClientData clientData, Tcl_Interp *interp, /* This implements the tcl command "gdb_find_bp_at_line" - * Tcl Arguments: - * filename: the file in which to find the breakpoint - * line: the line number for the breakpoint - * Tcl Result: - * It returns a list of breakpoint numbers - */ +* Tcl Arguments: +* filename: the file in which to find the breakpoint +* line: the line number for the breakpoint +* Tcl Result: +* It returns a list of breakpoint numbers +*/ static int -gdb_find_bp_at_line (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_find_bp_at_line (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symtab *s; - int line; - int i; + int i, line; if (objc != 3) { @@ -287,7 +283,6 @@ gdb_get_breakpoint_info (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct symtab_and_line sal; - struct command_line *cmd; int bpnum; struct breakpoint *b; char *funcname, *filename; @@ -397,7 +392,7 @@ get_breakpoint_commands (struct command_line *cmd) Tcl_AppendToObj (tmp, cmd->line, -1); Tcl_ListObjAppendElement (NULL, obj, tmp); Tcl_ListObjAppendList (NULL, obj, - get_breakpoint_commands (*cmd->body_list)); + get_breakpoint_commands (*cmd->body_list)); sprintf_append_element_to_obj (obj, "end"); break; @@ -413,7 +408,7 @@ get_breakpoint_commands (struct command_line *cmd) { sprintf_append_element_to_obj (obj, "else"); Tcl_ListObjAppendList (NULL, obj, - get_breakpoint_commands(cmd->body_list[1])); + get_breakpoint_commands(cmd->body_list[1])); } sprintf_append_element_to_obj (obj, "end"); break; @@ -438,11 +433,8 @@ get_breakpoint_commands (struct command_line *cmd) * A list of breakpoint numbers. */ static int -gdb_get_breakpoint_list (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_breakpoint_list (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int i; Tcl_Obj *new_obj; @@ -536,7 +528,7 @@ gdb_set_bp (ClientData clientData, Tcl_Interp *interp, /* FIXME: this won't work for duplicate basenames! */ xasprintf (&buf, "%s:%d", basename (Tcl_GetStringFromObj (objv[1], NULL)), - line); + line); b->addr_string = xstrdup (buf); free(buf); @@ -564,7 +556,7 @@ gdb_set_bp_addr (ClientData clientData, Tcl_Interp *interp, int objc, int thread = -1; CORE_ADDR addr; struct breakpoint *b; - char *saddr, *typestr, *buf; + char *saddr, *typestr; enum bpdisp disp; if (objc != 3 && objc != 4) @@ -673,9 +665,7 @@ gdbtk_modify_breakpoint (int num) * On error, the error string is written to gdb_stdout. */ static void -breakpoint_notify (num, action) - int num; - const char *action; +breakpoint_notify (int num, const char *action) { char *buf; @@ -710,11 +700,8 @@ breakpoint_notify (num, action) */ static int -gdb_actions_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_actions_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct tracepoint *tp; Tcl_Obj **actions; @@ -779,11 +766,8 @@ gdb_actions_command (clientData, interp, objc, objv) } static int -gdb_get_trace_frame_num (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_trace_frame_num (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { if (objc != 1) { @@ -821,7 +805,7 @@ gdb_get_tracepoint_info (ClientData clientData, Tcl_Interp *interp, ALL_TRACEPOINTS (tp) if (tp->number == tpnum) - break; + break; if (tp == NULL) { @@ -875,11 +859,10 @@ gdb_get_tracepoint_info (ClientData clientData, Tcl_Interp *interp, /* return a list of all tracepoint numbers in interpreter */ static int -gdb_get_tracepoint_list (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_tracepoint_list (ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { struct tracepoint *tp; @@ -893,11 +876,10 @@ gdb_get_tracepoint_list (clientData, interp, objc, objv) } static int -gdb_trace_status (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_trace_status (ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { int result = 0; @@ -930,17 +912,17 @@ tracepoint_exists (char *args) strcat (file, sals.sals[0].symtab->filename); ALL_TRACEPOINTS (tp) - { - if (tp->address == sals.sals[0].pc) - result = tp->number; + { + if (tp->address == sals.sals[0].pc) + result = tp->number; #if 0 - /* Why is this here? This messes up assembly traces */ - else if (tp->source_file != NULL - && strcmp (tp->source_file, file) == 0 - && sals.sals[0].line == tp->line_number) - result = tp->number; + /* Why is this here? This messes up assembly traces */ + else if (tp->source_file != NULL + && strcmp (tp->source_file, file) == 0 + && sals.sals[0].line == tp->line_number) + result = tp->number; #endif - } + } } } if (file != NULL) @@ -949,11 +931,10 @@ tracepoint_exists (char *args) } static int -gdb_tracepoint_exists_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_tracepoint_exists_command (ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[]) { char *args; @@ -994,9 +975,7 @@ gdbtk_modify_tracepoint (int num) } static void -tracepoint_notify (num, action) - int num; - const char *action; +tracepoint_notify (int num, const char *action) { char *buf; diff --git a/gdb/gdbtk/generic/gdbtk-cmds.c b/gdb/gdbtk/generic/gdbtk-cmds.c index 67ce4c3f99e..33f892f08ff 100644 --- a/gdb/gdbtk/generic/gdbtk-cmds.c +++ b/gdb/gdbtk/generic/gdbtk-cmds.c @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -81,16 +81,17 @@ int load_in_progress = 0; reordering in this function. */ struct my_line_entry - { - int line; - CORE_ADDR start_pc; - CORE_ADDR end_pc; - }; +{ + int line; + CORE_ADDR start_pc; + CORE_ADDR end_pc; +}; /* Use this to pass the Tcl Text widget command and the open file descriptor to the disassembly load command. */ -struct disassembly_client_data { +struct disassembly_client_data +{ FILE *fp; int file_opened_p; int widget_line_no; @@ -213,8 +214,7 @@ static int fromhex (int a); */ int -Gdbtk_Init (interp) - Tcl_Interp *interp; +Gdbtk_Init (Tcl_Interp *interp) { Tcl_CreateObjCommand (interp, "gdb_cmd", gdbtk_call_wrapper, gdb_cmd, NULL); Tcl_CreateObjCommand (interp, "gdb_immediate", gdbtk_call_wrapper, @@ -326,11 +326,8 @@ Gdbtk_Init (interp) necessary. */ int -gdbtk_call_wrapper (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdbtk_call_wrapper (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct wrapped_call_args wrapped_args; gdbtk_result new_result, *old_result_ptr; @@ -413,8 +410,7 @@ gdbtk_call_wrapper (clientData, interp, objc, objv) */ static int -wrapped_call (opaque_args) - PTR opaque_args; +wrapped_call (PTR opaque_args) { struct wrapped_call_args *args = (struct wrapped_call_args *) opaque_args; args->val = (*args->func) (args->func, args->interp, args->objc, args->objv); @@ -445,24 +441,21 @@ sprintf_append_element_to_obj (Tcl_Obj * objp, char *format,...) /* This implements the tcl command gdb_clear_file. - * Prepare to accept a new executable file. This is called when we - * want to clear away everything we know about the old file, without - * asking the user. The Tcl code will have already asked the user if - * necessary. After this is called, we should be able to run the - * `file' command without getting any questions. - * - * Arguments: - * None - * Tcl Result: - * None - */ +* Prepare to accept a new executable file. This is called when we +* want to clear away everything we know about the old file, without +* asking the user. The Tcl code will have already asked the user if +* necessary. After this is called, we should be able to run the +* `file' command without getting any questions. +* +* Arguments: +* None +* Tcl Result: +* None +*/ static int -gdb_clear_file (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_clear_file (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { if (objc != 1) { @@ -498,11 +491,8 @@ gdb_clear_file (clientData, interp, objc, objv) */ static int -gdb_confirm_quit (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_confirm_quit (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int ret; @@ -527,11 +517,8 @@ gdb_confirm_quit (clientData, interp, objc, objv) */ static int -gdb_force_quit (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_force_quit (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { if (objc != 1) { @@ -568,11 +555,8 @@ gdb_force_quit (clientData, interp, objc, objv) */ static int -gdb_stop (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_stop (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int force = 0; char *s; @@ -665,25 +649,22 @@ gdb_eval (ClientData clientData, Tcl_Interp *interp, /* This implements the tcl command "gdb_cmd". - * It sends its argument to the GDB command scanner for execution. - * This command will never cause the update, idle and busy hooks to be called - * within the GUI. - * - * Tcl Arguments: - * command - The GDB command to execute - * from_tty - 1 indicates this comes to the console. - * Pass this to the gdb command. - * Tcl Result: - * The output from the gdb command (except for the "load" & "while" - * which dump their output to the console. - */ +* It sends its argument to the GDB command scanner for execution. +* This command will never cause the update, idle and busy hooks to be called +* within the GUI. +* +* Tcl Arguments: +* command - The GDB command to execute +* from_tty - 1 indicates this comes to the console. +* Pass this to the gdb command. +* Tcl Result: +* The output from the gdb command (except for the "load" & "while" +* which dump their output to the console. +*/ static int -gdb_cmd (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_cmd (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int from_tty = 0; @@ -747,13 +728,9 @@ gdb_cmd (clientData, interp, objc, objv) */ static int -gdb_immediate_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_immediate_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { - int from_tty = 0; if (objc < 2 || objc > 3) @@ -789,20 +766,17 @@ gdb_immediate_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_prompt" - * It returns the gdb interpreter's prompt. - * - * Tcl Arguments: - * None. - * Tcl Result: - * The prompt. - */ +* It returns the gdb interpreter's prompt. +* +* Tcl Arguments: +* None. +* Tcl Result: +* The prompt. +*/ static int -gdb_prompt_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_prompt_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { Tcl_SetStringObj (result_ptr->obj_ptr, get_prompt (), -1); return TCL_OK; @@ -815,20 +789,17 @@ gdb_prompt_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_target_has_execution" - * Tells whether the target is executing. - * - * Tcl Arguments: - * None - * Tcl Result: - * A boolean indicating whether the target is executing. - */ +* Tells whether the target is executing. +* +* Tcl Arguments: +* None +* Tcl Result: +* A boolean indicating whether the target is executing. +*/ static int -gdb_target_has_execution_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_target_has_execution_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int result = 0; @@ -841,20 +812,17 @@ gdb_target_has_execution_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_get_inferior_args" - * Returns inferior command line arguments as a string - * - * Tcl Arguments: - * None - * Tcl Result: - * A string containing the inferior command line arguments - */ +* Returns inferior command line arguments as a string +* +* Tcl Arguments: +* None +* Tcl Result: +* A string containing the inferior command line arguments +*/ static int -gdb_get_inferior_args (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_inferior_args (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { if (objc != 1) { @@ -868,20 +836,17 @@ gdb_get_inferior_args (clientData, interp, objc, objv) /* This implements the tcl command "gdb_set_inferior_args" - * Sets inferior command line arguments - * - * Tcl Arguments: - * A string containing the inferior command line arguments - * Tcl Result: - * None - */ +* Sets inferior command line arguments +* +* Tcl Arguments: +* A string containing the inferior command line arguments +* Tcl Result: +* None +*/ static int -gdb_set_inferior_args (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_set_inferior_args (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *args; @@ -905,20 +870,17 @@ gdb_set_inferior_args (clientData, interp, objc, objv) /* This implements the tcl command "gdb_load_info" - * It returns information about the file about to be downloaded. - * - * Tcl Arguments: - * filename: The file to open & get the info on. - * Tcl Result: - * A list consisting of the name and size of each section. - */ +* It returns information about the file about to be downloaded. +* +* Tcl Arguments: +* filename: The file to open & get the info on. +* Tcl Result: +* A list consisting of the name and size of each section. +*/ static int -gdb_load_info (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_load_info (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { bfd *loadfile_bfd; struct cleanup *old_cleanups; @@ -967,20 +929,17 @@ gdb_load_info (clientData, interp, objc, objv) /* This implements the tcl command "gdb_get_line" - * It returns the linenumber for a given linespec. It will take any spec - * that can be passed to decode_line_1 - * - * Tcl Arguments: - * linespec - the line specification - * Tcl Result: - * The line number for that spec. - */ +* It returns the linenumber for a given linespec. It will take any spec +* that can be passed to decode_line_1 +* +* Tcl Arguments: +* linespec - the line specification +* Tcl Result: +* The line number for that spec. +*/ static int -gdb_get_line_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_line_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symtabs_and_lines sals; char *args, **canonical; @@ -1006,20 +965,17 @@ gdb_get_line_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_get_file" - * It returns the file containing a given line spec. - * - * Tcl Arguments: - * linespec - The linespec to look up - * Tcl Result: - * The file containing it. - */ +* It returns the file containing a given line spec. +* +* Tcl Arguments: +* linespec - The linespec to look up +* Tcl Result: +* The file containing it. +*/ static int -gdb_get_file_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_file_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symtabs_and_lines sals; char *args, **canonical; @@ -1045,19 +1001,16 @@ gdb_get_file_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_get_function" - * It finds the function containing the given line spec. - * - * Tcl Arguments: - * linespec - The line specification - * Tcl Result: - * The function that contains it, or "N/A" if it is not in a function. - */ +* It finds the function containing the given line spec. +* +* Tcl Arguments: +* linespec - The line specification +* Tcl Result: +* The function that contains it, or "N/A" if it is not in a function. +*/ static int -gdb_get_function_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_function_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *function; struct symtabs_and_lines sals; @@ -1085,21 +1038,18 @@ gdb_get_function_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_find_file" - * It searches the symbol tables to get the full pathname to a file. - * - * Tcl Arguments: - * filename: the file name to search for. - * Tcl Result: - * The full path to the file, an empty string if the file was not - * available or an error message if the file is not found in the symtab. - */ +* It searches the symbol tables to get the full pathname to a file. +* +* Tcl Arguments: +* filename: the file name to search for. +* Tcl Result: +* The full path to the file, an empty string if the file was not +* available or an error message if the file is not found in the symtab. +*/ static int -gdb_find_file_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_find_file_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symtab *st; char *filename, *fullname; @@ -1139,29 +1089,26 @@ gdb_find_file_command (clientData, interp, objc, objv) /* This implements the tcl command "gdb_listfiles" - * This lists all the files in the current executible. - * - * Note that this currently pulls in all sorts of filenames - * that aren't really part of the executable. It would be - * best if we could check each file to see if it actually - * contains executable lines of code, but we can't do that - * with psymtabs. - * - * Arguments: - * ?pathname? - If provided, only files which match pathname - * (up to strlen(pathname)) are included. THIS DOES NOT - * CURRENTLY WORK BECAUSE PARTIAL_SYMTABS DON'T SUPPLY - * THE FULL PATHNAME!!! - * - * Tcl Result: - * A list of all matching files. - */ +* This lists all the files in the current executible. +* +* Note that this currently pulls in all sorts of filenames +* that aren't really part of the executable. It would be +* best if we could check each file to see if it actually +* contains executable lines of code, but we can't do that +* with psymtabs. +* +* Arguments: +* ?pathname? - If provided, only files which match pathname +* (up to strlen(pathname)) are included. THIS DOES NOT +* CURRENTLY WORK BECAUSE PARTIAL_SYMTABS DON'T SUPPLY +* THE FULL PATHNAME!!! +* +* Tcl Result: +* A list of all matching files. +*/ static int -gdb_listfiles (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_listfiles (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct objfile *objfile; struct partial_symtab *psymtab; @@ -1182,38 +1129,38 @@ gdb_listfiles (clientData, interp, objc, objv) pathname = Tcl_GetStringFromObj (objv[1], &len); ALL_PSYMTABS (objfile, psymtab) - { - if (numfiles == files_size) - { - files_size = files_size * 2; - files = (char **) xrealloc (files, sizeof (char *) * files_size); - } - if (psymtab->filename) - { - if (!len || !strncmp (pathname, psymtab->filename, len) - || !strcmp (psymtab->filename, basename (psymtab->filename))) - { - files[numfiles++] = basename (psymtab->filename); - } - } - } + { + if (numfiles == files_size) + { + files_size = files_size * 2; + files = (char **) xrealloc (files, sizeof (char *) * files_size); + } + if (psymtab->filename) + { + if (!len || !strncmp (pathname, psymtab->filename, len) + || !strcmp (psymtab->filename, basename (psymtab->filename))) + { + files[numfiles++] = basename (psymtab->filename); + } + } + } ALL_SYMTABS (objfile, symtab) - { - if (numfiles == files_size) - { - files_size = files_size * 2; - files = (char **) xrealloc (files, sizeof (char *) * files_size); - } - if (symtab->filename && symtab->linetable && symtab->linetable->nitems) - { - if (!len || !strncmp (pathname, symtab->filename, len) - || !strcmp (symtab->filename, basename (symtab->filename))) - { - files[numfiles++] = basename (symtab->filename); - } - } - } + { + if (numfiles == files_size) + { + files_size = files_size * 2; + files = (char **) xrealloc (files, sizeof (char *) * files_size); + } + if (symtab->filename && symtab->linetable && symtab->linetable->nitems) + { + if (!len || !strncmp (pathname, symtab->filename, len) + || !strcmp (symtab->filename, basename (symtab->filename))) + { + files[numfiles++] = basename (symtab->filename); + } + } + } qsort (files, numfiles, sizeof (char *), comp_files); @@ -1237,8 +1184,7 @@ gdb_listfiles (clientData, interp, objc, objv) } static int -comp_files (file1, file2) - const void *file1, *file2; +comp_files (const void *file1, const void *file2) { return strcmp (*(char **) file1, *(char **) file2); } @@ -1247,25 +1193,22 @@ comp_files (file1, file2) /* This implements the tcl command "gdb_search" - * Tcl Arguments: - * option - One of "functions", "variables" or "types" - * regexp - The regular expression to look for. - * Then, optionally: - * -files fileList - * -static 1/0 - * -filename 1/0 - * Tcl Result: - * A list of all the matches found. Optionally, if -filename is set to 1, - * then the output is a list of two element lists, with the symbol first, - * and the file in which it is found second. - */ +* Tcl Arguments: +* option - One of "functions", "variables" or "types" +* regexp - The regular expression to look for. +* Then, optionally: +* -files fileList +* -static 1/0 +* -filename 1/0 +* Tcl Result: +* A list of all the matches found. Optionally, if -filename is set to 1, +* then the output is a list of two element lists, with the symbol first, +* and the file in which it is found second. +*/ static int -gdb_search (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_search (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symbol_search *ss = NULL; struct symbol_search *p; @@ -1278,9 +1221,9 @@ gdb_search (clientData, interp, objc, objv) Tcl_Obj **file_list; char **files; static char *search_options[] = - {"functions", "variables", "types", (char *) NULL}; + {"functions", "variables", "types", (char *) NULL}; static char *switches[] = - {"-files", "-filename", "-static", (char *) NULL}; + {"-files", "-filename", "-static", (char *) NULL}; enum search_opts { SEARCH_FUNCTIONS, SEARCH_VARIABLES, SEARCH_TYPES @@ -1423,10 +1366,10 @@ gdb_search (clientData, interp, objc, objv) if (p->msymbol == NULL) Tcl_ListObjAppendElement (interp, elem, - Tcl_NewStringObj (SYMBOL_SOURCE_NAME (p->symbol), -1)); + Tcl_NewStringObj (SYMBOL_SOURCE_NAME (p->symbol), -1)); else Tcl_ListObjAppendElement (interp, elem, - Tcl_NewStringObj (SYMBOL_SOURCE_NAME (p->msymbol), -1)); + Tcl_NewStringObj (SYMBOL_SOURCE_NAME (p->msymbol), -1)); if (show_files) { @@ -1454,15 +1397,15 @@ gdb_search (clientData, interp, objc, objv) /* This implements the tcl command gdb_listfuncs - * It lists all the functions defined in a given file - * - * Arguments: - * file - the file to look in - * Tcl Result: - * A list of two element lists, the first element is - * the symbol name, and the second is a boolean indicating - * whether the symbol is demangled (1 for yes). - */ +* It lists all the functions defined in a given file +* +* Arguments: +* file - the file to look in +* Tcl Result: +* A list of two element lists, the first element is +* the symbol name, and the second is a boolean indicating +* whether the symbol is demangled (1 for yes). +*/ static int gdb_listfuncs (clientData, interp, objc, objv) @@ -1488,7 +1431,7 @@ gdb_listfuncs (clientData, interp, objc, objv) if (!symtab) { gdbtk_set_result (interp, "No such file (%s)", - Tcl_GetStringFromObj (objv[1], NULL)); + Tcl_GetStringFromObj (objv[1], NULL)); return TCL_ERROR; } @@ -1554,14 +1497,11 @@ gdb_listfuncs (clientData, interp, objc, objv) fputs hook out of the way to specially trap output, and if we get an error which we weren't expecting, it won't get put back, so we run this at idle time as insurance. - */ +*/ static int -gdb_restore_fputs (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_restore_fputs (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { gdbtk_disable_fputs = 0; return TCL_OK; @@ -1586,11 +1526,8 @@ gdb_restore_fputs (clientData, interp, objc, objv) */ static int -gdb_disassemble (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_disassemble (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { CORE_ADDR low, high; char *arg_ptr; @@ -1621,7 +1558,7 @@ gdb_disassemble (clientData, interp, objc, objv) high = string_to_core_addr (Tcl_GetStringFromObj (objv[3], NULL)); return gdb_disassemble_driver (low, high, mixed_source_and_assembly, NULL, - gdbtk_print_source, gdbtk_print_asm); + gdbtk_print_source, gdbtk_print_asm); } @@ -1686,11 +1623,11 @@ gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp, /* As we populate the text widget, we will also create an array in the caller's scope. The name is given by objv[3]. Each source line gets an entry or the form: - array($prefix,srcline=$src_line_no) = $widget_line_no + array($prefix,srcline=$src_line_no) = $widget_line_no Each assembly line gets two entries of the form: - array($prefix,pc=$pc) = $widget_line_no - array($prefix,line=$widget_line_no) = $src_line_no + array($prefix,pc=$pc) = $widget_line_no + array($prefix,line=$widget_line_no) = $src_line_no Where prefix is objv[4]. */ @@ -1703,10 +1640,11 @@ gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp, int prefix_len; client_data.map_arr = "map_array"; - if (Tcl_UpVar (interp, "1", map_name, client_data.map_arr, 0) != TCL_OK) { - gdbtk_set_result (interp, "Can't link map array."); - return TCL_ERROR; - } + if (Tcl_UpVar (interp, "1", map_name, client_data.map_arr, 0) != TCL_OK) + { + gdbtk_set_result (interp, "Can't link map array."); + return TCL_ERROR; + } prefix = Tcl_GetStringFromObj (objv[4], &prefix_len); @@ -1714,7 +1652,7 @@ gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp, Tcl_DStringAppend (&client_data.src_to_line_prefix, prefix, prefix_len); Tcl_DStringAppend (&client_data.src_to_line_prefix, ",srcline=", - sizeof (",srcline=") - 1); + sizeof (",srcline=") - 1); Tcl_DStringInit(&client_data.pc_to_line_prefix); Tcl_DStringAppend (&client_data.pc_to_line_prefix, @@ -1788,14 +1726,14 @@ gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp, } ret_val = gdb_disassemble_driver (low, high, mixed_source_and_assembly, - (ClientData) &client_data, - gdbtk_load_source, gdbtk_load_asm); + (ClientData) &client_data, + gdbtk_load_source, gdbtk_load_asm); /* Now clean up the opened file, and the Tcl data structures */ - if (client_data.file_opened_p == 1) { + if (client_data.file_opened_p == 1) fclose(client_data.fp); - } + if (*client_data.map_arr != '\0') { Tcl_DStringFree(&client_data.src_to_line_prefix); @@ -1811,29 +1749,28 @@ gdb_load_disassembly (ClientData clientData, Tcl_Interp *interp, /* Finally, if we were successful, stick the low & high addresses into the Tcl result. */ - if (ret_val == TCL_OK) { - char *buffer; - Tcl_Obj *limits_obj[2]; - - xasprintf (&buffer, "0x%s", paddr_nz (low)); - limits_obj[0] = Tcl_NewStringObj (buffer, -1); - free(buffer); - - xasprintf (&buffer, "0x%s", paddr_nz (high)); - limits_obj[1] = Tcl_NewStringObj (buffer, -1); - free(buffer); - - Tcl_DecrRefCount (result_ptr->obj_ptr); - result_ptr->obj_ptr = Tcl_NewListObj (2, limits_obj); - - } + if (ret_val == TCL_OK) + { + char *buffer; + Tcl_Obj *limits_obj[2]; + + xasprintf (&buffer, "0x%s", paddr_nz (low)); + limits_obj[0] = Tcl_NewStringObj (buffer, -1); + free(buffer); + + xasprintf (&buffer, "0x%s", paddr_nz (high)); + limits_obj[1] = Tcl_NewStringObj (buffer, -1); + free(buffer); + + Tcl_DecrRefCount (result_ptr->obj_ptr); + result_ptr->obj_ptr = Tcl_NewListObj (2, limits_obj); + } return ret_val; - } static void -gdbtk_load_source (ClientData clientData, struct symtab *symtab, int - start_line, int end_line) +gdbtk_load_source (ClientData clientData, struct symtab *symtab, + int start_line, int end_line) { struct disassembly_client_data *client_data = (struct disassembly_client_data *) clientData; @@ -1885,18 +1822,18 @@ gdbtk_load_source (ClientData clientData, struct symtab *symtab, int sprintf (line_number + 1, "%d", start_line); - if (found_carriage_return) { - char *p; - - p = strrchr(line, '\0') - 2; - if (*p == '\r') { - *p = '\n'; - *(p + 1) = '\0'; - } else { - found_carriage_return = 0; + if (found_carriage_return) + { + char *p = strrchr(line, '\0') - 2; + if (*p == '\r') + { + *p = '\n'; + *(p + 1) = '\0'; + } + else + found_carriage_return = 0; } - } - + /* Run the command, then add an entry to the map array in the caller's scope, if requested. */ @@ -1912,12 +1849,12 @@ gdbtk_load_source (ClientData clientData, struct symtab *symtab, int /* FIXME: Convert to Tcl_SetVar2Ex when we move to 8.2. This will allow us avoid converting widget_line_no into a string. */ - xasprintf (&buffer, "%d", client_data->widget_line_no); + xasprintf (&buffer, "%d", client_data->widget_line_no); Tcl_SetVar2 (client_data->interp, client_data->map_arr, Tcl_DStringValue (&client_data->src_to_line_prefix), buffer, 0); - free(buffer); + free(buffer); Tcl_DStringSetLength (&client_data->src_to_line_prefix, index_len); } @@ -1956,20 +1893,17 @@ gdbtk_load_source (ClientData clientData, struct symtab *symtab, int gdbtk_load_source (clientData, symtab, start_line, end_line); } } - else { - /* If we couldn't open the file, or got some prior error, just exit. */ - - return; - } - + else + { + /* If we couldn't open the file, or got some prior error, just exit. */ + return; + } } static CORE_ADDR -gdbtk_load_asm (clientData, pc, di) - ClientData clientData; - CORE_ADDR pc; - struct disassemble_info *di; +gdbtk_load_asm (ClientData clientData, CORE_ADDR pc, + struct disassemble_info *di) { struct disassembly_client_data * client_data = (struct disassembly_client_data *) clientData; @@ -2015,7 +1949,7 @@ gdbtk_load_asm (clientData, pc, di) text_argv[11] = Tcl_GetStringFromObj (client_data->result_obj[2], NULL); client_data->cmd.proc (client_data->cmd.clientData, - client_data->interp, 14, text_argv); + client_data->interp, 14, text_argv); if (*client_data->map_arr != '\0') { @@ -2055,21 +1989,16 @@ gdbtk_load_asm (clientData, pc, di) } static void -gdbtk_print_source (clientData, symtab, start_line, end_line) - ClientData clientData; - struct symtab *symtab; - int start_line; - int end_line; +gdbtk_print_source (ClientData clientData, struct symtab *symtab, + int start_line, int end_line) { print_source_lines (symtab, start_line, end_line, 0); gdb_flush (gdb_stdout); } static CORE_ADDR -gdbtk_print_asm (clientData, pc, di) - ClientData clientData; - CORE_ADDR pc; - struct disassemble_info *di; +gdbtk_print_asm (ClientData clientData, CORE_ADDR pc, + struct disassemble_info *di) { fputs_unfiltered (" ", gdb_stdout); print_address (pc, gdb_stdout); @@ -2081,15 +2010,11 @@ gdbtk_print_asm (clientData, pc, di) } static int -gdb_disassemble_driver (low, high, mixed_source_and_assembly, - clientData, print_source_fn, print_asm_fn) - CORE_ADDR low; - CORE_ADDR high; - int mixed_source_and_assembly; - ClientData clientData; - void (*print_source_fn) (ClientData, struct symtab *, int, int); - CORE_ADDR (*print_asm_fn) (ClientData, CORE_ADDR, - struct disassemble_info *); +gdb_disassemble_driver (CORE_ADDR low, CORE_ADDR high, + int mixed_source_and_assembly, + ClientData clientData, + void (*print_source_fn) (ClientData, struct symtab *, int, int), + CORE_ADDR (*print_asm_fn) (ClientData, CORE_ADDR, struct disassemble_info *)) { CORE_ADDR pc; static disassemble_info di; @@ -2131,7 +2056,7 @@ gdb_disassemble_driver (low, high, mixed_source_and_assembly, determine where to disassemble from. There should be a target vector entry for this or something. - */ + */ if (disassemble_from_exec == -1) { @@ -2292,11 +2217,8 @@ gdb_disassemble_driver (low, high, mixed_source_and_assembly, disassembling from the exec file. */ static int -gdbtk_dis_asm_read_memory (memaddr, myaddr, len, info) - bfd_vma memaddr; - bfd_byte *myaddr; - unsigned int len; - disassemble_info *info; +gdbtk_dis_asm_read_memory (bfd_vma memaddr, bfd_byte *myaddr, + unsigned int len, disassemble_info *info) { extern struct target_ops exec_ops; int res; @@ -2315,9 +2237,7 @@ gdbtk_dis_asm_read_memory (memaddr, myaddr, len, info) /* This will be passed to qsort to sort the results of the disassembly */ static int -compare_lines (mle1p, mle2p) - const PTR mle1p; - const PTR mle2p; +compare_lines (const PTR mle1p, const PTR mle2p) { struct my_line_entry *mle1, *mle2; int val; @@ -2335,12 +2255,12 @@ compare_lines (mle1p, mle2p) /* This implements the TCL command `gdb_loc', - * Arguments: - * ?symbol? The symbol or address to locate - defaults to pc - * Tcl Return: - * a list consisting of the following: - * basename, function name, filename, line number, address, current pc - */ +* Arguments: +* ?symbol? The symbol or address to locate - defaults to pc +* Tcl Return: +* a list consisting of the following: +* basename, function name, filename, line number, address, current pc +*/ static int gdb_loc (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) @@ -2439,11 +2359,8 @@ gdb_loc (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST obj entry point address. */ static int -gdb_entry_point (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_entry_point (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *addrstr; @@ -2519,11 +2436,8 @@ hex2bin (const char *hex, char *bin, int count) * len: number of bytes of data to set */ static int -gdb_set_mem (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_set_mem (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { CORE_ADDR addr; char buf[128]; @@ -2813,9 +2727,9 @@ gdb_loadfile (ClientData clientData, Tcl_Interp *interp, int objc, } if (symtab && symtab->objfile && symtab->objfile->obfd) - mtime = bfd_get_mtime(symtab->objfile->obfd); + mtime = bfd_get_mtime(symtab->objfile->obfd); else if (exec_bfd) - mtime = bfd_get_mtime(exec_bfd); + mtime = bfd_get_mtime(exec_bfd); if (mtime && mtime < st.st_mtime) { @@ -2892,15 +2806,14 @@ gdb_loadfile (ClientData clientData, Tcl_Interp *interp, int objc, if (found_carriage_return) { - char *p; - - p = strrchr(line, '\0') - 2; - if (*p == '\r') { - *p = '\n'; - *(p + 1) = '\0'; - } else { + char *p = strrchr(line, '\0') - 2; + if (*p == '\r') + { + *p = '\n'; + *(p + 1) = '\0'; + } + else found_carriage_return = 0; - } } sprintf (line_num_buf+2, "%d", ln); @@ -2925,17 +2838,17 @@ gdb_loadfile (ClientData clientData, Tcl_Interp *interp, int objc, while (fgets (line + 1, 9980, fp)) { - if (found_carriage_return) { - char *p; - - p = strrchr(line, '\0') - 2; - if (*p == '\r') { - *p = '\n'; - *(p + 1) = '\0'; - } else { - found_carriage_return = 0; + if (found_carriage_return) + { + char *p = strrchr(line, '\0') - 2; + if (*p == '\r') + { + *p = '\n'; + *(p + 1) = '\0'; + } + else + found_carriage_return = 0; } - } if (ltable[ln >> 3] & (1 << (ln % 8))) { @@ -2964,21 +2877,18 @@ gdb_loadfile (ClientData clientData, Tcl_Interp *interp, int objc, /* This implements the tcl command gdb_path_conv - * On Windows, it canonicalizes the pathname, - * On Unix, it is a no op. - * - * Arguments: - * path - * Tcl Result: - * The canonicalized path. - */ +* On Windows, it canonicalizes the pathname, +* On Unix, it is a no op. +* +* Arguments: +* path +* Tcl Result: +* The canonicalized path. +*/ static int -gdb_path_conv (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_path_conv (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { if (objc != 2) { @@ -3012,8 +2922,7 @@ gdb_path_conv (clientData, interp, objc, objv) */ static int -perror_with_name_wrapper (args) - PTR args; +perror_with_name_wrapper (PTR args) { perror_with_name (args); return 1; @@ -3025,8 +2934,7 @@ perror_with_name_wrapper (args) If no symbol is found, it returns an empty string. In either case, memory is owned by gdb. Do not attempt to free it. */ char * -pc_function_name (pc) - CORE_ADDR pc; +pc_function_name (CORE_ADDR pc) { struct symbol *sym; char *funcname = NULL; diff --git a/gdb/gdbtk/generic/gdbtk-hooks.c b/gdb/gdbtk/generic/gdbtk-hooks.c index 836641f3ed4..0379052a5cc 100644 --- a/gdb/gdbtk/generic/gdbtk-hooks.c +++ b/gdb/gdbtk/generic/gdbtk-hooks.c @@ -1,5 +1,5 @@ /* Startup code for Insight. - Copyright 1994, 1995, 1996, 1997, 1998, 2000, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 2000, 200, 2002 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -189,7 +189,7 @@ gdbtk_add_hooks (void) instead of to the result_ptr. * GDBTK_MAKES_LIST flag means add to the result as a list element. - */ +*/ gdbtk_result *result_ptr = NULL; @@ -307,15 +307,11 @@ gdbtk_fputs (const char *ptr, struct ui_file *stream) */ static void -gdbtk_warning (warning, args) - const char *warning; - va_list args; +gdbtk_warning (const char *warning, va_list args) { char *buf; - xvasprintf (&buf, warning, args); gdbtk_two_elem_cmd ("gdbtk_tcl_warning", buf); - free(buf); } @@ -342,9 +338,7 @@ report_error () */ void -gdbtk_ignorable_warning (class, warning) - const char *class; - const char *warning; +gdbtk_ignorable_warning (const char *class, const char *warning) { char *buf; xasprintf (&buf, "gdbtk_tcl_ignorable_warning {%s} {%s}", class, warning); @@ -354,17 +348,14 @@ gdbtk_ignorable_warning (class, warning) } static void -gdbtk_register_changed (regno) - int regno; +gdbtk_register_changed (int regno) { if (Tcl_Eval (gdbtk_interp, "gdbtk_register_changed") != TCL_OK) report_error (); } static void -gdbtk_memory_changed (addr, len) - CORE_ADDR addr; - int len; +gdbtk_memory_changed (CORE_ADDR addr, int len) { if (Tcl_Eval (gdbtk_interp, "gdbtk_memory_changed") != TCL_OK) report_error (); @@ -432,8 +423,7 @@ tk_command_loop () * For native windows (and a few other targets, like the v850 ICE), * we rely on the target_wait loops to call ui_loop_hook to keep us alive. */ int -x_event (signo) - int signo; +x_event (int signo) { static volatile int in_x_event = 0; static Tcl_Obj *varname = NULL; @@ -499,8 +489,7 @@ gdbtk_readline_begin (char *format,...) } static char * -gdbtk_readline (prompt) - char *prompt; +gdbtk_readline (char *prompt) { int result; @@ -530,10 +519,8 @@ gdbtk_readline_end () } static void -gdbtk_call_command (cmdblk, arg, from_tty) - struct cmd_list_element *cmdblk; - char *arg; - int from_tty; +gdbtk_call_command (struct cmd_list_element *cmdblk, + char *arg, int from_tty) { running_now = 0; if (cmdblk->class == class_run || cmdblk->class == class_trace) @@ -624,7 +611,7 @@ gdbtk_set_hook (struct cmd_list_element *cmdblk) if (buffer != NULL) { - free(buffer); + free(buffer); } } @@ -644,8 +631,7 @@ gdbtk_load_hash (const char *section, unsigned long num) /* This hook is called whenever we are ready to load a symbol file so that the UI can notify the user... */ static void -gdbtk_pre_add_symbol (name) - char *name; +gdbtk_pre_add_symbol (char *name) { gdbtk_two_elem_cmd ("gdbtk_tcl_pre_add_symbol", name); } @@ -662,9 +648,7 @@ gdbtk_post_add_symbol () target. */ static ptid_t -gdbtk_wait (ptid, ourstatus) - ptid_t ptid; - struct target_waitstatus *ourstatus; +gdbtk_wait (ptid_t ptid, struct target_waitstatus *ourstatus) { gdbtk_force_detach = 0; gdbtk_start_timer (); @@ -684,9 +668,7 @@ gdbtk_wait (ptid, ourstatus) */ static int -gdbtk_query (query, args) - const char *query; - va_list args; +gdbtk_query (const char *query, va_list args) { char *buf; long val; @@ -701,11 +683,8 @@ gdbtk_query (query, args) static void -gdbtk_print_frame_info (s, line, stopline, noerror) - struct symtab *s; - int line; - int stopline; - int noerror; +gdbtk_print_frame_info (struct symtab *s, int line, + int stopline, int noerror) { current_source_symtab = s; current_source_line = line; @@ -722,15 +701,13 @@ gdbtk_print_frame_info (s, line, stopline, noerror) */ static void -gdbtk_trace_find (arg, from_tty) - char *arg; - int from_tty; +gdbtk_trace_find (char *arg, int from_tty) { Tcl_Obj *cmdObj; cmdObj = Tcl_NewListObj (0, NULL); Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, - Tcl_NewStringObj ("gdbtk_tcl_trace_find_hook", -1)); + Tcl_NewStringObj ("gdbtk_tcl_trace_find_hook", -1)); Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewStringObj (arg, -1)); Tcl_ListObjAppendElement (gdbtk_interp, cmdObj, Tcl_NewIntObj (from_tty)); #if TCL_MAJOR_VERSION == 8 && (TCL_MINOR_VERSION < 1 || TCL_MINOR_VERSION > 2) @@ -752,9 +729,7 @@ gdbtk_trace_find (arg, from_tty) */ static void -gdbtk_trace_start_stop (start, from_tty) - int start; - int from_tty; +gdbtk_trace_start_stop (int start, int from_tty) { if (start) @@ -765,8 +740,7 @@ gdbtk_trace_start_stop (start, from_tty) } static void -gdbtk_selected_frame_changed (level) - int level; +gdbtk_selected_frame_changed (int level) { Tcl_UpdateLinkedVar (gdbtk_interp, "gdb_selected_frame_level"); } @@ -774,24 +748,21 @@ gdbtk_selected_frame_changed (level) /* Called when the current thread changes. */ /* gdb_context is linked to the tcl variable "gdb_context_id" */ static void -gdbtk_context_change (num) - int num; +gdbtk_context_change (int num) { gdb_context = num; } /* Called from file_command */ static void -gdbtk_file_changed (filename) - char *filename; +gdbtk_file_changed (char *filename) { gdbtk_two_elem_cmd ("gdbtk_tcl_file_changed", filename); } /* Called from exec_file_command */ static void -gdbtk_exec_file_display (filename) - char *filename; +gdbtk_exec_file_display (char *filename) { gdbtk_two_elem_cmd ("gdbtk_tcl_exec_file_display", filename); } @@ -818,7 +789,7 @@ gdbtk_annotate_signal () Tcl_Eval (gdbtk_interp, "gdbtk_stop_idle_callback"); xasprintf (&buf, "gdbtk_signal %s {%s}", target_signal_to_name (stop_signal), - target_signal_to_string (stop_signal)); + target_signal_to_string (stop_signal)); if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK) report_error (); free(buf); diff --git a/gdb/gdbtk/generic/gdbtk-register.c b/gdb/gdbtk/generic/gdbtk-register.c index 2e5e3696d9c..4236cc8bb22 100644 --- a/gdb/gdbtk/generic/gdbtk-register.c +++ b/gdb/gdbtk/generic/gdbtk-register.c @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight - Registers - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -107,7 +107,7 @@ static int gdb_register_info (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { - int regnum, index, result; + int index; void *argp; void (*func)(int, void *); static char *commands[] = {"changed", "name", "size", "value", NULL}; @@ -188,14 +188,10 @@ get_register_size (int regnum, void *arg) * The value of the pc register. */ static int -get_pc_register (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +get_pc_register (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *buff; - xasprintf (&buff, "0x%s", paddr_nz (read_register (PC_REGNUM))); Tcl_SetStringObj (result_ptr->obj_ptr, buff, -1); free(buff); @@ -203,9 +199,7 @@ get_pc_register (clientData, interp, objc, objv) } static void -get_register (regnum, fp) - int regnum; - void *fp; +get_register (int regnum, void *fp) { struct type *reg_vtype; char raw_buffer[MAX_REGISTER_RAW_SIZE]; @@ -250,7 +244,7 @@ get_register (regnum, fp) for (j = 0; j < REGISTER_RAW_SIZE (regnum); j++) { register int idx = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? j - : REGISTER_RAW_SIZE (regnum) - 1 - j; + : REGISTER_RAW_SIZE (regnum) - 1 - j; sprintf (ptr, "%02x", (unsigned char) raw_buffer[idx]); ptr += 2; } @@ -270,9 +264,7 @@ get_register (regnum, fp) } static void -get_register_name (regnum, argp) - int regnum; - void *argp; +get_register_name (int regnum, void *argp) { /* Non-zero if the caller wants the register numbers, too. */ int numbers = (int) argp; @@ -298,11 +290,9 @@ get_register_name (regnum, argp) /* This is a sort of mapcar function for operations on registers */ static int -map_arg_registers (objc, objv, func, argp) - int objc; - Tcl_Obj *CONST objv[]; - void (*func) (int regnum, void *argp); - void *argp; +map_arg_registers (int objc, Tcl_Obj *CONST objv[], + void (*func) (int regnum, void *argp), + void *argp) { int regnum, numregs; @@ -358,9 +348,7 @@ map_arg_registers (objc, objv, func, argp) } static void -register_changed_p (regnum, argp) - int regnum; - void *argp; /* Ignored */ +register_changed_p (int regnum, void *argp) { char raw_buffer[MAX_REGISTER_RAW_SIZE]; diff --git a/gdb/gdbtk/generic/gdbtk-stack.c b/gdb/gdbtk/generic/gdbtk-stack.c index a74e0463993..d9a077310f2 100644 --- a/gdb/gdbtk/generic/gdbtk-stack.c +++ b/gdb/gdbtk/generic/gdbtk-stack.c @@ -1,5 +1,5 @@ /* Tcl/Tk command definitions for Insight - Stack. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -87,11 +87,8 @@ Gdbtk_Stack_Init (Tcl_Interp *interp) * All variables defined in the given block. */ static int -gdb_block_vars (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_block_vars (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct block *block; int i; @@ -163,11 +160,8 @@ gdb_block_vars (clientData, interp, objc, objv) * A list of all valid blocks in the selected_frame. */ static int -gdb_get_blocks (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_blocks (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct block *block; int i, junk; @@ -251,47 +245,38 @@ gdb_get_blocks (clientData, interp, objc, objv) * of the command, because the call wrapper uses this instead... */ static int -gdb_get_args_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_args_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { return gdb_get_vars_command ((ClientData) 1, interp, objc, objv); } static int -gdb_get_locals_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_locals_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { return gdb_get_vars_command ((ClientData) 0, interp, objc, objv); } /* This implements the tcl commands "gdb_get_locals" and "gdb_get_args" - * This function sets the Tcl interpreter's result to a list of variable names - * depending on clientData. If clientData is one, the result is a list of - * arguments; zero returns a list of locals -- all relative to the block - * specified as an argument to the command. Valid commands include - * anything decode_line_1 can handle (like "main.c:2", "*0x02020202", - * and "main"). - * - * Tcl Arguments: - * linespec - the linespec defining the scope of the lookup. Empty string - * to use the current block in the innermost frame. - * Tcl Result: - * A list of the locals or args - */ +* This function sets the Tcl interpreter's result to a list of variable names +* depending on clientData. If clientData is one, the result is a list of +* arguments; zero returns a list of locals -- all relative to the block +* specified as an argument to the command. Valid commands include +* anything decode_line_1 can handle (like "main.c:2", "*0x02020202", +* and "main"). +* +* Tcl Arguments: +* linespec - the linespec defining the scope of the lookup. Empty string +* to use the current block in the innermost frame. +* Tcl Result: +* A list of the locals or args +*/ static int -gdb_get_vars_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_get_vars_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { struct symtabs_and_lines sals; struct symbol *sym; @@ -361,7 +346,7 @@ gdb_get_vars_command (clientData, interp, objc, objv) case LOC_BASEREG_ARG: /* basereg arg */ if (arguments) Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewStringObj (SYMBOL_NAME (sym), -1)); + Tcl_NewStringObj (SYMBOL_NAME (sym), -1)); break; case LOC_LOCAL: /* stack local */ case LOC_BASEREG: /* basereg local */ @@ -369,7 +354,7 @@ gdb_get_vars_command (clientData, interp, objc, objv) case LOC_REGISTER: /* register */ if (!arguments) Tcl_ListObjAppendElement (interp, result_ptr->obj_ptr, - Tcl_NewStringObj (SYMBOL_NAME (sym), -1)); + Tcl_NewStringObj (SYMBOL_NAME (sym), -1)); break; } } @@ -393,11 +378,8 @@ gdb_get_vars_command (clientData, interp, objc, objv) * The currently selected block's start and end addresses */ static int -gdb_selected_block (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_selected_block (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *start = NULL; char *end = NULL; @@ -428,20 +410,17 @@ gdb_selected_block (clientData, interp, objc, objv) /* This implements the tcl command gdb_selected_frame - * Returns the address of the selected frame - * frame. - * - * Arguments: - * None - * Tcl Result: - * The currently selected frame's address - */ +* Returns the address of the selected frame +* frame. +* +* Arguments: +* None +* Tcl Result: +* The currently selected frame's address +*/ static int -gdb_selected_frame (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_selected_frame (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { char *frame; @@ -466,11 +445,8 @@ gdb_selected_frame (clientData, interp, objc, objv) * A list of function names */ static int -gdb_stack (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_stack (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { int start, count; diff --git a/gdb/gdbtk/generic/gdbtk-varobj.c b/gdb/gdbtk/generic/gdbtk-varobj.c index 8c40d8f43d3..8241bb9f3c1 100644 --- a/gdb/gdbtk/generic/gdbtk-varobj.c +++ b/gdb/gdbtk/generic/gdbtk-varobj.c @@ -71,7 +71,7 @@ static void uninstall_variable (Tcl_Interp *, char *); /* String representations of gdb's format codes */ char *format_string[] = -{"natural", "binary", "decimal", "hexadecimal", "octal"}; + {"natural", "binary", "decimal", "hexadecimal", "octal"}; #if defined(FREEIF) #undef FREEIF @@ -81,8 +81,7 @@ char *format_string[] = /* Initialize the variable code. This function should be called once to install and initialize the variable code into the interpreter. */ int -gdb_variable_init (interp) - Tcl_Interp *interp; +gdb_variable_init (Tcl_Interp *interp) { Tcl_Command result; static int initialized = 0; @@ -90,7 +89,7 @@ gdb_variable_init (interp) if (!initialized) { result = Tcl_CreateObjCommand (interp, "gdb_variable", gdbtk_call_wrapper, - (ClientData) gdb_variable_command, NULL); + (ClientData) gdb_variable_command, NULL); if (result == NULL) return TCL_ERROR; @@ -114,16 +113,13 @@ gdb_variable_init (interp) EXPR = the gdb expression for which to create a variable. This will be the most common usage. FRAME = the frame defining the scope of the variable. - */ +*/ static int -gdb_variable_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +gdb_variable_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { static char *commands[] = - {"create", "list", NULL}; + {"create", "list", NULL}; enum commands_enum { VARIABLE_CREATE, VARIABLE_LIST @@ -168,13 +164,10 @@ gdb_variable_command (clientData, interp, objc, objv) - type get the type of this variable - value get/set the value of this variable - editable is this variable editable? - */ +*/ static int -variable_obj_command (clientData, interp, objc, objv) - ClientData clientData; - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +variable_obj_command (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) { enum commands_enum { @@ -189,18 +182,18 @@ variable_obj_command (clientData, interp, objc, objv) VARIABLE_UPDATE }; static char *commands[] = - { - "delete", - "numChildren", - "children", - "format", - "type", - "value", - "name", - "editable", - "update", - NULL - }; + { + "delete", + "numChildren", + "children", + "format", + "type", + "value", + "name", + "editable", + "update", + NULL + }; struct varobj *var; char *varobj_name; int index, result; @@ -272,7 +265,7 @@ variable_obj_command (clientData, interp, objc, objv) case VARIABLE_EDITABLE: Tcl_SetObjResult (interp, Tcl_NewIntObj ( - varobj_get_attributes (var) & 0x00000001 /* Editable? */ )); + varobj_get_attributes (var) & 0x00000001 /* Editable? */ )); break; case VARIABLE_UPDATE: @@ -297,17 +290,14 @@ variable_obj_command (clientData, interp, objc, objv) /* This function is responsible for processing the user's specifications and constructing a variable object. */ static int -variable_create (interp, objc, objv) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; +variable_create (Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { enum create_opts { CREATE_EXPR, CREATE_FRAME }; static char *create_options[] = - {"-expr", "-frame", NULL}; + {"-expr", "-frame", NULL}; struct varobj *var; char *name; char *obj_name; @@ -323,7 +313,7 @@ variable_create (interp, objc, objv) EXPR = the gdb expression for which to create a variable. This will be the most common usage. FRAME = the address of the frame defining the variable's scope - */ + */ name = NULL; if (objc) name = Tcl_GetStringFromObj (objv[0], NULL); @@ -401,10 +391,8 @@ variable_create (interp, objc, objv) /* Delete the variable object VAR and its children */ /* If only_children_p, Delete only the children associated with the object. */ static void -variable_delete (interp, var, only_children_p) - Tcl_Interp *interp; - struct varobj *var; - int only_children_p; +variable_delete (Tcl_Interp *interp, struct varobj *var, + int only_children_p) { char **dellist; char **vc; @@ -424,9 +412,7 @@ variable_delete (interp, var, only_children_p) /* Return a list of all the children of VAR, creating them if necessary. */ static Tcl_Obj * -variable_children (interp, var) - Tcl_Interp *interp; - struct varobj *var; +variable_children (Tcl_Interp *interp, struct varobj *var) { Tcl_Obj *list; struct varobj **childlist; @@ -456,9 +442,7 @@ variable_children (interp, var) /* NOTE: Only root variables can be updated... */ static Tcl_Obj * -variable_update (interp, var) - Tcl_Interp *interp; - struct varobj **var; +variable_update (Tcl_Interp *interp, struct varobj **var) { Tcl_Obj *changed; struct varobj **changelist; @@ -476,7 +460,7 @@ variable_update (interp, var) { /* Add changed variable object to result list */ Tcl_ListObjAppendElement (NULL, changed, - Tcl_NewStringObj (varobj_get_objname (*vc), -1)); + Tcl_NewStringObj (varobj_get_objname (*vc), -1)); vc++; } @@ -487,11 +471,8 @@ variable_update (interp, var) /* This implements the format object command allowing the querying or setting of the object's display format. */ static int -variable_format (interp, objc, objv, var) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - struct varobj *var; +variable_format (Tcl_Interp *interp, int objc, + Tcl_Obj *CONST objv[], struct varobj *var) { if (objc > 2) { @@ -511,8 +492,8 @@ variable_format (interp, objc, objv, var) else { gdbtk_set_result (interp, "unknown display format \"", - fmt, "\": must be: \"natural\", \"binary\"" - ", \"decimal\", \"hexadecimal\", or \"octal\""); + fmt, "\": must be: \"natural\", \"binary\"" + ", \"decimal\", \"hexadecimal\", or \"octal\""); return TCL_ERROR; } } @@ -523,7 +504,7 @@ variable_format (interp, objc, objv, var) /* FIXME: Use varobj_format_string[] instead */ fmt = Tcl_NewStringObj ( - format_string[(int) varobj_get_display_format (var)], -1); + format_string[(int) varobj_get_display_format (var)], -1); Tcl_SetObjResult (interp, fmt); } @@ -533,11 +514,8 @@ variable_format (interp, objc, objv, var) /* This function implements the type object command, which returns the type of a variable in the interpreter (or an error). */ static int -variable_type (interp, objc, objv, var) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - struct varobj *var; +variable_type (Tcl_Interp *interp, int objc, + Tcl_Obj *CONST objv[], struct varobj *var) { char *first, *last, *string; Tcl_RegExp regexp; @@ -574,11 +552,8 @@ variable_type (interp, objc, objv, var) /* This function implements the value object command, which allows an object's value to be queried or set. */ static int -variable_value (interp, objc, objv, var) - Tcl_Interp *interp; - int objc; - Tcl_Obj *CONST objv[]; - struct varobj *var; +variable_value (Tcl_Interp *interp, int objc, + Tcl_Obj *CONST objv[], struct varobj *var) { char *r; @@ -628,9 +603,7 @@ variable_value (interp, objc, objv, var) /* Install the given variable VAR into the tcl interpreter with the object name NAME. */ static void -install_variable (interp, name) - Tcl_Interp *interp; - char *name; +install_variable (Tcl_Interp *interp, char *name) { Tcl_CreateObjCommand (interp, name, variable_obj_command, NULL, NULL); @@ -638,9 +611,7 @@ install_variable (interp, name) /* Unistall the object VAR in the tcl interpreter. */ static void -uninstall_variable (interp, varname) - Tcl_Interp *interp; - char *varname; +uninstall_variable (Tcl_Interp *interp, char *varname) { Tcl_DeleteCommand (interp, varname); } diff --git a/gdb/gdbtk/generic/gdbtk-wrapper.c b/gdb/gdbtk/generic/gdbtk-wrapper.c index 34b3c917503..8ef0db0af13 100644 --- a/gdb/gdbtk/generic/gdbtk-wrapper.c +++ b/gdb/gdbtk/generic/gdbtk-wrapper.c @@ -1,5 +1,5 @@ /* longjmp-free interface between gdb and gdbtk. - Copyright (C) 1999-2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -134,9 +134,7 @@ static int wrap_find_relative_frame (char *opaque_arg); static int wrap_get_current_frame (char *opaque_arg); static gdb_result -call_wrapped_function (fn, arg) - catch_errors_ftype *fn; - struct gdb_wrapper_arguments *arg; +call_wrapped_function (catch_errors_ftype *fn, struct gdb_wrapper_arguments *arg) { if (!catch_errors (fn, (char *) &arg, "", RETURN_MASK_ERROR)) { @@ -148,11 +146,8 @@ call_wrapped_function (fn, arg) } gdb_result -GDB_type_print (val, varstring, stream, show) - value_ptr val; - char *varstring; - struct ui_file *stream; - int show; +GDB_type_print (value_ptr val, char *varstring, + struct ui_file *stream, int show) { struct gdb_wrapper_arguments args; @@ -164,8 +159,7 @@ GDB_type_print (val, varstring, stream, show) } static int -wrap_type_print (a) - char *a; +wrap_type_print (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; value_ptr val = (value_ptr) (*args)->args[0]; @@ -177,16 +171,14 @@ wrap_type_print (a) } gdb_result -GDB_val_print (type, valaddr, address, stream, format, deref_ref, - recurse, pretty) - struct type *type; - char *valaddr; - CORE_ADDR address; - struct ui_file *stream; - int format; - int deref_ref; - int recurse; - enum val_prettyprint pretty; +GDB_val_print (struct type *type, + char *valaddr, + CORE_ADDR address, + struct ui_file *stream, + int format, + int deref_ref, + int recurse, + enum val_prettyprint pretty) { struct gdb_wrapper_arguments args; @@ -203,8 +195,7 @@ GDB_val_print (type, valaddr, address, stream, format, deref_ref, } static int -wrap_val_print (a) - char *a; +wrap_val_print (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; struct type *type; @@ -231,8 +222,7 @@ wrap_val_print (a) } gdb_result -GDB_value_fetch_lazy (value) - value_ptr value; +GDB_value_fetch_lazy (value_ptr value) { struct gdb_wrapper_arguments args; @@ -241,8 +231,7 @@ GDB_value_fetch_lazy (value) } static int -wrap_value_fetch_lazy (a) - char *a; +wrap_value_fetch_lazy (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; @@ -251,9 +240,7 @@ wrap_value_fetch_lazy (a) } gdb_result -GDB_evaluate_expression (exp, value) - struct expression *exp; - value_ptr *value; +GDB_evaluate_expression (struct expression *exp, value_ptr *value) { struct gdb_wrapper_arguments args; gdb_result result; @@ -268,8 +255,7 @@ GDB_evaluate_expression (exp, value) } static int -wrap_evaluate_expression (a) - char *a; +wrap_evaluate_expression (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; @@ -279,9 +265,7 @@ wrap_evaluate_expression (a) } gdb_result -GDB_select_frame (fi, level) - struct frame_info *fi; - int level; +GDB_select_frame (struct frame_info *fi, int level) { struct gdb_wrapper_arguments args; @@ -292,8 +276,7 @@ GDB_select_frame (fi, level) } static int -wrap_select_frame (a) - char *a; +wrap_select_frame (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; int level = *(int *) (*args)->args[1]; @@ -324,8 +307,7 @@ GDB_value_equal (val1, val2, result) } static int -wrap_value_equal (a) - char *a; +wrap_value_equal (char *a) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) a; value_ptr val1, val2; @@ -338,11 +320,8 @@ wrap_value_equal (a) } gdb_result -GDB_parse_exp_1 (stringptr, block, comma, result) - char **stringptr; - struct block *block; - int comma; - struct expression **result; +GDB_parse_exp_1 (char **stringptr, struct block *block, + int comma, struct expression **result) { struct gdb_wrapper_arguments args; gdb_result r; @@ -360,8 +339,7 @@ GDB_parse_exp_1 (stringptr, block, comma, result) } static int -wrap_parse_exp_1 (opaque_arg) - char *opaque_arg; +wrap_parse_exp_1 (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct block *block; @@ -377,9 +355,7 @@ wrap_parse_exp_1 (opaque_arg) } gdb_result -GDB_evaluate_type (exp, result) - struct expression *exp; - value_ptr *result; +GDB_evaluate_type (struct expression *exp, value_ptr *result) { struct gdb_wrapper_arguments args; gdb_result r; @@ -395,8 +371,7 @@ GDB_evaluate_type (exp, result) } static int -wrap_evaluate_type (opaque_arg) - char *opaque_arg; +wrap_evaluate_type (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct expression *exp; @@ -407,9 +382,7 @@ wrap_evaluate_type (opaque_arg) } gdb_result -GDB_block_for_pc (pc, result) - CORE_ADDR pc; - struct block **result; +GDB_block_for_pc (CORE_ADDR pc, struct block **result) { struct gdb_wrapper_arguments args; gdb_result r; @@ -425,8 +398,7 @@ GDB_block_for_pc (pc, result) } static int -wrap_block_for_pc (opaque_arg) - char *opaque_arg; +wrap_block_for_pc (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; CORE_ADDR pc; @@ -437,9 +409,7 @@ wrap_block_for_pc (opaque_arg) } gdb_result -GDB_block_innermost_frame (block, result) - struct block *block; - struct frame_info **result; +GDB_block_innermost_frame (struct block *block, struct frame_info **result) { struct gdb_wrapper_arguments args; gdb_result r; @@ -455,8 +425,7 @@ GDB_block_innermost_frame (block, result) } static int -wrap_block_innermost_frame (opaque_arg) - char *opaque_arg; +wrap_block_innermost_frame (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct block *block; @@ -479,17 +448,15 @@ GDB_reinit_frame_cache () } static int -wrap_reinit_frame_cache (opaque_arg) - char *opaque_arg; +wrap_reinit_frame_cache (char *opaque_arg) { reinit_frame_cache (); return 1; } gdb_result -GDB_find_frame_addr_in_frame_chain (addr, result) - CORE_ADDR addr; - struct frame_info **result; +GDB_find_frame_addr_in_frame_chain (CORE_ADDR addr, + struct frame_info **result) { struct gdb_wrapper_arguments args; gdb_result r; @@ -505,8 +472,7 @@ GDB_find_frame_addr_in_frame_chain (addr, result) } static int -wrap_find_frame_addr_in_frame_chain (opaque_arg) - char *opaque_arg; +wrap_find_frame_addr_in_frame_chain (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; CORE_ADDR addr; @@ -517,9 +483,7 @@ wrap_find_frame_addr_in_frame_chain (opaque_arg) } gdb_result -GDB_value_ind (val, rval) - value_ptr val; - value_ptr *rval; +GDB_value_ind (value_ptr val, value_ptr *rval) { struct gdb_wrapper_arguments args; gdb_result r; @@ -535,8 +499,7 @@ GDB_value_ind (val, rval) } static int -wrap_value_ind (opaque_arg) - char *opaque_arg; +wrap_value_ind (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; @@ -547,11 +510,7 @@ wrap_value_ind (opaque_arg) } gdb_result -GDB_value_slice (val, low, num, rval) - value_ptr val; - int low; - int num; - value_ptr *rval; +GDB_value_slice (value_ptr val, int low, int num, value_ptr *rval) { struct gdb_wrapper_arguments args; gdb_result r; @@ -569,8 +528,7 @@ GDB_value_slice (val, low, num, rval) } static int -wrap_value_slice (opaque_arg) - char *opaque_arg; +wrap_value_slice (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; @@ -603,8 +561,7 @@ GDB_value_coerce_array (val, rval) } static int -wrap_value_coerce_array (opaque_arg) - char *opaque_arg; +wrap_value_coerce_array (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; @@ -615,13 +572,12 @@ wrap_value_coerce_array (opaque_arg) } gdb_result -GDB_value_struct_elt (argp, args, name, static_memfunc, err, rval) - value_ptr *argp; - value_ptr *args; - char *name; - int *static_memfunc; - char *err; - value_ptr *rval; +GDB_value_struct_elt (value_ptr *argp, + value_ptr *args, + char *name, + int *static_memfunc, + char *err, + value_ptr *rval) { struct gdb_wrapper_arguments argss; gdb_result r; @@ -640,8 +596,7 @@ GDB_value_struct_elt (argp, args, name, static_memfunc, err, rval) } static int -wrap_value_struct_elt (opaque_arg) - char *opaque_arg; +wrap_value_struct_elt (char *opaque_arg) { struct gdb_wrapper_arguments **argss = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr *argp, *args; @@ -660,10 +615,7 @@ wrap_value_struct_elt (opaque_arg) } gdb_result -GDB_value_cast (type, val, rval) - struct type *type; - value_ptr val; - value_ptr *rval; +GDB_value_cast (struct type *type, value_ptr val, value_ptr *rval) { struct gdb_wrapper_arguments args; gdb_result r; @@ -680,8 +632,7 @@ GDB_value_cast (type, val, rval) } static int -wrap_value_cast (opaque_arg) - char *opaque_arg; +wrap_value_cast (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; value_ptr val; @@ -695,9 +646,7 @@ wrap_value_cast (opaque_arg) } gdb_result -GDB_get_frame_block (fi, rval) - struct frame_info *fi; - struct block **rval; +GDB_get_frame_block (struct frame_info *fi, struct block **rval) { struct gdb_wrapper_arguments args; gdb_result r; @@ -713,8 +662,7 @@ GDB_get_frame_block (fi, rval) } static int -wrap_get_frame_block (opaque_arg) - char *opaque_arg; +wrap_get_frame_block (char *opaque_arg) { struct gdb_wrapper_arguments **args = (struct gdb_wrapper_arguments **) opaque_arg; struct frame_info *fi; diff --git a/gdb/gdbtk/generic/gdbtk.c b/gdb/gdbtk/generic/gdbtk.c index 1d1fc907dee..4f37f470f2b 100644 --- a/gdb/gdbtk/generic/gdbtk.c +++ b/gdb/gdbtk/generic/gdbtk.c @@ -1,5 +1,5 @@ /* Startup code for Insight - Copyright 1994, 1995, 1996, 1997, 1998, 2001 + Copyright 1994, 1995, 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. Written by Stu Grossman of Cygnus Support. @@ -74,17 +74,15 @@ static sigset_t nullsigmask; static struct sigaction act1, act2; static struct itimerval it_on, it_off; -static void x_event_wrapper (int); static void -x_event_wrapper (signo) - int signo; +x_event_wrapper (int signo) { x_event (signo); } - /* - * This variable controls the interaction with an external editor. - */ +/* + * This variable controls the interaction with an external editor. + */ char *external_editor_command = NULL; @@ -134,23 +132,19 @@ int gdbtk_disable_fputs = 1; #if TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION == 0 char * -TclpAlloc (size) - unsigned int size; +TclpAlloc (unsigned int size) { return xmalloc (size); } char * -TclpRealloc (ptr, size) - char *ptr; - unsigned int size; +TclpRealloc (char *ptr, unsigned int size) { return xrealloc (ptr, size); } void -TclpFree (ptr) - char *ptr; +TclpFree (char *ptr) { free (ptr); } @@ -171,13 +165,13 @@ void close_bfds () { struct objfile *o; - + ALL_OBJFILES (o) - { - if (o->obfd != NULL) - bfd_cache_close (o->obfd); - } - + { + if (o->obfd != NULL) + bfd_cache_close (o->obfd); + } + if (exec_bfd != NULL) bfd_cache_close (exec_bfd); } @@ -314,16 +308,14 @@ gdbtk_stop_timer () /* Should this target use the timer? See comments before x_event for the logic behind all this. */ static int -target_should_use_timer (t) - struct target_ops *t; +target_should_use_timer (struct target_ops *t) { return target_is_native (t); } /* Is T a native target? */ int -target_is_native (t) - struct target_ops *t; +target_is_native (struct target_ops *t) { char *name = t->to_shortname; @@ -339,8 +331,7 @@ target_is_native (t) /* gdbtk_init installs this function as a final cleanup. */ static void -gdbtk_cleanup (dummy) - PTR dummy; +gdbtk_cleanup (PTR dummy) { Tcl_Eval (gdbtk_interp, "gdbtk_cleanup"); Tcl_Finalize (); @@ -355,8 +346,7 @@ gdbtk_cleanup (dummy) */ static void -gdbtk_init (argv0) - char *argv0; +gdbtk_init (char *argv0) { struct cleanup *old_chain; char *s; @@ -604,7 +594,7 @@ gdbtk_init (argv0) uiout = cli_out_new (gdb_stdout); #ifdef __CYGWIN32__ - (void) FreeConsole (); + (void) FreeConsole (); #endif /* find the gdb tcl library and source main.tcl */ @@ -679,8 +669,7 @@ gdbtk_find_main"; startup procedure. */ int -gdbtk_test (filename) - char *filename; +gdbtk_test (char *filename) { if (access (filename, R_OK) != 0) return 0; @@ -728,15 +717,14 @@ _initialize_gdbtk () } static void -tk_command (cmd, from_tty) - char *cmd; - int from_tty; +tk_command (char *cmd, int from_tty) { int retval; char *result; struct cleanup *old_chain; - /* Catch case of no argument, since this will make the tcl interpreter dump core. */ + /* Catch case of no argument, since this will make the tcl interpreter + dump core. */ if (cmd == NULL) error_no_arg ("tcl command to interpret"); @@ -753,4 +741,3 @@ tk_command (cmd, from_tty) do_cleanups (old_chain); } - -- cgit v1.2.1