[gdb/testsuite] Fix gdb.ada/operator_bp.exp breakpoint location FAILs
authorTom de Vries <tdevries@suse.de>
Fri, 1 May 2020 15:57:56 +0000 (17:57 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 1 May 2020 15:57:56 +0000 (17:57 +0200)
When running test-case gdb.ada/operator_bp.exp with gcc-10, I run into:
...
FAIL: gdb.ada/operator_bp.exp: break "+"
FAIL: gdb.ada/operator_bp.exp: break "-"
FAIL: gdb.ada/operator_bp.exp: break "<"
FAIL: gdb.ada/operator_bp.exp: break "<="
FAIL: gdb.ada/operator_bp.exp: break ">"
FAIL: gdb.ada/operator_bp.exp: break ">="
FAIL: gdb.ada/operator_bp.exp: break "="
FAIL: gdb.ada/operator_bp.exp: break "and"
FAIL: gdb.ada/operator_bp.exp: break "or"
FAIL: gdb.ada/operator_bp.exp: break "xor"
FAIL: gdb.ada/operator_bp.exp: break "not"
...

The first FAIL is because two breakpoint locations are expected, but there are
more than 2:
...
(gdb) break "+"
Breakpoint 2 at 0x402c3c: "+". (6 locations)
(gdb) info break
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>
2.1                         y   0x0000000000402c3c in ops."+"
                                                   at operator_bp/ops.adb:25
2.2                         y   0x0000000000402e5b in ops."+"
                                                   at operator_bp/ops.adb:119
2.3                         y   0x0000000000414207 in
  system.storage_elements."+" at s-stoele.adb:82
2.4                         y   0x0000000000414404 in
  system.storage_elements."+" at s-stoele.adb:87
2.5                         y   0x0000000000414413 in
  system.storage_elements."+" at s-stoele.adb:87
2.6                         y   0x0000000000414430 in
  system.storage_elements."+" at s-stoele.adb:81
...

This can be traced back to a extra debug info in the executable:
...
$ readelf -w ops_test | grep system__storage_elements__Oadd
    <28104>   DW_AT_name        : system__storage_elements__Oadd__2
    <2812e>   DW_AT_name        : system__storage_elements__Oadd
...

Fix the FAILs by allowing more than the required amount of breakpoint
locations.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-01  Tom de Vries  <tdevries@suse.de>

* gdb.ada/operator_bp.exp: Allow more than required amount of
breakpoint.

gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/operator_bp.exp

index 210499af06d4a983c4d1788c284c406ca0623c55..737caffa0ea1c463eee22240522f53c699ab34b2 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-01  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.ada/operator_bp.exp: Allow more than required amount of
+       breakpoint.
+
 2020-05-01  Tom de Vries  <tdevries@suse.de>
 
        * gdb.reverse/until-reverse.c (main): Fix Wunused-result warning.
index 283d76a37f1dd4053b8e45855102e7aeaf547649..c882c94f12e0408f5773ff62bd63a510fb3b78b2 100644 (file)
@@ -33,16 +33,22 @@ runto "ops_test.adb:$bp_location"
 
 # Set breakpoints for all operators, using just the operator name in quotes.
 
+set bp_re "Breakpoint $decimal at $hex"
 foreach op { "+" "-" } {
     set op_re [string_to_regexp $op]
-    gdb_test "break \"$op\"" \
-             "Breakpoint $decimal at $hex: \"$op_re\"\. \\(2 locations\\)"
+    gdb_test "break \"$op\"" "$bp_re: \"$op_re\"\. \\($decimal locations\\).*"
 }
 
 foreach op { "*" "/" "mod" "rem" "**" "<" "<=" ">" ">=" "=" "and" "or" "xor" "&" "abs" "not"} {
     set op_re [string_to_regexp $op]
-    gdb_test "break \"$op\"" \
-             "Breakpoint $decimal at $hex: file .*ops.adb, line $decimal."
+    gdb_test_multiple "break \"$op\"" "" {
+       -re -wrap "$bp_re: file .*ops.adb, line $decimal." {
+           pass $gdb_test_name
+       }
+       -re -wrap "$bp_re: \"$op_re\"\. \\($decimal locations\\).*" {
+           pass $gdb_test_name
+       }
+    }
 }
 
 # Make sure we stop correctly in each operator function.
This page took 0.032696 seconds and 4 git commands to generate.