OSDN Git Service

* generic/gdbtk-cmds.c (gdb_entry_point): New TCL command.
authornsd <nsd>
Thu, 12 Apr 2001 19:46:41 +0000 (19:46 +0000)
committernsd <nsd>
Thu, 12 Apr 2001 19:46:41 +0000 (19:46 +0000)
* library/interface.tcl (gdbtk_locate_main): Try the program's
entry point if no main function is found.

gdb/gdbtk/ChangeLog
gdb/gdbtk/generic/gdbtk-cmds.c
gdb/gdbtk/library/interface.tcl

index ba74716..c01674c 100644 (file)
@@ -1,3 +1,9 @@
+2001-04-12  Nicholas Duffek  <nsd@redhat.com>
+
+       * generic/gdbtk-cmds.c (gdb_entry_point): New TCL command.
+       * library/interface.tcl (gdbtk_locate_main): Try the program's
+       entry point if no main function is found.
+
 2001-04-10  Keith Seitz  <keiths@cygnus.com>
 
        From Tom Tromey (tromey@redhat.com):
index 125fb9d..a4960fb 100644 (file)
@@ -199,6 +199,7 @@ static int gdb_cmd (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
 static int gdb_confirm_quit (ClientData, Tcl_Interp *, int,
                             Tcl_Obj * CONST[]);
 static int gdb_disassemble (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
+static int gdb_entry_point (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
 static int gdb_eval (ClientData, Tcl_Interp *, int, Tcl_Obj * CONST[]);
 static int gdb_fetch_registers (ClientData, Tcl_Interp *, int,
                                Tcl_Obj * CONST[]);
@@ -336,6 +337,8 @@ Gdbtk_Init (interp)
                        NULL);
   Tcl_CreateObjCommand (interp, "gdb_listfuncs", call_wrapper, gdb_listfuncs,
                        NULL);
+  Tcl_CreateObjCommand (interp, "gdb_entry_point", call_wrapper,
+                       gdb_entry_point, NULL);
   Tcl_CreateObjCommand (interp, "gdb_get_mem", call_wrapper, gdb_get_mem,
                        NULL);
   Tcl_CreateObjCommand (interp, "gdb_stop", call_wrapper, gdb_stop, NULL);
@@ -3246,6 +3249,23 @@ gdb_loc (ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST obj
   return TCL_OK;
 }
 
+/* This implements the TCL command gdb_entry_point.  It returns the current
+   entry point address.  */
+
+static int
+gdb_entry_point (clientData, interp, objc, objv)
+     ClientData clientData;
+     Tcl_Interp *interp;
+     int objc;
+     Tcl_Obj *CONST objv[];
+{
+  char *addrstr;
+
+  addrstr = paddr_nz (entry_point_address ());
+  Tcl_SetStringObj (result_ptr->obj_ptr, addrstr, -1);
+  return TCL_OK;
+}
+
 /* This implements the Tcl command 'gdb_get_mem', which 
  * dumps a block of memory 
  * Arguments:
index 084c87a..69eded1 100644 (file)
@@ -742,6 +742,10 @@ proc gdbtk_locate_main {} {
       return $linespec
     }
   }
+  if {![catch gdb_entry_point entry_point]
+      && ![catch {gdb_loc "*$entry_point"} linespec]} {
+    return $linespec
+  }
   return {}
 }