[Bug 23946] New: Symbol name display when multiple symbol present at the same address

Bug ID 23946
Summary Symbol name display when multiple symbol present at the same address
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter tberghammer@google.com
Classification Unclassified

When the "Identical Code Folding" link time optimization is turned on then
several symbol (function) can have the same code address. In this case LLDB
displays one of the symbol names when displaying a backtrace or when displaying
some disassembly. It would be much nicer if we display all of the symbols
located at the given address to the user so he/she can understand what is
happening.

Test case (requires g++ and gold):

int foo1(int x) { return x + 1; }
int foo2(int x) { return x + 1; }
int main() { foo1(1); foo2(1); }

g++ -g -ffunction-sections -fuse-ld=gold -Wl,--icf -Wl,all main.cpp

./lldb a.out
(lldb) breakpoint set -n main
(lldb) process launch
(lldb) expression &foo1
(lldb) expression &foo2
// Verify they are at the same address
(lldb) disassemble -n foo1
(lldb) disassemble -n foo2
// In each disassemble instruction we should see the name of the correct
function