From 637b166117dbbd3df6eedaec2873a45b4d10b3cc Mon Sep 17 00:00:00 2001 From: Stu Grossman Date: Fri, 16 Sep 1994 22:57:37 +0000 Subject: * defs.h (QUIT): Call interactive_hook to allow GUI to interrupt. Also, add decl for symtab_to_filename. * gdbtk.c: Replace calls to full_filename with symtab_to_filename. * gdbtk.tcl: New routine pc_to_line replaces in line code. New routine decr replaces in line code. * (create_file_win): Use catch to handle open failures more elegantly. Also, create special window to display file open failure message. Move opening of file prior to creation of text widget. * (create_asm_win): Add PC as argument. We now base disassembly on PC instead of function name, since function names can be ambiguous (usually seen with shared libs). Also, use catch to simplify code where we don't care about failures. * source.c (symtab_to_filename): New. Returns the file associated with a symtab. * top.c: Define interactive_hook. Called during QUIT to animate the GUI. --- gdb/gdbtk.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'gdb/gdbtk.c') diff --git a/gdb/gdbtk.c b/gdb/gdbtk.c index e3a2ce7..9843b43 100644 --- a/gdb/gdbtk.c +++ b/gdb/gdbtk.c @@ -129,6 +129,7 @@ gdbtk_query (args) return val; } +#if 0 static char * full_filename(symtab) struct symtab *symtab; @@ -163,6 +164,7 @@ full_filename(symtab) return filename; } +#endif static void breakpoint_notify(b, action) @@ -180,7 +182,7 @@ breakpoint_notify(b, action) sal = find_pc_line (b->address, 0); - filename = full_filename (sal.symtab); + filename = symtab_to_filename (sal.symtab); sprintf (bpnum, "%d", b->number); sprintf (line, "%d", sal.line); @@ -200,9 +202,6 @@ breakpoint_notify(b, action) gdbtk_fputs (interp->result); gdbtk_fputs ("\n"); } - - if (filename) - free (filename); } static void @@ -293,7 +292,7 @@ gdb_loc (clientData, interp, argc, argv) find_pc_partial_function (pc, &funcname, NULL, NULL); Tcl_AppendElement (interp, funcname); - filename = full_filename (sal.symtab); + filename = symtab_to_filename (sal.symtab); Tcl_AppendElement (interp, filename); sprintf (buf, "%d", sal.line); @@ -302,9 +301,6 @@ gdb_loc (clientData, interp, argc, argv) sprintf (buf, "0x%x", pc); Tcl_AppendElement (interp, buf); /* PC */ - if (filename) - free(filename); - return TCL_OK; } @@ -396,6 +392,15 @@ cleanup_init (ignored) interp = NULL; } +/* Come here during long calculations to check for GUI events. Usually invoked + via the QUIT macro. */ + +static void +gdbtk_interactive () +{ + /* Tk_DoOneEvent (TK_DONT_WAIT|TK_IDLE_EVENTS); */ +} + static void gdbtk_init () { @@ -445,6 +450,7 @@ gdbtk_init () delete_breakpoint_hook = gdbtk_delete_breakpoint; enable_breakpoint_hook = gdbtk_enable_breakpoint; disable_breakpoint_hook = gdbtk_disable_breakpoint; + interactive_hook = gdbtk_interactive; discard_cleanups (old_chain); -- cgit v1.1