public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main"
@ 2001-04-12 12:51 Nick Duffek
  2001-04-12 12:52 ` Fernando Nasser
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Duffek @ 2001-04-12 12:51 UTC (permalink / raw)
  To: insight; +Cc: keiths

On 27 Feb 2001, I wrote:

>The appended patch checks the program's entry point if none of the
>gdb/main_names functions are found.  This is useful when debugging
>assembly-language programs, which often lack a "main" function.
>
>gdbtk/ChangeLog:
>
>	* 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.

On 27 Feb 2001, Keith Seitz replied:

>I recommend that this patch be approved. It looks correct.

Since Keith is now an Insight maintainer, I've taken the above as approval
for the patch and committed it.  Okay?

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main"
  2001-04-12 12:51 [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main" Nick Duffek
@ 2001-04-12 12:52 ` Fernando Nasser
  0 siblings, 0 replies; 4+ messages in thread
From: Fernando Nasser @ 2001-04-12 12:52 UTC (permalink / raw)
  To: Nick Duffek; +Cc: insight, keiths

Nick Duffek wrote:
> 
> On 27 Feb 2001, I wrote:
> 
> >The appended patch checks the program's entry point if none of the
> >gdb/main_names functions are found.  This is useful when debugging
> >assembly-language programs, which often lack a "main" function.
> >
> >gdbtk/ChangeLog:
> >
> >       * 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.
> 
> On 27 Feb 2001, Keith Seitz replied:
> 
> >I recommend that this patch be approved. It looks correct.
> 
> Since Keith is now an Insight maintainer, I've taken the above as approval
> for the patch and committed it.  Okay?
> 
Yes.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main"
  2001-02-27 12:40 Nicholas Duffek
@ 2001-02-27 12:52 ` Keith Seitz
  0 siblings, 0 replies; 4+ messages in thread
From: Keith Seitz @ 2001-02-27 12:52 UTC (permalink / raw)
  To: Nicholas Duffek; +Cc: insight

On Tue, 27 Feb 2001, Nicholas Duffek wrote:

> Okay to apply?
> 

I recommend that this patch be approved. It looks correct.

Keith

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main"
@ 2001-02-27 12:40 Nicholas Duffek
  2001-02-27 12:52 ` Keith Seitz
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Duffek @ 2001-02-27 12:40 UTC (permalink / raw)
  To: insight

When Insight starts, it initializes the source window to display one of
the functions in [pref get gdb/main_names], which defaults to { MAIN___
MAIN__ main }.  If none of those functions exists, the source window
starts out empty.

The appended patch checks the program's entry point if none of the
gdb/main_names functions are found.  This is useful when debugging
assembly-language programs, which often lack a "main" function.

gdbtk/ChangeLog:

	* 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.

Okay to apply?

Nicholas Duffek
<nsd@redhat.com>

[patch follows]

Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
diff -up gdb/gdbtk/generic/gdbtk-cmds.c gdb/gdbtk/generic/gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c	Tue Feb 13 23:07:32 2001
+++ gdb/gdbtk/generic/gdbtk-cmds.c	Tue Feb 13 23:07:11 2001
@@ -197,6 +197,7 @@ static int gdb_cmd (ClientData, Tcl_Inte
 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[]);
@@ -334,6 +335,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);
@@ -3258,6 +3261,23 @@ gdb_loc (clientData, interp, objc, objv)
   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr,
 			    Tcl_NewStringObj ("", -1));
 #endif
+  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;
 }
 
Index: gdb/gdbtk/library/interface.tcl
===================================================================
diff -up gdb/gdbtk/library/interface.tcl gdb/gdbtk/library/interface.tcl
--- gdb/gdbtk/library/interface.tcl	Tue Feb 13 23:07:49 2001
+++ gdb/gdbtk/library/interface.tcl	Tue Feb 13 23:07:11 2001
@@ -726,6 +726,10 @@ proc gdbtk_locate_main {} {
       return $linespec
     }
   }
+  if {![catch gdb_entry_point entry_point]
+      && ![catch {gdb_loc "*$entry_point"} linespec]} {
+    return $linespec
+  }
   return {}
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-04-12 12:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-12 12:51 [RFA] gdbtk/generic/gdbtk-cmds.c: try entry point if no "main" Nick Duffek
2001-04-12 12:52 ` Fernando Nasser
  -- strict thread matches above, loose matches on Subject: below --
2001-02-27 12:40 Nicholas Duffek
2001-02-27 12:52 ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).