diff options
author | Pedro Alves <pedro@palves.net> | 2020-09-17 23:33:40 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2020-09-18 00:04:12 +0100 |
commit | 52bb090268881cfa1ab615273e281610935f2f95 (patch) | |
tree | 0848384d943da502513b5c9a3917c24de1a5e56b /gdb/testsuite | |
parent | 73e18ac9dab5b395fefa2034c7b9829425629b57 (diff) | |
download | gdb-52bb090268881cfa1ab615273e281610935f2f95.zip gdb-52bb090268881cfa1ab615273e281610935f2f95.tar.gz gdb-52bb090268881cfa1ab615273e281610935f2f95.tar.bz2 |
gdb.base/break.exp C++ify
Some adjustments to make gdb.base/break.exp work when compiled as a
C++ program. Passes cleanly with Clang++, but not with G++. The
latter puts a breakpoint at an unexpected line in one case. It seems
like a bug that gcc and g++ behave differently here.
gdb/testsuite/ChangeLog:
* gdb.base/break.exp (func): New. Use it throughout when
expecting a function name.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/break.exp | 50 |
2 files changed, 33 insertions, 22 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e83ec79..c7e2c4c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2020-09-17 Pedro Alves <pedro@palves.net> + * gdb.base/break.exp (func): New. Use it throughout when + expecting a function name. + +2020-09-17 Pedro Alves <pedro@palves.net> + * gdb.base/display.exp: Issue "set print asm-demangle on". 2020-09-17 Pedro Alves <pedro@palves.net> diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 8c7ce42..35813e3 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -121,16 +121,22 @@ set main_line $bp_location6 set bp_location7 [gdb_get_line_number "set breakpoint 7 here"] set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] +# In C++ mode, we see a full prototype; in C mode, we only see the +# function name, with no parameter info. +proc func {name} { + return "${name}(?:\(\[^\r\n\]*\))?" +} + gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile1:$bp_location8.* -\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:$bp_location7.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.* -\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.* -\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \ +\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$main_line.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func marker2] at .*$srcfile1:$bp_location8.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func factorial] at .*$srcfile:$bp_location7.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func main] at .*$srcfile:$bp_location2.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func multi_line_if_conditional] at .*$srcfile:$bp_location3.* +\[0-9\]+\[\t \]+breakpoint keep y.* in [func multi_line_while_conditional] at .*$srcfile:$bp_location4" \ "breakpoint info" # @@ -149,7 +155,7 @@ gdb_test_multiple "info break 2 4 6" "info break 2 4 6" { set see1 1 exp_continue } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in marker2 at \[^\r\n\]*" { + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { set see2 1 exp_continue } @@ -186,11 +192,11 @@ set see5 0 set see6 0 gdb_test_multiple "info break 3-5" "info break 3-5" { - -re "1\[\t \]+breakpoint *keep y.* in main at .*:$main_line\[^\r\n\]*" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { set see1 1 exp_continue } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in marker2 at \[^\r\n\]*" { + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { set see2 1 exp_continue } @@ -243,11 +249,11 @@ set see5 0 set see6 0 gdb_test_multiple "info break" "check disable with history values" { - -re "1\[\t \]+breakpoint *keep y.* in main at .*:$main_line\[^\r\n\]*" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { set see1 1 exp_continue } - -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in marker2 at \[^\r\n\]*" { + -re "2\[\t \]+breakpoint *keep n\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { set see2 1 exp_continue } @@ -289,11 +295,11 @@ set see5 0 set see6 0 gdb_test_multiple "info break" "check disable with convenience values" { - -re "1\[\t \]+breakpoint *keep y.* in main at .*:$main_line\[^\r\n\]*" { + -re "1\[\t \]+breakpoint *keep y.* in [func main] at .*:$main_line\[^\r\n\]*" { set see1 1 exp_continue } - -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in marker2 at \[^\r\n\]*" { + -re "2\[\t \]+breakpoint *keep y\[^\r\n\]* in [func marker2] at \[^\r\n\]*" { set see2 1 exp_continue } @@ -452,12 +458,12 @@ gdb_test "tbreak $srcfile:$bp_location11" "Temporary breakpoint.*at.* file .*$s # check to see what breakpoints are set (temporary this time) # gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:$bp_location7.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location1.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location6.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location2.*\[\r\n\] -\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$bp_location11.*" \ +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$main_line.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func factorial] at .*$srcfile:$bp_location7.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location1.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location6.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location2.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in [func main] at .*$srcfile:$bp_location11.*" \ "Temporary breakpoint info" @@ -606,7 +612,7 @@ gdb_test "break marker2" \ "set breakpoint on to-be-called function" gdb_test "print marker2(99)" \ - "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.*" \ + "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.[func marker2]. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.*" \ "hit breakpoint on called function" # As long as we're stopped (breakpointed) in a called function, |