diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/lib/dwarf.exp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index 3d833e5..b5474ca 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -391,10 +391,14 @@ proc function_range { func src {options {debug}} } { } # Compute the size of the last instruction. - if { $func_length == 0 } then { - set func_pattern "$func" - } else { - set func_pattern "$func\\+$func_length" + # For C++, GDB appends arguments to the names of functions if they don't + # have a linkage name. For example, asking gdb to disassemble a C++ main + # will print the function name as main() or main(int argc, char **argv). + # Take this into account by optionally allowing an argument list after + # the function name. + set func_pattern "$func\(\?\:\\(\.\*\\)\)?" + if { $func_length != 0 } { + set func_pattern "$func_pattern\\+$func_length" } set test "x/2i $func+$func_length" gdb_test_multiple $test $test { |