[binutils-gdb/gdb-18-branch] [gdb/testsuite] Add xfail for failure to break on ppc printf
Tom de Vries via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ff4fd46f4d974ee525f7a3b514833ba38b02dd3f commit ff4fd46f4d974ee525f7a3b514833ba38b02dd3f Author: Tom de Vries <[email protected]> Date: Mon Aug 17 08:14:53 2026 +0200 [gdb/testsuite] Add xfail for failure to break on ppc printf With test-case gdb.server/sysroot.exp, we run into: ... (gdb) break printf^M Breakpoint 2 at 0x7ffff7c2045c^M (gdb) continue^M Continuing.^M [Inferior 1 (process 469972) exited normally]^M (gdb) FAIL: $exp: sysroot=local: continue to printf (the program exited) ... The problem is that while breakpoint is indeed set on printf: ... (gdb) b printf Breakpoint 2 at 0x7ffff7c2045c (gdb) disassemble 0x7ffff7c2045c Dump of assembler code for function printf@@GLIBC_2.17: ... the function that is called instead is __printfieee128. Glibc commit f05ab7c4a9 ("ldbl-128ibm-compat: Add local aliases for printf family symbols") should fix this, but that's available starting version 2.43. Add an xfail for older glibc (without backport of that patch). Tested on ppc64le-linux and x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29989 (cherry picked from commit 3cdb0313346fa63a028de9e7c2129182cd36ad2e) Diff: --- gdb/testsuite/gdb.base/annota1.exp | 20 ++++++++++++++++ gdb/testsuite/gdb.base/annota3.exp | 44 ++++++++++++++++++++++++++++-------- gdb/testsuite/gdb.server/sysroot.exp | 27 ++++++++++++++++++++-- 3 files changed, 79 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 35eaf26103e..260a6ef7218 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -262,13 +262,33 @@ set pat_begin "\r\n\032\032post-prompt\r\nContinuing.\r\n\r\n\032\032starting\r\ set pat_adjust "warning: Breakpoint 3 address previously adjusted from $hex to $hex.\r\n" set pat_end "\r\n\032\032breakpoint 3\r\n\r\nBreakpoint 3(\\.$decimal)?, \r\n\032\032frame-begin 0 $hex\r\n\r\n(\032\032frame-address\r\n$hex\r\n\032\032frame-address-end\r\n in \r\n)*.*\032\032frame-function-name\r\n.*printf(@.*)?\r\n\032\032frame-args\r\n.*\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" +set unsupported 0 gdb_test_multiple "continue" "continue to printf" { -re "${pat_begin}($pat_adjust)?$pat_end" { pass $gdb_test_name } + -re $inferior_exited_re.*\r\n$gdb_prompt$ { + if {[istarget "powerpc64*-linux*"]} { + # On ppc64, glibc without commit f05ab7c4a9 + # ("ldbl-128ibm-compat: Add local aliases for printf + # family symbols") may have two printf breakpoint + # locations, but export only one of them. Consequently, + # gdb sets a breakpoint on only one location, and there's + # no guarantee that the breakpoint will trigger. + xfail "$gdb_test_name (the program exited)" + } else { + fail "$gdb_test_name (the program exited)" + } + set unsupported 1 + } -re ".*$gdb_prompt$" { fail $gdb_test_name } } +if {$unsupported} { + unsupported "printf breakpoint didn't trigger" + return +} + set pac [string_to_regexp {[PAC]}] # diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp index 8a69350f1d5..73de730f51c 100644 --- a/gdb/testsuite/gdb.base/annota3.exp +++ b/gdb/testsuite/gdb.base/annota3.exp @@ -163,16 +163,40 @@ gdb_test -prompt "$gdb_prompt$" "break printf" \ # # get to printf # -send_gdb "continue\n" -gdb_expect_list "continue to printf" "$gdb_prompt$" [subst_vars { - "\r\n\032\032post-prompt\r\n" - "Continuing.\r\n" - "\r\n\032\032starting\r\n" - "\r\n\032\032breakpoint 3\r\n" - "\r\n" - "Breakpoint 3(\\.$decimal)?, \[^\r\n\]*\r\n" - "\r\n\032\032stopped\r\n" -}] +set re_pass \ + [string cat \ + "\r\n\032\032post-prompt\r\n" \ + "Continuing.\r\n" \ + "\r\n\032\032starting\r\n" \ + "\r\n\032\032breakpoint 3\r\n" \ + "\r\n" \ + [subst_vars {Breakpoint 3(\.$decimal)?, [^\r\n]*\r\n}] \ + ".*" \ + "\r\n\032\032stopped"] +set unsupported 0 +gdb_test_multiple "continue" "continue to printf" -prompt "$gdb_prompt$" { + -re -wrap $re_pass { + pass $gdb_test_name + } + -re -wrap $inferior_exited_re.* { + if {[istarget "powerpc64*-linux*"]} { + # On ppc64, glibc without commit f05ab7c4a9 + # ("ldbl-128ibm-compat: Add local aliases for printf + # family symbols") may have two printf breakpoint + # locations, but export only one of them. Consequently, + # gdb sets a breakpoint on only one location, and there's + # no guarantee that the breakpoint will trigger. + xfail "$gdb_test_name (the program exited)" + } else { + fail "$gdb_test_name (the program exited)" + } + set unsupported 1 + } +} +if {$unsupported} { + unsupported "printf breakpoint didn't trigger" + return +} send_gdb "backtrace\n" gdb_expect_list "backtrace from shlibrary" "$gdb_prompt$" { diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp index 7e4a796e879..df7220076e3 100644 --- a/gdb/testsuite/gdb.server/sysroot.exp +++ b/gdb/testsuite/gdb.server/sysroot.exp @@ -88,7 +88,30 @@ foreach_with_prefix sysroot $modes { # Test that we can stop inside a library. gdb_breakpoint printf - gdb_test "continue" "Breakpoint $decimal.* (__|___ieee128_)?printf.*" \ - "continue to printf" + set unsupported 0 + gdb_test_multiple "continue" "continue to printf" { + -re -wrap "Breakpoint $decimal.* (__|___ieee128_)?printf.*" { + pass $gdb_test_name + } + -re -wrap $inferior_exited_re\[^\r\n\]+ { + if {[istarget "powerpc64*-linux*"]} { + # On ppc64, glibc without commit f05ab7c4a9 + # ("ldbl-128ibm-compat: Add local aliases for printf + # family symbols") may have two printf breakpoint + # locations, but export only one of them. Consequently, + # gdb sets a breakpoint on only one location, and there's + # no guarantee that the breakpoint will trigger. + xfail "$gdb_test_name (the program exited)" + } else { + fail "$gdb_test_name (the program exited)" + } + set unsupported 1 + } + } + } + + if {$unsupported} { + unsupported "printf breakpoint didn't trigger" + return } }