[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for ppc64le
authorTom de Vries <tdevries@suse.de>
Mon, 12 Sep 2022 08:05:18 +0000 (10:05 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 12 Sep 2022 08:05:18 +0000 (10:05 +0200)
In commit cd919f5533c ("[gdb/testsuite] Fix
gdb.dwarf2/dw2-dir-file-name.exp"), I made gdb.dwarf2/dw2-dir-file-name.exp
independent of prologue analyzers, using this change:
...
-       gdb_breakpoint $func
+       gdb_breakpoint *$func
...

That however caused a regression on ppc64le.  For PowerPC, as described in the
ELFv2 ABI, a function can have a global and local entry point.

Setting a breakpoint on *$func effectively creates a breakpoint for the global
entry point, so if the function is entered through the local entry point, the
breakpoint doesn't trigger.

Fix this by reverting commit cd919f5533c, and setting the breakpoint on
${func}_label instead.

Tested on x86_64-linux and ppc64le-linux.

gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
gdb/testsuite/lib/gdb.exp

index 08b5c645fa2f1caa2ccfc7d92d29cc6f13ea40b8..053f72295379e362c3ca10e3fbfa60ee2cce36c1 100644 (file)
@@ -450,20 +450,20 @@ proc test { func compdir filename } {
            error "not absolute"
        }
 
-       gdb_breakpoint *$func
+       gdb_breakpoint ${func}_label
        gdb_continue_to_breakpoint $func "$func \\(\\) at .*"
 
        gdb_test_no_output "set filename-display absolute"
        verbose -log "expect: ${absolute}"
-       gdb_test "frame" "#0  $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
+       gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
 
        gdb_test_no_output "set filename-display basename"
        verbose -log "expect: [file tail $filename]"
-       gdb_test "frame" "#0  $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
+       gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
 
        gdb_test_no_output "set filename-display relative"
        verbose -log "expect: $filename"
-       gdb_test "frame" "#0  $func \\(\\) at [string_to_regexp $filename]:999" "relative"
+       gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative"
     }
 }
 
index 17523f829964ac35e426b80d9457b13574152304..2f1147159adae5795d36d586d5af3573f8416881 100644 (file)
@@ -787,14 +787,9 @@ proc gdb_continue_to_breakpoint {name {location_pattern .*}} {
     global gdb_prompt
     set full_name "continue to breakpoint: $name"
 
-    set re_at_in " (at|in) "
-    if { [regexp $re_at_in $location_pattern] } {
-       set re_at_in " "
-    }
-
     set kfail_pattern "Process record does not support instruction 0xfae64 at.*"
     gdb_test_multiple "continue" $full_name {
-       -re "(?:Breakpoint|Temporary breakpoint) .*$re_at_in$location_pattern\r\n$gdb_prompt $" {
+       -re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" {
            pass $full_name
        }
        -re "\[\r\n\]*(?:$kfail_pattern)\[\r\n\]+$gdb_prompt $" {