#include "guitcl.h"
#include "gdbtk.h"
-#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
static int gdbtk_query PARAMS ((const char *, va_list));
static void gdbtk_warning PARAMS ((const char *, va_list));
static char* gdbtk_readline PARAMS ((char *));
-static void
-#ifdef ANSI_PROTOTYPES
-gdbtk_readline_begin (char *format, ...);
-#else
-gdbtk_readline_begin ();
-#endif
+static void gdbtk_readline_begin (char *format, ...);
static void gdbtk_readline_end PARAMS ((void));
static void gdbtk_flush PARAMS ((GDB_FILE *));
static void gdbtk_pre_add_symbol PARAMS ((char *));
static void gdbtk_selected_frame_changed PARAMS ((int));
static void gdbtk_context_change PARAMS ((int));
static void gdbtk_error_begin PARAMS ((void));
+static void report_error (void);
/*
* gdbtk_fputs can't be static, because we need to call it in gdbtk.c.
Tcl_ConvertElement (argv1, command + cmd_len + 1, flags_ptr);
result = Tcl_Eval (gdbtk_interp, command);
+ if (result != TCL_OK)
+ report_error ();
free (command);
return result;
-
}
static void
{
gdbtk_two_elem_cmd ("gdbtk_tcl_fputs", (char *) ptr);
if (result_ptr->flags & GDBTK_MAKES_LIST)
- gdbtk_two_elem_cmd ("gdbtk_tcl_fputs", " ");
+ gdbtk_two_elem_cmd ("gdbtk_tcl_fputs", " ");
}
}
else
char buf[200];
vsprintf (buf, warning, args);
- if (gdbtk_two_elem_cmd ("gdbtk_tcl_warning", buf) != TCL_OK)
- report_error();
+ gdbtk_two_elem_cmd ("gdbtk_tcl_warning", buf);
}
/* VARARGS */
static void
-#ifdef ANSI_PROTOTYPES
gdbtk_readline_begin (char *format, ...)
-#else
-gdbtk_readline_begin (va_alist)
- va_dcl
-#endif
{
va_list args;
char buf[200];
-#ifdef ANSI_PROTOTYPES
va_start (args, format);
-#else
- char *format;
- va_start (args);
- format = va_arg (args, char *);
-#endif
-
vsprintf (buf, format, args);
gdbtk_two_elem_cmd ("gdbtk_tcl_readline_begin", buf);
-
}
static char *
static void
gdbtk_readline_end ()
{
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_readline_end");
+ if (Tcl_Eval (gdbtk_interp, "gdbtk_tcl_readline_end") != TCL_OK)
+ report_error ();
}
static void
action, b->number, (long)b->address, b->line_number, filename,
bpdisp[b->disposition], b->enable, b->thread);
- v = Tcl_Eval (gdbtk_interp, buf);
-
- if (v != TCL_OK)
- {
- gdbtk_fputs (Tcl_GetStringResult (gdbtk_interp), gdb_stdout);
- gdbtk_fputs ("\n", gdb_stdout);
- }
+ if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
+ report_error ();
}
int
{
char buf[128];
sprintf (buf, "download_hash %s %ld", section, num);
- Tcl_Eval (gdbtk_interp, buf);
+ if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
+ report_error ();
return atoi (gdbtk_interp->result);
}
gdbtk_pre_add_symbol (name)
char *name;
{
-
gdbtk_two_elem_cmd("gdbtk_tcl_pre_add_symbol", name);
-
}
/* This hook is called whenever we finish loading a symbol file. */
static void
gdbtk_post_add_symbol ()
{
- Tcl_Eval (gdbtk_interp, "gdbtk_tcl_post_add_symbol");
+ if (Tcl_Eval (gdbtk_interp, "gdbtk_tcl_post_add_symbol") != TCL_OK)
+ report_error ();
}
/* This hook function is called whenever we want to wait for the
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);
-
- if (v != TCL_OK)
- {
- gdbtk_fputs (gdbtk_interp->result, gdb_stdout);
- gdbtk_fputs ("\n", gdb_stdout);
- }
+ if (Tcl_Eval (gdbtk_interp, buf) != TCL_OK)
+ report_error ();
}
/*
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_GlobalEvalObj (gdbtk_interp, cmdObj);
+ if (Tcl_GlobalEvalObj (gdbtk_interp, cmdObj) != TCL_OK)
+ report_error ();
#else
- Tcl_EvalObj (gdbtk_interp, cmdObj, TCL_EVAL_GLOBAL);
+ if (Tcl_EvalObj (gdbtk_interp, cmdObj, TCL_EVAL_GLOBAL) != TCL_OK)
+ report_error ();
#endif
}