From 6f5af15b07a5fdae381346a7d680c7a1d7cf553d Mon Sep 17 00:00:00 2001 From: Martin Hunt Date: Mon, 27 Jul 1998 20:23:58 +0000 Subject: [PATCH] Mon Jul 27 13:07:16 1998 Martin M. Hunt * gdbtk.c (gdbtk_call_command): Removed because it is now in gdbtk-hooks.c (null_routine): Removed. * gdbtk-hooks.c (tracepoint_notify): Fix sprintf to match number of arguments. * gdbtk-cmds.c (gdb_loc): When calling gdb_loc with an argument, call find_pc_line() to get a complete symtab_and_line struct. --- gdb/ChangeLog-gdbtk | 15 ++++++++- gdb/gdbtk-cmds.c | 52 ++++++++++++------------------- gdb/gdbtk-hooks.c | 12 ++----- gdb/gdbtk.c | 76 ++++++--------------------------------------- 4 files changed, 46 insertions(+), 109 deletions(-) diff --git a/gdb/ChangeLog-gdbtk b/gdb/ChangeLog-gdbtk index fa5ea277830..42b7b0df7fa 100644 --- a/gdb/ChangeLog-gdbtk +++ b/gdb/ChangeLog-gdbtk @@ -1,3 +1,16 @@ +Mon Jul 27 13:07:16 1998 Martin M. Hunt + + * gdbtk.c (gdbtk_call_command): Removed because it is now + in gdbtk-hooks.c + (null_routine): Removed. + + * gdbtk-hooks.c (tracepoint_notify): Fix sprintf to + match number of arguments. + + * gdbtk-cmds.c (gdb_loc): When calling gdb_loc with an + argument, call find_pc_line() to get a complete + symtab_and_line struct. + Fri Jul 24 14:25:43 1998 Keith Seitz * gdbtk-cmds.c (gdb_search): Add missing NULL to switches. @@ -1676,7 +1689,7 @@ Thu Jul 28 14:37:36 1994 Stu Grossman (grossman@cygnus.com) Local Variables: -mode: indented-text +mode: change-log left-margin: 8 fill-column: 74 version-control: never diff --git a/gdb/gdbtk-cmds.c b/gdb/gdbtk-cmds.c index 4b450f6eac6..de44004cf82 100644 --- a/gdb/gdbtk-cmds.c +++ b/gdb/gdbtk-cmds.c @@ -204,21 +204,12 @@ static int gdb_tracepoint_exists_command PARAMS ((ClientData, Tcl_Interp *, Tcl_Obj *CONST objv[])); static int gdb_get_tracepoint_info PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[])); -static void gdbtk_create_breakpoint PARAMS ((struct breakpoint *)); static int gdbtk_dis_asm_read_memory PARAMS ((bfd_vma, bfd_byte *, int, disassemble_info *)); -static void gdbtk_create_tracepoint PARAMS ((struct tracepoint *)); -static void gdbtk_delete_breakpoint PARAMS ((struct breakpoint *)); -static void gdbtk_delete_tracepoint PARAMS ((struct tracepoint *)); -static void gdbtk_modify_breakpoint PARAMS ((struct breakpoint *)); -static void gdbtk_modify_tracepoint PARAMS ((struct tracepoint *)); -static void gdbtk_print_frame_info PARAMS ((struct symtab *, int, int, int)); -static void gdbtk_readline_end PARAMS ((void)); static int get_pc_register PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST [])); char * get_prompt PARAMS ((void)); static void get_register PARAMS ((int, void *)); static void get_register_name PARAMS ((int, void *)); static int map_arg_registers PARAMS ((int, Tcl_Obj *CONST [], void (*) (int, void *), void *)); -static void pc_changed PARAMS ((void)); static int perror_with_name_wrapper PARAMS ((char *args)); static void register_changed_p PARAMS ((int, void *)); void TclDebug PARAMS ((const char *fmt, ...)); @@ -325,7 +316,6 @@ call_wrapper (clientData, interp, objc, objv) { struct wrapped_call_args wrapped_args; gdbtk_result new_result, *old_result_ptr; - int length; old_result_ptr = result_ptr; result_ptr = &new_result; @@ -592,7 +582,7 @@ gdb_eval (clientData, interp, objc, objv) Tcl_Obj *CONST objv[]; { struct expression *expr; - struct cleanup *old_chain; + struct cleanup *old_chain=NULL; value_ptr val; if (objc != 2) @@ -798,7 +788,6 @@ gdb_load_info (clientData, interp, objc, objv) struct cleanup *old_cleanups; asection *s; Tcl_Obj *ob[2]; - int i = 0; char *filename = Tcl_GetStringFromObj (objv[1], NULL); @@ -986,7 +975,6 @@ gdb_get_line_command (clientData, interp, objc, objv) int objc; Tcl_Obj *CONST objv[]; { - Tcl_Obj *result; struct symtabs_and_lines sals; char *args, **canonical; @@ -1028,7 +1016,6 @@ gdb_get_file_command (clientData, interp, objc, objv) int objc; Tcl_Obj *CONST objv[]; { - Tcl_Obj *result; struct symtabs_and_lines sals; char *args, **canonical; @@ -1165,14 +1152,13 @@ gdb_listfiles (clientData, interp, objc, objv) struct objfile *objfile; struct partial_symtab *psymtab; struct symtab *symtab; - char *lastfile, *pathname, **files; + char *lastfile, *pathname=NULL, **files; int files_size; int i, numfiles = 0, len = 0; - Tcl_Obj *mylist; files_size = 1000; files = (char **) xmalloc (sizeof (char *) * files_size); - + if (objc > 2) { Tcl_WrongNumArgs (interp, 1, objv, "Usage: gdb_listfiles ?pathname?"); @@ -1265,11 +1251,11 @@ gdb_search (clientData, interp, objc, objv) { struct symbol_search *ss = NULL; struct symbol_search *p; - struct cleanup *old_chain; - Tcl_Obj *list, *result, *CONST *switch_objv; + struct cleanup *old_chain = NULL; + Tcl_Obj *CONST *switch_objv; int index, switch_objc, i; - namespace_enum space; - char *regexp, *val; + namespace_enum space = 0; + char *regexp; int static_only, nfiles; Tcl_Obj **file_list; char **files; @@ -1417,7 +1403,6 @@ gdb_listfuncs (clientData, interp, objc, objv) struct blockvector *bv; struct block *b; struct symbol *sym; - char buf[128]; int i,j; Tcl_Obj *funcVals[2]; @@ -2063,12 +2048,14 @@ gdb_disassemble (clientData, interp, objc, objv) */ if (disassemble_from_exec == -1) - if (strcmp (target_shortname, "child") == 0 - || strcmp (target_shortname, "procfs") == 0 - || strcmp (target_shortname, "vxprocess") == 0) - disassemble_from_exec = 0; /* It's a child process, read inferior mem */ - else - disassemble_from_exec = 1; /* It's remote, read the exec file */ + { + if (strcmp (target_shortname, "child") == 0 + || strcmp (target_shortname, "procfs") == 0 + || strcmp (target_shortname, "vxprocess") == 0) + disassemble_from_exec = 0; /* It's a child process, read inferior mem */ + else + disassemble_from_exec = 1; /* It's remote, read the exec file */ + } if (disassemble_from_exec) di.read_memory_func = gdbtk_dis_asm_read_memory; @@ -2312,7 +2299,6 @@ gdb_loc (clientData, interp, objc, objv) Tcl_SetStringObj (result_ptr->obj_ptr, "Ambiguous line spec", -1); return TCL_ERROR; } - pc = sal.pc; } else @@ -2377,7 +2363,7 @@ gdb_get_mem (clientData, interp, objc, objv) CORE_ADDR addr; int nbytes, rnum, bpr; long tmp; - char format, c, *ptr, buff[128], aschar, *mbuf, *mptr, *cptr, *bptr; + char format, c, buff[128], aschar, *mbuf, *mptr, *cptr, *bptr; struct type *val_type; if (objc < 6 || objc > 7) @@ -2549,8 +2535,8 @@ gdb_loadfile (clientData, interp, objc, objv) int objc; Tcl_Obj *CONST objv[]; { - char *file, *widget, *buf, msg[128]; - int linenumbers, ln, anum, lnum, ltable_size; + char *file, *widget; + int linenumbers, ln, lnum, ltable_size; FILE *fp; char *ltable; struct symtab *symtab; @@ -2825,7 +2811,7 @@ gdb_set_bp (clientData, interp, objc, objv) Tcl_DStringAppend (&cmd, "gdbtk_tcl_breakpoint create ", -1); sprintf (buf, "%d", b->number); Tcl_DStringAppendElement(&cmd, buf); - sprintf (buf, "0x%x", sal.pc); + sprintf (buf, "0x%lx", (long)sal.pc); Tcl_DStringAppendElement (&cmd, buf); Tcl_DStringAppendElement (&cmd, Tcl_GetStringFromObj (objv[2], NULL)); Tcl_DStringAppendElement (&cmd, Tcl_GetStringFromObj (objv[1], NULL)); diff --git a/gdb/gdbtk-hooks.c b/gdb/gdbtk-hooks.c index b76f2ff03c5..7d59fb6db4b 100644 --- a/gdb/gdbtk-hooks.c +++ b/gdb/gdbtk-hooks.c @@ -297,16 +297,11 @@ void gdbtk_ignorable_warning (warning) const char *warning; { - char buf[200], *merge[2]; - char *command; - + char buf[512]; sprintf (buf, warning); gdbtk_two_elem_cmd ("gdbtk_tcl_ignorable_warning", buf); - } - - static void pc_changed() { @@ -402,8 +397,7 @@ gdbtk_readline_begin (va_alist) #endif { va_list args; - char buf[200], *merge[2]; - char *command; + char buf[200]; #ifdef ANSI_PROTOTYPES va_start (args, format); @@ -674,7 +668,7 @@ tracepoint_notify(tp, action) filename = symtab_to_filename (sal.symtab); if (filename == NULL) filename = "N/A"; - sprintf (buf, "gdbtk_tcl_tracepoint %s %d 0x%lx %d {%s}", action, tp->number, + sprintf (buf, "gdbtk_tcl_tracepoint %s %d 0x%lx %d {%s} %d", action, tp->number, (long)tp->address, sal.line, filename, tp->pass_count); v = Tcl_Eval (gdbtk_interp, buf); diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index ba72e0a0d98..01cf3ddd60e 100644 --- a/gdb/gdbtk.c +++ b/gdb/gdbtk.c @@ -81,12 +81,12 @@ static struct itimerval it_on, it_off; extern int Tktable_Init PARAMS ((Tcl_Interp *interp)); -static void null_routine PARAMS ((int)); static void gdbtk_init PARAMS ((char *)); void gdbtk_interactive PARAMS ((void)); static void cleanup_init PARAMS ((int)); static void tk_command PARAMS ((char *, int)); +void gdbtk_add_hooks PARAMS ((void)); int gdbtk_test PARAMS ((char *)); /* @@ -149,12 +149,6 @@ Tcl_Free(ptr) #endif /* ! _WIN32 */ -static void -null_routine(arg) - int arg; -{ -} - #ifdef _WIN32 /* On Windows, if we hold a file open, other programs can't write to @@ -296,55 +290,6 @@ gdbtk_stop_timer () } } -/* This is called from execute_command, and provides a wrapper around - various command routines in a place where both protocol messages and - user input both flow through. Mostly this is used for indicating whether - the target process is running or not. -*/ - -static void -gdbtk_call_command (cmdblk, arg, from_tty) - struct cmd_list_element *cmdblk; - char *arg; - int from_tty; -{ - running_now = 0; - if (cmdblk->class == class_run || cmdblk->class == class_trace) - { - -/* HACK! HACK! This is to get the gui to update the tstart/tstop - button only incase of tstart/tstop commands issued from the console - We don't want to update the src window, so we need to have specific - procedures to do tstart and tstop - Unfortunately this will not display errors from tstart or tstop in the - console window itself, but as dialogs.*/ - - if (!strcmp(cmdblk->name, "tstart") && !No_Update) - { - Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstart"); - (*cmdblk->function.cfunc)(arg, from_tty); - } - else if (!strcmp(cmdblk->name, "tstop") && !No_Update) - { - Tcl_Eval (gdbtk_interp, "gdbtk_tcl_tstop"); - (*cmdblk->function.cfunc)(arg, from_tty); - } -/* end of hack */ - else - { - running_now = 1; - if (!No_Update) - Tcl_Eval (gdbtk_interp, "gdbtk_tcl_busy"); - (*cmdblk->function.cfunc)(arg, from_tty); - running_now = 0; - if (!No_Update) - Tcl_Eval (gdbtk_interp, "gdbtk_tcl_idle"); - } - } - else - (*cmdblk->function.cfunc)(arg, from_tty); -} - /* gdbtk_init installs this function as a final cleanup. */ static void @@ -372,12 +317,9 @@ gdbtk_init ( argv0 ) { struct cleanup *old_chain; char *lib, *gdbtk_lib, *gdbtk_lib_tmp, *gdbtk_file; - int i, found_main; + int found_main; Tcl_Obj *auto_path_elem, *auto_path_name; -#ifndef WINNT - struct sigaction action; - static sigset_t nullsigmask = {0}; -#endif + #ifdef IDE /* start-sanitize-ide */ struct ide_event_handle *h; @@ -554,11 +496,13 @@ gdbtk_init ( argv0 ) gdbtk_lib = getenv ("GDBTK_LIBRARY"); if (!gdbtk_lib) - if (access ("gdbtcl/main.tcl", R_OK) == 0) - gdbtk_lib = "gdbtcl"; - else - gdbtk_lib = GDBTK_LIBRARY; - + { + if (access ("gdbtcl/main.tcl", R_OK) == 0) + gdbtk_lib = "gdbtcl"; + else + gdbtk_lib = GDBTK_LIBRARY; + } + gdbtk_lib_tmp = xstrdup (gdbtk_lib); found_main = 0; -- 2.30.2