+2002-08-14 Keith Seitz <keiths@redhat.com>
+
+ * generic/gdbtk.c (view_command): New function to display
+ location in source window.
+ (gdbtk_init): Add new gdb "view" command.
+
2002-08-06 Keith Seitz <keiths@redhat.com>
* library/srcwin.itb (_build_win): Anchor status label so that
int gdbtk_test (char *);
+static void view_command (char *, int);
+
/* Handle for TCL interpreter */
Tcl_Interp *gdbtk_interp = NULL;
add_com ("tk", class_obscure, tk_command,
"Send a command directly into tk.");
+ add_com ("view", class_obscure, view_command,
+ "View a location in the source window.");
+
/*
* Set the variable for external editor:
*/
do_cleanups (old_chain);
}
+
+static void
+view_command (char *args, int from_tty)
+{
+ char *script;
+ struct cleanup *old_chain;
+
+ if (args != NULL)
+ {
+ xasprintf (&script,
+ "[lindex [ManagedWin::find SrcWin] 0] location BROWSE_TAG [gdb_loc %s]",
+ args);
+ old_chain = make_cleanup (xfree, script);
+ if (Tcl_Eval (gdbtk_interp, script) != TCL_OK)
+ {
+ Tcl_Obj *obj = Tcl_GetObjResult (gdbtk_interp);
+ error (Tcl_GetStringFromObj (obj, NULL));
+ }
+
+ do_cleanups (old_chain);
+ }
+ else
+ error ("Argument required (location to view)");
+}