* [PATCH] [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le
@ 2022-11-24 12:45 Tom de Vries
2022-11-28 9:54 ` Tom de Vries
0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2022-11-24 12:45 UTC (permalink / raw)
To: gdb-patches; +Cc: Carl Love, Ulrich Weigand
With test-case gdb.base/msym-bp-shl.exp on powerpc64le-linux, I run into:
...
(gdb) PASS: gdb.base/msym-bp-shl.exp: debug=0: before run: break foo
info breakpoint^M
Num Type Disp Enb Address What^M
1 breakpoint keep y <MULTIPLE> ^M
1.1 y 0x00000000000008d4 <foo+12>^M
1.2 y 0x0000000000000a34 crti.S:88^M
(gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint
...
The problem is that the prologue skipper walks from foo@plt at 0xa28 to 0xa34:
...
0000000000000a28 <foo@plt>:
a28: c0 ff ff 4b b 9e8 <__glink_PLTresolve>
Disassembly of section .fini:
0000000000000a2c <_fini>:
a2c: 02 00 4c 3c addis r2,r12,2
a30: d4 74 42 38 addi r2,r2,29908
a34: a6 02 08 7c mflr r0
...
This is caused by ppc_elfv2_elf_make_msymbol_special which marks foo@plt as
having a local entry point, due incorrectly accessing an asymbol struct using
a (larger) elf_symbol_type.
Fix this by simply ignoring artificial symbols in
ppc_elfv2_elf_make_msymbol_special.
Tested on powerpc64le.
Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
Reviewed-By: Carl Love <cel@us.ibm.com>
Tested-By: Carl Love <cel@us.ibm.com>
PR tdep/29814
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29814
---
gdb/ppc-linux-tdep.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index cc5a26431ba..39d692b2764 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1632,6 +1632,11 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
static void
ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
{
+ if ((sym->flags & BSF_SYNTHETIC) != 0)
+ /* ELFv2 synthetic symbols (the PLT stubs and the __glink_PLTresolve
+ trampoline) do not have a local entry point. */
+ return;
+
elf_symbol_type *elf_sym = (elf_symbol_type *)sym;
/* If the symbol is marked as having a local entry point, set a target
base-commit: 8ee52bcf39e95abbc9cfffbb0afbb55be67e8c3d
--
2.35.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le
2022-11-24 12:45 [PATCH] [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le Tom de Vries
@ 2022-11-28 9:54 ` Tom de Vries
0 siblings, 0 replies; 2+ messages in thread
From: Tom de Vries @ 2022-11-28 9:54 UTC (permalink / raw)
To: gdb-patches; +Cc: Carl Love, Ulrich Weigand
On 11/24/22 13:45, Tom de Vries via Gdb-patches wrote:
> With test-case gdb.base/msym-bp-shl.exp on powerpc64le-linux, I run into:
> ...
> (gdb) PASS: gdb.base/msym-bp-shl.exp: debug=0: before run: break foo
> info breakpoint^M
> Num Type Disp Enb Address What^M
> 1 breakpoint keep y <MULTIPLE> ^M
> 1.1 y 0x00000000000008d4 <foo+12>^M
> 1.2 y 0x0000000000000a34 crti.S:88^M
> (gdb) FAIL: gdb.base/msym-bp-shl.exp: debug=0: before run: info breakpoint
> ...
>
> The problem is that the prologue skipper walks from foo@plt at 0xa28 to 0xa34:
> ...
> 0000000000000a28 <foo@plt>:
> a28: c0 ff ff 4b b 9e8 <__glink_PLTresolve>
>
> Disassembly of section .fini:
>
> 0000000000000a2c <_fini>:
> a2c: 02 00 4c 3c addis r2,r12,2
> a30: d4 74 42 38 addi r2,r2,29908
> a34: a6 02 08 7c mflr r0
> ...
>
> This is caused by ppc_elfv2_elf_make_msymbol_special which marks foo@plt as
> having a local entry point, due incorrectly accessing an asymbol struct using
> a (larger) elf_symbol_type.
>
> Fix this by simply ignoring artificial symbols in
> ppc_elfv2_elf_make_msymbol_special.
>
> Tested on powerpc64le.
>
No further comments, so committed.
Thanks,
- Tom
> Approved-By: Ulrich Weigand <uweigand@de.ibm.com>
> Reviewed-By: Carl Love <cel@us.ibm.com>
> Tested-By: Carl Love <cel@us.ibm.com>
> PR tdep/29814
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29814
> ---
> gdb/ppc-linux-tdep.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
> index cc5a26431ba..39d692b2764 100644
> --- a/gdb/ppc-linux-tdep.c
> +++ b/gdb/ppc-linux-tdep.c
> @@ -1632,6 +1632,11 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
> static void
> ppc_elfv2_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
> {
> + if ((sym->flags & BSF_SYNTHETIC) != 0)
> + /* ELFv2 synthetic symbols (the PLT stubs and the __glink_PLTresolve
> + trampoline) do not have a local entry point. */
> + return;
> +
> elf_symbol_type *elf_sym = (elf_symbol_type *)sym;
>
> /* If the symbol is marked as having a local entry point, set a target
>
> base-commit: 8ee52bcf39e95abbc9cfffbb0afbb55be67e8c3d
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-28 9:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-24 12:45 [PATCH] [gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le Tom de Vries
2022-11-28 9:54 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).