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/tui] Fix gdb.tui/list-before.exp on ppc64-linux
Date: Wed, 19 Aug 2026 16:42:10 +0200	[thread overview]
Message-ID: <d5311e93-2227-4c0d-8f5b-2f0f7b4d4bfc@suse.de> (raw)
In-Reply-To: <20260801122832.3152974-1-tdevries@suse.de>

On 8/1/26 2:28 PM, Tom de Vries wrote:
> On ppc64-linux, with test-case gdb.tui/list-before.exp I run into:
> ...
> (gdb) tui enable^M
>    ...
> (gdb) Screen Dump (size 80 columns x 24 rows, cursor at column 6, row 16):
>      0 +------------------------------------------------------------------------------+
>      1 |                                                                              |
>      2 |                                                                              |
>      3 |                                                                              |
>      4 |                                                                              |
>      5 |                                                                              |
>      6 |                                                                              |
>      7 |                           [ No Source Available ]                            |
>      8 |                                                                              |
>      9 |                                                                              |
>     10 |                                                                              |
>     11 |                                                                              |
>     12 |                                                                              |
>     13 |                                                                              |
>     14 +------------------------------------------------------------------------------+
>     15 exec No process (src) In:                                          L??   PC: ??
>     16 (gdb)
>     17
>     18
>     19
>     20
>     21
>     22
>     23
> FAIL: $exp: initial source listing
> ...
> 
> The problem is in tui_get_begin_asm_address, where we look up the minimal
> symbol for main, and use its address.
> 
> With the v1 ABI, we don't get the address of main in the .text section:
> ...
> 00000000000008b4 <.main>:
>   8b4:   fb e1 ff f8     std     r31,-8(r1)
>   8b8:   f8 21 ff c1     stdu    r1,-64(r1)
>   8bc:   7c 3f 0b 78     mr      r31,r1
> ...
> but the address of the descriptor of main in the .opd section:
> ...
> 000000000001fee8 <main>:
>     1fee8:       00 00 00 00     .long 0x0
>     1feec:       00 00 08 b4     .long 0x8b4
>     1fef0:       00 00 00 00     .long 0x0
>     1fef4:       00 02 7f 00     .long 0x27f00
> ...
> 
> Fix this by using gdbarch_convert_from_func_ptr_addr, similar to how that's
> used in create_internal_breakpoint.
> 

I'm pushing this shortly.

Thanks,
- Tom

> Tested on ppc64-linux and x86_64-linux.
> ---
>   gdb/tui/tui-disasm.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
> index 5c68312a91b..68a5c425934 100644
> --- a/gdb/tui/tui-disasm.c
> +++ b/gdb/tui/tui-disasm.c
> @@ -409,7 +409,11 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
>   	  bound_minimal_symbol main_symbol
>   	    = lookup_minimal_symbol (current_program_space, main_name ());
>   	  if (main_symbol.minsym != nullptr)
> -	    addr = main_symbol.value_address ();
> +	    {
> +	      addr = main_symbol.value_address ();
> +	      addr = gdbarch_convert_from_func_ptr_addr
> +		       (gdbarch, addr, current_inferior ()->top_target ());
> +	    }
>   	}
>       }
>     else				/* The target is executing.  */
> 
> base-commit: 5b805c95e9399e35f7bc895ec5b67aabdbc6ce41


      reply	other threads:[~2026-08-19 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01 12:28 Tom de Vries
2026-08-19 14:42 ` Tom de Vries [this message]

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=d5311e93-2227-4c0d-8f5b-2f0f7b4d4bfc@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