+Thu Jun 4 10:15:03 1998 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+
+ * gdbtk.c: merged:
+
+ - Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+ (call_obj_wrapper): in case of error, copy the
+ error message from the result to the error_string.
+ (gdbtk_fputs): add comments.
+ (gdb_actions_command): call validate_actionline when installing the
+ tracepoint, to do the syntax checking of the actions for us.
+ - Elena Zannoni <ezannoni@kwikemart.cygnus.com>
+ (gdb_get_trace_frame_num): new function to get the
+ trace frame number from gdb.
+ (gdbtk_init): added new command gdb_get_trace_frame_num.
+ - Jim Blandy <jimb@zwingli.cygnus.com>
+ (struct wrapped_call_objs): Change the `func' member to
+ be a Tcl_ObjCmdProc, not an Tcl_CmdProc, since it accepts a vector
+ of objects as arguments. Change the object vector to be const,
+ since that's what all the users of this structure seem to expect.
+ (call_obj_wrapper): Cast clientData properly before storing it in
+ the wrapped_args structure.
+
Thu May 28 17:19:14 1998 Keith Seitz <keiths@cygnus.com>
* gdbtk.c (_initialize_gdbtk): Get rid of the console. Patch from
static int gdb_set_bp PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]));
static struct symtab *full_lookup_symtab PARAMS ((char *file));
static int gdb_get_mem PARAMS ((ClientData, Tcl_Interp *, int, char *[]));
+static int gdb_get_trace_frame_num PARAMS ((ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]));
/* Handle for TCL interpreter */
static Tcl_Interp *interp = NULL;
#endif
}
+/* Print the string PTR, with necessary hair for dealing with the
+ GDB console thingy, etc. To wit:
+
+ Append the string PTR to result_ptr or error_string_ptr, if they
+ are set. Otherwise, call the Tcl function `gdbtk_tcl_fputs', with
+ the string PTR as its only argument. */
static void
gdbtk_fputs (ptr, stream)
const char *ptr;
struct wrapped_call_objs
{
Tcl_Interp *interp;
- Tcl_CmdProc *func;
+ Tcl_ObjCmdProc *func;
int objc;
- Tcl_Obj **objv;
+ Tcl_Obj * CONST *objv;
int val;
};
old_error_string_ptr = error_string_ptr;
error_string_ptr = &error_string;
- wrapped_args.func = (Tcl_CmdProc *)clientData;
+ wrapped_args.func = (Tcl_ObjCmdProc *)clientData;
wrapped_args.interp = interp;
wrapped_args.objc = objc;
wrapped_args.objv = objv;
running_now = 0;
Tcl_Eval (interp, "gdbtk_tcl_idle");
+
+
+ /* if the error message is in RESULT instead of ERROR_STRING we copy it
+ back to ERROR_STRING and free RESULT */
+
+ if ((Tcl_DStringLength (&error_string) == 0) && (Tcl_DStringLength (&result) > 0))
+ {
+ Tcl_DStringAppend (&error_string, Tcl_DStringValue (&result), Tcl_DStringLength (&result));
+ Tcl_DStringFree (&result);
+ }
+
}
/* do not suppress any errors -- a remote target could have errored */
/* 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, s we need to have specific
+ 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 (interp, "gdbtk_tcl_tstart");
+ (*cmdblk->function.cfunc)(arg, from_tty);
+ }
else if (!strcmp(cmdblk->name, "tstop") && !No_Update)
+ {
Tcl_Eval (interp, "gdbtk_tcl_tstop");
+ (*cmdblk->function.cfunc)(arg, from_tty);
+ }
/* end of hack */
else
{
Tcl_CreateCommand (interp, "gdb_pc_reg", get_pc_register, NULL, NULL);
Tcl_CreateObjCommand (interp, "gdb_loadfile", call_obj_wrapper, gdb_loadfile, NULL);
Tcl_CreateObjCommand (interp, "gdb_set_bp", call_obj_wrapper, gdb_set_bp, NULL);
+ Tcl_CreateObjCommand (interp, "gdb_get_trace_frame_num",
+ call_obj_wrapper, gdb_get_trace_frame_num, NULL);
command_loop_hook = tk_command_loop;
print_frame_info_listing_hook = gdbtk_print_frame_info;
return TCL_OK;
}
+
+static int
+gdb_get_trace_frame_num (clientData, interp, objc, objv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int objc;
+ Tcl_Obj *CONST objv[];
+{
+ if (objc != 1)
+ {
+ Tcl_AppendResult (interp, "wrong # of args: should be \"",
+ Tcl_GetStringFromObj (objv[0], NULL),
+ " linespec\"");
+ return TCL_ERROR;
+ }
+
+ Tcl_SetObjResult (interp, Tcl_NewIntObj (get_traceframe_number ()));
+ return TCL_OK;
+}
+
+
+
static int
gdb_get_file_command (clientData, interp, objc, objv)
ClientData clientData;
char *number, *args, *action;
long step_count;
struct action_line *next = NULL, *temp;
+ enum actionline_type linetype;
if (objc != 3)
{
step_count = 0;
Tcl_ListObjGetElements (interp, objv[2], &nactions, &actions);
+
+ /* Add the actions to the tracepoint */
for (i = 0; i < nactions; i++)
{
temp = xmalloc (sizeof (struct action_line));
temp->next = NULL;
action = Tcl_GetStringFromObj (actions[i], &len);
temp->action = savestring (action, len);
- if (sscanf (temp->action, "while-stepping %d", &step_count) !=0)
- tp->step_count = step_count;
+
+ linetype = validate_actionline (&(temp->action), tp);
+
+ if (linetype == BADLINE)
+ {
+ free (temp);
+ continue;
+ }
+
if (next == NULL)
{
tp->actions = temp;