public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Mumit Khan <khan@xraylith.wisc.EDU>
To: insight@sourceware.cygnus.com
Subject: (patch) g77 helper
Date: Thu, 26 Aug 1999 22:39:00 -0000	[thread overview]
Message-ID: <199908270539.AAA19687@mercury.xraylith.wisc.edu> (raw)

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

             reply	other threads:[~1999-08-26 22:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-08-26 22:39 Mumit Khan [this message]
1999-08-30 11:07 ` James Ingham
1999-08-30 13:47   ` Mumit Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199908270539.AAA19687@mercury.xraylith.wisc.edu \
    --to=khan@xraylith.wisc.edu \
    --cc=insight@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).