[binutils-gdb] [gdb/testsuite] Fix _selftest_setup on ppc64le-linux

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=9d7cee1b8972dd9c77dc556cc193375db9f2570c

commit 9d7cee1b8972dd9c77dc556cc193375db9f2570c
Author: Tom de Vries <[email protected]>
Date:   Fri Aug 14 13:07:40 2026 +0200

    [gdb/testsuite] Fix _selftest_setup on ppc64le-linux
    
    On ppc64le-linux, with gcc 7.5.0 and an O0 gdb build and test-case
    gdb.gdb/python-helper.exp, I get:
    ...
    (gdb) run ...
      ...
    Breakpoint 1, main (argc=12, argv=0x7fffffffea78) at .../gdb.c:30^M
    30        gdb_assert (is_main_thread ());^M
    (gdb) PASS: $exp: run until breakpoint at main
    ...
    
    But with an O2 gdb build, I run into:
    ...
    (gdb) run ...
      ...
    Breakpoint 1, 0x000000001003b438 in main (argc=12, argv=0x7fffffffea78) at \
      .../gdb.c:25
    25      {
    (gdb) FAIL: $exp: run until breakpoint at main
    ...
    
    The breakpoint is indeed set at address 0x1003b438:
    ...
    (gdb) break main^M
    Breakpoint 1 at 0x1003b438: file /space/vries/gdb/src/gdb/gdb.c, line 25.^M
    ...
    which is the local entry point:
    ...
    (gdb) disassemble main
    Dump of assembler code for function main(int, char**):
       0x000000001003b430 <+0>:     lis     r2,4606
       0x000000001003b434 <+4>:     addi    r2,r2,28416
       0x000000001003b438 <+8>:     mflr    r0
    ...
    
    And indeed, at that address, there's no "recommended breakpoint location":
    ...
    gdb.c:
    File name                Line number    Starting address    View    Stmt
    gdb.c                             25          0x1003b430               x
    gdb.c                             30          0x1003b454               x
    gdb.c                             37          0x1003b464               x
    ...
    
    So gdb behaves as expected.
    
    Fix this by updating the pass regexp to allow this type of gdb output.
    
    This fixes both test-case gdb.gdb/python-helper.exp and gdb.gdb/selftest.exp.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34463

Diff:
---
 gdb/testsuite/lib/selftest-support.exp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp
index 8d402288c51..bcfa99e8f34 100644
--- a/gdb/testsuite/lib/selftest-support.exp
+++ b/gdb/testsuite/lib/selftest-support.exp
@@ -163,7 +163,8 @@ proc _selftest_setup { } {
 	[multi_line \
 	     "Starting program: $re_hs" \
 	     ".*" \
-	     [string cat "Breakpoint $::decimal, $function $re_args at" \
+	     [string cat \
+		  "Breakpoint $::decimal,( $::hex in)? $function $re_args at" \
 		  " ${re_hs}gdb.c:$re_hs"] \
 	     ".*"]
     set re_xfail \
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.