Re: GDB shared library tracking with stap probes x _dl_debug_state
Luis Machado via Gdb <[email protected]>
| Newsgroups | gmane.comp.gdb.devel,gmane.comp.lib.glibc.alpha |
|---|---|
| Message-ID | <[email protected]> |
On 5/7/21 5:44 PM, Florian Weimer wrote:
> * Luis Machado via Libc-alpha:
>
>> That's all fine, but there is one small detail that doesn't work for
>> armhf, and that is discovering if we're dealing with a PC that is arm
>> mode or thumb mode.
>
> Is it possible to recognize Arm mode vs thumb mode based on the NOP
> encoding at the probe address?
>
If we know the instruction is a NOP, it might be possible. But the
function that checks this, arm_pc_is_thumb (...), is generic and gets
called to determine if arbitrary PC's are arm or thumb.
It would be somewhat hacky to do it this way. It would be more natural
to let arm_pc_is_thumb figure out symbols on its own without corner cases.
(gdb) maint info br
Num Type Disp Enb Address What
-1 shlib events keep n 0xb6fd7b5a inf 1
(gdb) show arm force-mode
The current execution mode assumed (even when symbols are available) is
"auto".
(gdb) x/i 0xb6fd7b5a
0xb6fd7b5a: ; <UNDEFINED> instruction: 0xf8dfbf00
(gdb) set arm force-mode thumb
(gdb) x/i 0xb6fd7b5a
0xb6fd7b5a: nop
>> 2 - Not stripping ld.so/glibc. I can't determine the impact of this
>> choice, but distros strip binaries for a reason. Having to carry all
>> symbols for a particular library may not be desirable.
>
> We are switching Fedora to not strip ld.so, primarily for introspection
> purposes in Systemtap.
>
> (In Fedora, we've preserved the symbol table for ages, to make valgrind
> work.)
That's good information, and a more reasonable approach to solve this
problem from GDB's point of view.
>
> Thanks,
> Florian
>