This is the mail archive of the
insight@sourceware.cygnus.com
mailing list for the Insight project.
(patch) g77 helper
- To: insight@sourceware.cygnus.com
- Subject: (patch) g77 helper
- From: Mumit Khan <khan@xraylith.wisc.EDU>
- Date: Fri, 27 Aug 1999 00:39:02 -0500
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