aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbtk-hooks.c
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>1999-02-09 22:18:52 +0000
committerMartin Hunt <hunt@redhat.com>1999-02-09 22:18:52 +0000
commit945df66affccebedf7f9bcc6b5d88850224aa241 (patch)
tree59f862918c9f0cd674368ab5ec4e5144cd06180c /gdb/gdbtk-hooks.c
parent8741159f8a410c65eaf66564a006812910a68b86 (diff)
downloadbinutils-945df66affccebedf7f9bcc6b5d88850224aa241.zip
binutils-945df66affccebedf7f9bcc6b5d88850224aa241.tar.gz
binutils-945df66affccebedf7f9bcc6b5d88850224aa241.tar.bz2
1999-02-09 Martin Hunt <hunt@cygnus.com>
* gdbtk-hooks.c: Remove gdbtk_ignorable_warning prototype. It is in gdbtk.h. (report_error): New function. Displays debugging information if a hook function fails. All hook functions should probably call this. (gdbtk_warning): Call report_error() if there is a problem. (gdbtk_register_changed): Call report_error() if there is a problem. (gdbtk_memory_changed): Call report_error() if there is a problem. (gdbtk_ignorable_warning): Pass along class argument. If there is a problem, call report_error(). * gdbtk-cmds.c: Remove TclDebug prototype. It is in gdbtk.h. (gdb_loadfile): Add class name to gdbtk_ignorable_warning call. * gdbtk.c (TclDebug): Add "priority" argument. Calls "dbug" instead of "debug". Removed non-ANSI ifdefs. * gdbtk.h: Fixed protos for gdbtk_ignorable_warning and TclDebug.
Diffstat (limited to 'gdb/gdbtk-hooks.c')
-rw-r--r--gdb/gdbtk-hooks.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/gdb/gdbtk-hooks.c b/gdb/gdbtk-hooks.c
index 4e19233..71bca51 100644
--- a/gdb/gdbtk-hooks.c
+++ b/gdb/gdbtk-hooks.c
@@ -94,10 +94,9 @@ static void gdbtk_exec_file_display PARAMS ((char *));
static void tk_command_loop PARAMS ((void));
static void gdbtk_call_command PARAMS ((struct cmd_list_element *, char *, int));
static int gdbtk_wait PARAMS ((int, struct target_waitstatus *));
- void x_event PARAMS ((int));
+void x_event PARAMS ((int));
static int gdbtk_query PARAMS ((const char *, va_list));
static void gdbtk_warning PARAMS ((const char *, va_list));
-void gdbtk_ignorable_warning PARAMS ((const char *));
static char* gdbtk_readline PARAMS ((char *));
static void
#ifdef ANSI_PROTOTYPES
@@ -303,8 +302,25 @@ gdbtk_warning (warning, args)
char buf[200];
vsprintf (buf, warning, args);
- gdbtk_two_elem_cmd ("gdbtk_tcl_warning", buf);
+ if (gdbtk_two_elem_cmd ("gdbtk_tcl_warning", buf) != TCL_OK)
+ report_error();
+}
+
+
+/* Error-handling function for all hooks */
+/* Hooks are not like tcl functions, they do not simply return */
+/* TCL_OK or TCL_ERROR. Also, the calling function typically */
+/* doesn't care about errors in the hook functions. Therefore */
+/* after every hook function, report_error should be called. */
+/* report_error can just call Tcl_BackgroundError() which will */
+/* pop up a messagebox, or it can silently log the errors through */
+/* the gdbtk dbug command. */
+static void
+report_error ()
+{
+ TclDebug ('E',Tcl_GetVar(gdbtk_interp,"errorInfo",TCL_GLOBAL_ONLY));
+ /* Tcl_BackgroundError(gdbtk_interp); */
}
/*
@@ -313,19 +329,22 @@ gdbtk_warning (warning, args)
*/
void
-gdbtk_ignorable_warning (warning)
+gdbtk_ignorable_warning (class, warning)
+ const char *class;
const char *warning;
{
char buf[512];
- sprintf (buf, warning);
- gdbtk_two_elem_cmd ("gdbtk_tcl_ignorable_warning", buf);
+ sprintf (buf, "gdbtk_tcl_ignorable_warning {%s} {%s}", class, warning);
+ if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
+ report_error();
}
static void
gdbtk_register_changed(regno)
int regno;
{
- Tcl_Eval (gdbtk_interp, "gdbtk_register_changed");
+ if (Tcl_Eval (gdbtk_interp, "gdbtk_register_changed") != TCL_OK)
+ report_error();
}
static void
@@ -333,7 +352,8 @@ gdbtk_memory_changed(addr, len)
CORE_ADDR addr;
int len;
{
- Tcl_Eval (gdbtk_interp, "gdbtk_memory_changed");
+ if (Tcl_Eval (gdbtk_interp, "gdbtk_memory_changed") != TCL_OK)
+ report_error();
}