diff options
Diffstat (limited to 'gdb/testsuite/gdb.base/shreloc.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/shreloc.exp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp index 4c92205..ce5c324 100644 --- a/gdb/testsuite/gdb.base/shreloc.exp +++ b/gdb/testsuite/gdb.base/shreloc.exp @@ -91,29 +91,25 @@ if ![runto_main] then { } proc get_var_address { var } { - global gdb_prompt hex - - send_gdb "print &${var}\n" - # Match output like: - # $1 = (int *) 0x0 - # $5 = (int (*)()) 0 - # $6 = (int (*)()) 0x24 <function_bar> - gdb_expect { - -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" + global gdb_prompt hex + + # Match output like: + # $1 = (int *) 0x0 + # $5 = (int (*)()) 0 + # $6 = (int (*)()) 0x24 <function_bar> + + gdb_test_multiple "print &${var}" "get address of ${var}" { + -re "\\\$\[0-9\]+ = \\(.*\\) (0|$hex)( <${var}>)?\[\r\n\]+${gdb_prompt} $" { - pass "get address of ${var}" - if { $expect_out(1,string) == "0" } { - return "0x0" - } else { - return $expect_out(1,string) - } + pass "get address of ${var}" + if { $expect_out(1,string) == "0" } { + return "0x0" + } else { + return $expect_out(1,string) + } } - -re "${gdb_prompt} $" - { fail "get address of ${var} (unknown output)" } - timeout - { fail "get address of ${var} (timeout)" } - } - return "" + } + return "" } # @@ -159,10 +155,8 @@ proc send_gdb_discard { command } { global gdb_prompt - send_gdb "${command}\n" - # Discard output - gdb_expect { + gdb_test_multiple "${command}" "${command}" { -re ".*\[\r\n]+${gdb_prompt} $" { return 1 } |