summaryrefslogtreecommitdiff
path: root/gdb/gdbtk
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2001-07-21 18:44:03 +0000
committerMartin Hunt <hunt@redhat.com>2001-07-21 18:44:03 +0000
commit1372a7a7ea9f8751995aac9b6315e7d72708fc1f (patch)
treea934792f26a6b813bff42ddf4993c5382156dc4c /gdb/gdbtk
parent7c6cb724af6f7e646ac10722a61a48badbd9da72 (diff)
downloadgdb-1372a7a7ea9f8751995aac9b6315e7d72708fc1f.tar.gz
2001-07-21 Martin M. Hunt <hunt@redhat.com>
* library/interface.tcl (gdbtk_locate_main): Fix function so that it returns either a null string or a valid location, as documented.
Diffstat (limited to 'gdb/gdbtk')
-rw-r--r--gdb/gdbtk/ChangeLog4
-rw-r--r--gdb/gdbtk/library/interface.tcl19
2 files changed, 18 insertions, 5 deletions
diff --git a/gdb/gdbtk/ChangeLog b/gdb/gdbtk/ChangeLog
index ec1bf7706e0..7f319a0b261 100644
--- a/gdb/gdbtk/ChangeLog
+++ b/gdb/gdbtk/ChangeLog
@@ -1,5 +1,9 @@
2001-07-21 Martin M. Hunt <hunt@redhat.com>
+ * library/interface.tcl (gdbtk_locate_main): Fix function
+ so that it returns either a null string or a valid location,
+ as documented.
+
* library/variables.tcl (build_menu_helper): Set
the Format menu option to "disabled" initially.
diff --git a/gdb/gdbtk/library/interface.tcl b/gdb/gdbtk/library/interface.tcl
index 6b87e7fd69d..3737ddd9063 100644
--- a/gdb/gdbtk/library/interface.tcl
+++ b/gdb/gdbtk/library/interface.tcl
@@ -774,24 +774,33 @@ proc gdbtk_tcl_exec_file_display {filename} {
# 3: source line number
# 4: address
# 5: current PC - which will often be the same as address, but not when
-# 6: shared library name if the pc is in a shared lib
# we are browsing, or walking the stack.
+# 6: shared library name if the pc is in a shared lib
#
# ------------------------------------------------------------------
proc gdbtk_locate_main {} {
+ set result {}
set main_names [pref get gdb/main_names]
debug "Searching $main_names"
+
foreach main $main_names {
if {![catch {gdb_search functions $main -static 1}] \
&& ![catch {gdb_loc $main} linespec]} {
- return $linespec
+ set result $linespec
+ break
}
}
- if {![catch gdb_entry_point entry_point]
+ if {$result == {}
+ && ![catch gdb_entry_point entry_point]
&& ![catch {gdb_loc "*$entry_point"} linespec]} {
- return $linespec
+ set result $linespec
}
- return {}
+
+ # need to see if result is valid
+ lassign $result file func ffile line addr rest
+ if {$addr == 0x0 && $func == {}} { set result {} }
+
+ return $result
}
##############################################