aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2012-03-09 04:38:53 +0000
committerKeith Seitz <keiths@redhat.com>2012-03-09 04:38:53 +0000
commit0d7941a9be533b6a7c3d05c06f74dfb74d3ec561 (patch)
tree34ac60a332fba35452554f95140b0678ff8462c9 /gdb/testsuite/lib/gdb.exp
parentf4647387fe3182beb6a30539d4339b85a48fc14e (diff)
downloadgdb-0d7941a9be533b6a7c3d05c06f74dfb74d3ec561.zip
gdb-0d7941a9be533b6a7c3d05c06f74dfb74d3ec561.tar.gz
gdb-0d7941a9be533b6a7c3d05c06f74dfb74d3ec561.tar.bz2
* lib/gdb.exp (gdb_get_line_number): Throw an
error instead of returning -1. * gdb.base/break.exp: Remove unused variable bp_location5. * gdb.base/hbreak2.exp: Likewise. * gdb.base/sepdebug.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 7a6d7e7..7287ed3 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3243,7 +3243,7 @@ proc setup_kfail_for_target { PR target } {
# gdb_get_line_number TEXT [FILE]
#
# Search the source file FILE, and return the line number of the
-# first line containing TEXT. If no match is found, return -1.
+# first line containing TEXT. If no match is found, an error is thrown.
#
# TEXT is a string literal, not a regular expression.
#
@@ -3316,15 +3316,13 @@ proc gdb_get_line_number { text { file "" } } {
}
if { [ catch { set fd [open "$file"] } message ] } then {
- perror "$message"
- return -1
+ error "$message"
}
set found -1
for { set line 1 } { 1 } { incr line } {
if { [ catch { set nchar [gets "$fd" body] } message ] } then {
- perror "$message"
- return -1
+ error "$message"
}
if { $nchar < 0 } then {
break
@@ -3336,8 +3334,11 @@ proc gdb_get_line_number { text { file "" } } {
}
if { [ catch { close "$fd" } message ] } then {
- perror "$message"
- return -1
+ error "$message"
+ }
+
+ if {$found == -1} {
+ error "undefined tag \"$text\""
}
return $found