[gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le
authorTom de Vries <tdevries@suse.de>
Mon, 28 Nov 2022 09:50:03 +0000 (10:50 +0100)
committerTom de Vries <tdevries@suse.de>
Mon, 28 Nov 2022 09:50:03 +0000 (10:50 +0100)
commit2650ea9730e31fc5c9111afc1a689dbca76707f5
tree56579c20f4eddbcc5089f8bbf4a69896bde6d91f
parentb8d7a9572d7e934be23f3b7ef74880e56957c233
[gdb/tdep] Fix gdb.base/msym-bp-shl.exp for ppc64le

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 to 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