From: Keith Seitz Date: Fri, 9 Mar 2012 04:38:53 +0000 (+0000) Subject: * lib/gdb.exp (gdb_get_line_number): Throw an X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0d7941a9be533b6a7c3d05c06f74dfb74d3ec561;p=binutils-gdb.git * 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. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fa2363e96b4..16a32e48dac 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-03-08 Keith Seitz + + * 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. + 2012-03-08 Yao Qi Pedro Alves diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 54cbae184dd..71eb3a6348b 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -115,7 +115,6 @@ gdb_test "break multi_line_while_conditional" \ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 diff --git a/gdb/testsuite/gdb.base/hbreak2.exp b/gdb/testsuite/gdb.base/hbreak2.exp index c4a18cdeb0f..7f52cd36334 100644 --- a/gdb/testsuite/gdb.base/hbreak2.exp +++ b/gdb/testsuite/gdb.base/hbreak2.exp @@ -130,7 +130,6 @@ gdb_test "hbreak multi_line_while_conditional" \ "Hardware assisted breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "hardware breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp index 30ed7af2603..bd60c70a2ff 100644 --- a/gdb/testsuite/gdb.base/sepdebug.exp +++ b/gdb/testsuite/gdb.base/sepdebug.exp @@ -150,7 +150,6 @@ gdb_test "break multi_line_while_conditional" \ "Breakpoint.*at.* file .*$srcfile, line $bp_location4\\." \ "breakpoint at start of multi line while conditional" -set bp_location5 [gdb_get_line_number "set breakpoint 5 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set main_line $bp_location6 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 7a6d7e71d68..7287ed3257a 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