Bug 25152 - add-symbol-file -s adds symbols that were not requested
Summary: add-symbol-file -s adds symbols that were not requested
Status: UNCONFIRMED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-31 09:55 UTC by Ilya Leoshkevich
Modified: 2019-10-31 09:55 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Leoshkevich 2019-10-31 09:55:47 UTC
I'm debugging a kernel module with gdb. For that I'm using a modified
lx-symbols script that tells gdb addresses of all loadable sections
using the following command:

(gdb) add-symbol-file arch/s390/lib/test_unwind.ko 0x3ff8005e104 \
                      -s .note.gnu.build-id 0x3ff8005f000 \
                      -s .note.Linux 0x3ff8005f024 \
                      -s .text 0x3ff8005e108 \
                      -s .text.unlikely 0x3ff8005e400 \
                      -s .rodata 0x3ff8005f03c \
                      -s .rodata.str1.2 0x3ff8005f04e \
                      -s __mcount_loc 0x3ff8005f640 \
                      -s .gnu.linkonce.this_module 0x3ff80060000 \
                      -s .symtab 0x3ff80058000 \
                      -s .strtab 0x3ff800588a0

In general this works great, but it has a nasty side-effect of adding
unwanted symbols:

(gdb) bt
#0  __unwind_start (state=0x3e000483860, task=0x0 <__UNIQUE_ID_license22>, regs=0x0 <__UNIQUE_ID_license22>, sp=0) at arch/s390/kernel/unwind_bc.c:114

(gdb) info symbol 0x0
__UNIQUE_ID_license22 in section .modinfo of arch/s390/lib/test_unwind.ko

Note that I never requested symbols from .modinfo section. This does not
happen if I remove some random unrelated sections from the command:

(gdb) add-symbol-file arch/s390/lib/test_unwind.ko 0x3ff8005e104 \
                      -s .text 0x3ff8005e108 \
                      -s .text.unlikely 0x3ff8005e400

(gdb) bt
#0  __unwind_start (state=0x3e000483860, task=0x0, regs=0x0, sp=0) at s390/kernel/unwind_bc.c:114