aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorMichael Chastain <mec@google.com>2004-08-28 23:55:48 +0000
committerMichael Chastain <mec@google.com>2004-08-28 23:55:48 +0000
commit3e3ffd2b74c0321e887da2ca396070c6f61b0e1a (patch)
treef8259011df30ae915d6c1bb2f54e1c5a51154317 /gdb/testsuite/lib
parent0873df2aec48685715d2c5041c1f6f4ed43976c1 (diff)
downloadgdb-3e3ffd2b74c0321e887da2ca396070c6f61b0e1a.zip
gdb-3e3ffd2b74c0321e887da2ca396070c6f61b0e1a.tar.gz
gdb-3e3ffd2b74c0321e887da2ca396070c6f61b0e1a.tar.bz2
2004-08-27 Michael Chastain <mec.gnu@mindspring.com>
With code from Manoj Iyer <manjo@austin.ibm.com>: * lib/gdb.exp (gdb_file_cmd): Return more information in the return value. Add an arm for "no debugging symbols found". Change a stray "error" to "perror". (gdb_run_cmd): Adapt to new return value. * gdb.base/remote.exp: Adapt to new return value. * gdb.gdb/complaints.exp: Likewise. * gdb.gdb/observer.exp: Likewise. * gdb.gdb/selftest.exp: Likewise. * gdb.gdb/xfullpath.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/gdb.exp79
1 files changed, 50 insertions, 29 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6495059..433015f 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -180,7 +180,8 @@ proc gdb_run_cmd {args} {
if [target_info exists gdb,do_reload_on_run] {
# Specifying no file, defaults to the executable
# currently being debugged.
- if { [gdb_load ""] < 0 } {
+ set status [gdb_load ""]
+ if { [lindex $status 0] != "" } {
return;
}
send_gdb "continue\n";
@@ -225,7 +226,8 @@ proc gdb_run_cmd {args} {
send_gdb "y\n"
}
-re "The program is not being run.*$gdb_prompt $" {
- if { [gdb_load ""] < 0 } {
+ set status [gdb_load ""]
+ if { [lindex $status 0] != ""] } {
return;
}
send_gdb "jump *$start\n";
@@ -247,7 +249,8 @@ proc gdb_run_cmd {args} {
}
if [target_info exists gdb,do_reload_on_run] {
- if { [gdb_load ""] < 0 } {
+ set status [gdb_load ""]
+ if { [lindex $status 0] != "" } {
return;
}
}
@@ -953,35 +956,49 @@ proc default_gdb_exit {} {
unset gdb_spawn_id
}
+# Load a file into the debugger.
+# The return value is a list with the following information:
#
-# load a file into the debugger.
-# return a -1 if anything goes wrong.
+# { message word ... }
+#
+# MESSAGE has the following values:
+#
+# "" file was loaded successfully
+# "..." file was not loaded successfully.
+# A perror has been generated with MESSAGE.
+#
+# If the MESSAGE is "", then there is an optional set of words.
+# The words may be:
#
+# nodebug this file does not contain debug information
+#
+# TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might
+# be able to use this if they can get more information
+# in the return value.
+
proc gdb_file_cmd { arg } {
+ global gdb_prompt
global verbose
- global loadpath
- global loadfile
global GDB
- global gdb_prompt
- upvar timeout timeout
if [is_remote host] {
- set arg [remote_download host $arg];
+ set arg [remote_download host $arg]
if { $arg == "" } {
- error "download failed"
- return -1;
+ set message "download failed"
+ perror $message
+ return { $message }
}
}
send_gdb "file $arg\n"
gdb_expect 120 {
+ -re "Reading symbols from.*no debugging symbols found.*done.*$gdb_prompt $" {
+ verbose "\t\tLoaded $arg into the $GDB with no debugging symbols"
+ return { "" nodebug }
+ }
-re "Reading symbols from.*done.*$gdb_prompt $" {
verbose "\t\tLoaded $arg into the $GDB"
- return 0
- }
- -re "has no symbol-table.*$gdb_prompt $" {
- perror "$arg wasn't compiled with \"-g\""
- return -1
+ return { "" }
}
-re "A program is being debugged already.*Kill it.*y or n. $" {
send_gdb "y\n"
@@ -993,32 +1010,37 @@ proc gdb_file_cmd { arg } {
gdb_expect 120 {
-re "Reading symbols from.*done.*$gdb_prompt $" {
verbose "\t\tLoaded $arg with new symbol table into $GDB"
- return 0
+ return { "" }
}
timeout {
- perror "(timeout) Couldn't load $arg, other program already loaded."
- return -1
+ set message "(timeout) Couldn't load $arg, other program already loaded."
+ perror $message
+ return { $message }
}
}
}
-re "No such file or directory.*$gdb_prompt $" {
- perror "($arg) No such file or directory\n"
- return -1
+ set message "($arg) No such file or directory"
+ perror $message
+ return { $message }
}
-re "$gdb_prompt $" {
- perror "couldn't load $arg into $GDB."
- return -1
+ set message "couldn't load $arg into $GDB."
+ perror $message
+ return { $message }
}
timeout {
- perror "couldn't load $arg into $GDB (timed out)."
- return -1
+ set message "couldn't load $arg into $GDB (timed out)."
+ perror $message
+ return { $message }
}
eof {
# This is an attempt to detect a core dump, but seems not to
# work. Perhaps we need to match .* followed by eof, in which
# gdb_expect does not seem to have a way to do that.
- perror "couldn't load $arg into $GDB (end of file)."
- return -1
+ set message "couldn't load $arg into $GDB (end of file)."
+ perror $message
+ return { $message }
}
}
}
@@ -1633,7 +1655,6 @@ proc gdb_exit { } {
#
# gdb_load -- load a file into the debugger.
-# return a -1 if anything goes wrong.
#
proc gdb_load { arg } {
return [gdb_file_cmd $arg]