From: kseitz Date: Wed, 14 Aug 2002 15:44:24 +0000 (+0000) Subject: * generic/gdbtk.c (view_command): New function to display X-Git-Tag: pre-no-this~812 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dda75827b6874d1a7abf2f4be4b63c5743e9b900;p=pf3gnuchains%2Fpf3gnuchains4x.git * generic/gdbtk.c (view_command): New function to display location in source window. (gdbtk_init): Add new gdb "view" command. --- diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog index 147f836520..16dd21b2f3 100644 --- a/gdb/gdbtk/ChangeLog +++ b/gdb/gdbtk/ChangeLog @@ -1,3 +1,9 @@ +2002-08-14 Keith Seitz + + * 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 * library/srcwin.itb (_build_win): Anchor status label so that diff --git a/gdb/gdbtk/generic/gdbtk.c b/gdb/gdbtk/generic/gdbtk.c index 951049c177..b868a423c5 100644 --- a/gdb/gdbtk/generic/gdbtk.c +++ b/gdb/gdbtk/generic/gdbtk.c @@ -98,6 +98,8 @@ int target_is_native (struct target_ops *t); int gdbtk_test (char *); +static void view_command (char *, int); + /* Handle for TCL interpreter */ Tcl_Interp *gdbtk_interp = NULL; @@ -568,6 +570,9 @@ gdbtk_init (char *argv0) 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: */ @@ -741,3 +746,27 @@ tk_command (char *cmd, int from_tty) 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)"); +}