Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/testsuite] Add xfail for failure to break on ppc printf
Date: Sat, 15 Aug 2026 13:20:15 +0200	[thread overview]
Message-ID: <f7dc8723-065d-4177-ba68-88db1ddaf229@suse.de> (raw)
In-Reply-To: <20260729144637.3123620-1-tdevries@suse.de>

On 7/29/26 4:46 PM, Tom de Vries wrote:
> 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).
> 

I had claude code review this.  It pointed that that the unsupported 
message  "inferior exited" was somewhat vague, so I changed that into 
"printf breakpoint didn't trigger".

I also noticed that in gdb.server/sysroot.exp the changes were done in a 
loop, so I should also add an if unsupported clause there.

Pushed with those changes.

Thanks,
- Tom

> Tested on ppc64le-linux and x86_64-linux.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29989
> ---
>   gdb/testsuite/gdb.base/annota1.exp   | 20 +++++++++++++
>   gdb/testsuite/gdb.base/annota3.exp   | 44 +++++++++++++++++++++-------
>   gdb/testsuite/gdb.server/sysroot.exp | 20 +++++++++++--
>   3 files changed, 72 insertions(+), 12 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
> index 35eaf26103e..ca3365500c0 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 "inferior exited"
> +    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..f8b65d776f6 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 "inferior exited"
> +    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..6a5d0b7c418 100644
> --- a/gdb/testsuite/gdb.server/sysroot.exp
> +++ b/gdb/testsuite/gdb.server/sysroot.exp
> @@ -88,7 +88,23 @@ 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"
> +	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)"
> +		}
> +	    }
> +	}
>       }
>   }
> 
> base-commit: 36af47b3a8348b9ff9c717100c44049c6f3d6315


  reply	other threads:[~2026-08-15 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29 14:46 Tom de Vries
2026-08-15 11:20 ` Tom de Vries [this message]
2026-08-17  6:16   ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7dc8723-065d-4177-ba68-88db1ddaf229@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox