public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* (patch) g77 helper
@ 1999-08-26 22:39 Mumit Khan
  1999-08-30 11:07 ` James Ingham
  0 siblings, 1 reply; 3+ messages in thread
From: Mumit Khan @ 1999-08-26 22:39 UTC (permalink / raw)
  To: insight

When you start debugging a g77 generated program, you'll have the 
somewhat disconcerting experience of jumping into main, and stare
at what is typically a bunch of startup-style assembly code.

This trivial patch checks for MAIN__ and MAIN___ (depends on the target's
underscoring habits, but only MAIN__ may suffice) before main. Tested
on Linux and Cygwin. Could someone check on HPUX (no underscoring case)
to see what g77 emits there?

Against ss-1999-08-23.

Fri Aug 27 00:07:10 1999  Mumit Khan  <khan@xraylith.wisc.edu>

	* srcwin.itb (SrcWin::_build_win): Check for g77 MAIN before
	checking for main.
	(SrcWin::location): Likewise.
	(SrcWin::point_to_main): Likewise.
	* interface.tcl (run_executable): Likewise.

--- srcwin.itb.~1	Thu Aug 26 23:48:34 1999
+++ srcwin.itb	Fri Aug 27 00:09:38 1999
@@ -144,7 +144,9 @@ body SrcWin::_build_win {} {
   if {$gdb_running} {
     update
   } else {
-    if {![catch {gdb_loc main} linespec]} {
+    if {![catch {gdb_loc MAIN__} linespec] \
+        || ![catch {gdb_loc MAIN___} linespec] \
+        || ![catch {gdb_loc main} linespec]} {
       location BROWSE_TAG $linespec
     }
   }
@@ -420,7 +422,9 @@ body SrcWin::location {tag linespec} {
     set tag BROWSE_TAG
     debug "not running: name=$name funcname=$funcname line=$line"
     if {$name == ""} {
-      if {[catch {gdb_loc main} linespec]} {
+      if {[catch {gdb_loc MAIN__} linespec] \
+          && [catch {gdb_loc MAIN___} linespec] \
+          && [catch {gdb_loc main} linespec]} {
 	# no "main" function found
 	return 
       }
@@ -765,7 +769,9 @@ body SrcWin::point_to_main {} {
   # We need to force this to some default location. Assume main and
   # if that fails, let the source window guess (via gdb_loc using stop_pc).
   set src [lindex [ManagedWin::find SrcWin] 0]
-  if {[catch {gdb_loc main} loc]} {
+  if {[catch {gdb_loc MAIN__} loc] \
+      && [catch {gdb_loc MAIN___} loc] \
+      && [catch {gdb_loc main} loc]} {
     gdbtk_update
     debug "could not find main"
   } else {
--- interface.tcl.~1	Fri Aug 27 00:23:36 1999
+++ interface.tcl	Fri Aug 27 00:28:51 1999
@@ -964,8 +964,16 @@ proc run_executable { {auto_start 1} } {
       
     if {[pref get gdb/load/main]} {
       debug "Setting new BP at main"
+      catch {gdb_cmd "clear MAIN__"}
+      catch {gdb_cmd "clear MAIN___"}
       catch {gdb_cmd "clear main"}
-      catch {gdb_cmd "break main"}
+      # For fortran, we try MAIN__ and MAIN__ first.
+      if {![catch {gdb_loc MAIN__}] || ![catch {gdb_loc MAIN__}]} {
+	catch {gdb_cmd "break MAIN__"}
+	catch {gdb_cmd "break MAIN___"}
+      } else {
+	catch {gdb_cmd "break main"}
+      }
     }
 
     # set BP at user-specified function

Regards,
Mumit

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

end of thread, other threads:[~1999-08-30 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-26 22:39 (patch) g77 helper Mumit Khan
1999-08-30 11:07 ` James Ingham
1999-08-30 13:47   ` Mumit Khan

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