Background
Our binary has multiple global variables with the same basename but in different namespaces. (Eg., lld::macho::symtab vs lld::elf::symtab, lld::macho::in vs lld::elf::in, ...)
Repro:
Run the LLD linker under LLDB: (best to use MachO port to demonstrate this bug):
Expected:
Since the code that the breakpoint stopped on referred to the variable as simply symtab, I would have expected LLDB's print to allow me to also use symtab.
What actually happened:
LLDB always picked the globals from lld::elf .
(presumably because it's alphabetically before ::macho)
(Tested this with GDB and it didn't have this issue)
Background Our binary has multiple global variables with the same basename but in different namespaces. (Eg., lld::macho::symtab vs lld::elf::symtab, lld::macho::in vs lld::elf::in, ...)
Repro: Run the LLD linker under LLDB: (best to use MachO port to demonstrate this bug):
lldb -- ld64.lld.darwninnew <... rest of args>
Set a breakpoint anywhere - but for best effect, here: https://github.com/llvm/llvm-project/blob/2782cb8da0b3c180fa7c8627cb255a026f3d25a2/lld/MachO/Driver.cpp#L1141
(ie., right after
symtab
is set)Try and print
symtab
orin.got
:Expected: Since the code that the breakpoint stopped on referred to the variable as simply
symtab
, I would have expected LLDB's print to allow me to also usesymtab
.What actually happened: LLDB always picked the globals from lld::elf . (presumably because it's alphabetically before ::macho)
(Tested this with GDB and it didn't have this issue)