[lldb-dev] sharing code between lldb and AddressSanitizer

Greg Clayton gclayton at apple.com
Mon Mar 26 19:42:18 PDT 2012


Dmitry, 

I made a few fixes for the ELF symbol file reader where we now recognize mangled names and the symbols will now show up correctly demangled. I also fixed a few issues with the DWARF parser where we weren't using the dwarf section file size (we were using the vm size). I also fixed the sections that are registered to not have a VM size if they won't ever be loaded by the program. This means we won't end up with overlapping sections. The current LLDB was incorrectly giving the ".comment", all ".debug", and the ".shstrtab", ".symtab" and ".strtab" sections valid addresses that would be resolved when the shared library was loaded. To see this we can see the section list for a.out:

% lldb a.out 
Current executable set to 'a.out' (x86_64).
(lldb) image dump sections 
Dumping sections for 1 modules.
Sections for '/private/tmp/lookup/a.out' (x86_64):
  SectID     Type             File Address                             File Off.  File Size  Flags      Section Name
  ---------- ---------------- ---------------------------------------  ---------- ---------- ---------- ----------------------------
  0x00000001 regular                                                   0x00000000 0x00000000 0x00000000 a.out.
  0x00000002 regular          [0x0000000000000238-0x0000000000000254)  0x00000238 0x0000001c 0x00000002 a.out..interp
  0x00000003 regular          [0x0000000000000254-0x0000000000000274)  0x00000254 0x00000020 0x00000002 a.out..note.ABI-tag
  0x00000004 regular          [0x0000000000000274-0x0000000000000298)  0x00000274 0x00000024 0x00000002 a.out..note.gnu.build-id
  0x00000005 regular          [0x0000000000000298-0x0000000000000528)  0x00000298 0x00000290 0x00000002 a.out..hash
  0x00000006 regular          [0x0000000000000528-0x0000000000000584)  0x00000528 0x0000005c 0x00000002 a.out..gnu.hash
  0x00000007 regular          [0x0000000000000588-0x0000000000000e70)  0x00000588 0x000008e8 0x00000002 a.out..dynsym
  0x00000008 regular          [0x0000000000000e70-0x0000000000001973)  0x00000e70 0x00000b03 0x00000002 a.out..dynstr
  0x00000009 regular          [0x0000000000001974-0x0000000000001a32)  0x00001974 0x000000be 0x00000002 a.out..gnu.version
  0x0000000a regular          [0x0000000000001a38-0x0000000000001ac8)  0x00001a38 0x00000090 0x00000002 a.out..gnu.version_r
  0x0000000b regular          [0x0000000000001ac8-0x0000000000001e70)  0x00001ac8 0x000003a8 0x00000002 a.out..rela.dyn
  0x0000000c regular          [0x0000000000001e70-0x0000000000002578)  0x00001e70 0x00000708 0x00000002 a.out..rela.plt
  0x0000000d regular          [0x0000000000002578-0x0000000000002590)  0x00002578 0x00000018 0x00000006 a.out..init
  0x0000000e regular          [0x0000000000002590-0x0000000000002a50)  0x00002590 0x000004c0 0x00000006 a.out..plt
  0x0000000f code             [0x0000000000002a50-0x0000000000004988)  0x00002a50 0x00001f38 0x00000006 a.out..text
  0x00000010 regular          [0x0000000000004988-0x0000000000004996)  0x00004988 0x0000000e 0x00000006 a.out..fini
  0x00000011 regular          [0x00000000000049a0-0x0000000000004b34)  0x000049a0 0x00000194 0x00000002 a.out..rodata
  0x00000012 regular          [0x0000000000004b34-0x0000000000004ca8)  0x00004b34 0x00000174 0x00000002 a.out..eh_frame_hdr
  0x00000013 eh-frame         [0x0000000000004ca8-0x0000000000005244)  0x00004ca8 0x0000059c 0x00000002 a.out..eh_frame
  0x00000014 regular          [0x0000000000005244-0x00000000000058e0)  0x00005244 0x0000069c 0x00000002 a.out..gcc_except_table
  0x00000015 regular          [0x0000000000205c48-0x0000000000205c58)  0x00005c48 0x00000010 0x00000003 a.out..ctors
  0x00000016 regular          [0x0000000000205c58-0x0000000000205c68)  0x00005c58 0x00000010 0x00000003 a.out..dtors
  0x00000017 regular          [0x0000000000205c68-0x0000000000205c70)  0x00005c68 0x00000008 0x00000003 a.out..jcr
  0x00000018 regular          [0x0000000000205c70-0x0000000000205d88)  0x00005c70 0x00000118 0x00000003 a.out..data.rel.ro
  0x00000019 regular          [0x0000000000205d88-0x0000000000205f88)  0x00005d88 0x00000200 0x00000003 a.out..dynamic
  0x0000001a regular          [0x0000000000205f88-0x0000000000205fe0)  0x00005f88 0x00000058 0x00000003 a.out..got
  0x0000001b regular          [0x0000000000205fe8-0x0000000000206258)  0x00005fe8 0x00000270 0x00000003 a.out..got.plt
  0x0000001c data             [0x0000000000206258-0x0000000000206270)  0x00006258 0x00000018 0x00000003 a.out..data
  0x0000001d zero-fill        [0x0000000000206270-0x0000000000207280)  0x00006270 0x00000000 0x00000003 a.out..bss
  0x0000001e regular          [0x0000000000000000-0x0000000000000048)  0x00006270 0x00000048 0x00000030 a.out..comment
  0x0000001f dwarf-info       [0x0000000000000000-0x000000000000dd7b)  0x000062b8 0x0000dd7b 0x00000000 a.out..debug_info
  0x00000020 dwarf-abbrev     [0x0000000000000000-0x0000000000000502)  0x00014033 0x00000502 0x00000000 a.out..debug_abbrev
  0x00000021 dwarf-line       [0x0000000000000000-0x0000000000000c33)  0x00014535 0x00000c33 0x00000000 a.out..debug_line
  0x00000022 dwarf-str        [0x0000000000000000-0x0000000000013d9f)  0x00015168 0x00013d9f 0x00000030 a.out..debug_str
  0x00000023 dwarf-pubtypes   [0x0000000000000000-0x0000000000000ba1)  0x00028f07 0x00000ba1 0x00000000 a.out..debug_pubtypes
  0x00000024 dwarf-ranges     [0x0000000000000000-0x00000000000000f0)  0x00029aa8 0x000000f0 0x00000000 a.out..debug_ranges
  0x00000025 regular          [0x0000000000000000-0x000000000000016c)  0x00029b98 0x0000016c 0x00000000 a.out..shstrtab
  0x00000026 regular          [0x0000000000000000-0x0000000000001410)  0x0002a6c8 0x00001410 0x00000000 a.out..symtab
  0x00000027 regular          [0x0000000000000000-0x0000000000001b0c)  0x0002bad8 0x00001b0c 0x00000000 a.out..strtab



After the my recent checking, we correctly disallow any sections that don't have the SHF_ALLOC bit set if the flags from having a valid VM address. Now the sections look like:


lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) image dump sections 
Dumping sections for 1 modules.
Sections for '/private/tmp/lookup/a.out' (x86_64):
  SectID     Type             File Address                             File Off.  File Size  Flags      Section Name
  ---------- ---------------- ---------------------------------------  ---------- ---------- ---------- ----------------------------
  0x00000001 regular                                                   0x00000000 0x00000000 0x00000000 a.out.
  0x00000002 regular          [0x0000000000000238-0x0000000000000254)  0x00000238 0x0000001c 0x00000002 a.out..interp
  0x00000003 regular          [0x0000000000000254-0x0000000000000274)  0x00000254 0x00000020 0x00000002 a.out..note.ABI-tag
  0x00000004 regular          [0x0000000000000274-0x0000000000000298)  0x00000274 0x00000024 0x00000002 a.out..note.gnu.build-id
  0x00000005 regular          [0x0000000000000298-0x0000000000000528)  0x00000298 0x00000290 0x00000002 a.out..hash
  0x00000006 regular          [0x0000000000000528-0x0000000000000584)  0x00000528 0x0000005c 0x00000002 a.out..gnu.hash
  0x00000007 regular          [0x0000000000000588-0x0000000000000e70)  0x00000588 0x000008e8 0x00000002 a.out..dynsym
  0x00000008 regular          [0x0000000000000e70-0x0000000000001973)  0x00000e70 0x00000b03 0x00000002 a.out..dynstr
  0x00000009 regular          [0x0000000000001974-0x0000000000001a32)  0x00001974 0x000000be 0x00000002 a.out..gnu.version
  0x0000000a regular          [0x0000000000001a38-0x0000000000001ac8)  0x00001a38 0x00000090 0x00000002 a.out..gnu.version_r
  0x0000000b regular          [0x0000000000001ac8-0x0000000000001e70)  0x00001ac8 0x000003a8 0x00000002 a.out..rela.dyn
  0x0000000c regular          [0x0000000000001e70-0x0000000000002578)  0x00001e70 0x00000708 0x00000002 a.out..rela.plt
  0x0000000d regular          [0x0000000000002578-0x0000000000002590)  0x00002578 0x00000018 0x00000006 a.out..init
  0x0000000e regular          [0x0000000000002590-0x0000000000002a50)  0x00002590 0x000004c0 0x00000006 a.out..plt
  0x0000000f code             [0x0000000000002a50-0x0000000000004988)  0x00002a50 0x00001f38 0x00000006 a.out..text
  0x00000010 regular          [0x0000000000004988-0x0000000000004996)  0x00004988 0x0000000e 0x00000006 a.out..fini
  0x00000011 regular          [0x00000000000049a0-0x0000000000004b34)  0x000049a0 0x00000194 0x00000002 a.out..rodata
  0x00000012 regular          [0x0000000000004b34-0x0000000000004ca8)  0x00004b34 0x00000174 0x00000002 a.out..eh_frame_hdr
  0x00000013 eh-frame         [0x0000000000004ca8-0x0000000000005244)  0x00004ca8 0x0000059c 0x00000002 a.out..eh_frame
  0x00000014 regular          [0x0000000000005244-0x00000000000058e0)  0x00005244 0x0000069c 0x00000002 a.out..gcc_except_table
  0x00000015 regular          [0x0000000000205c48-0x0000000000205c58)  0x00005c48 0x00000010 0x00000003 a.out..ctors
  0x00000016 regular          [0x0000000000205c58-0x0000000000205c68)  0x00005c58 0x00000010 0x00000003 a.out..dtors
  0x00000017 regular          [0x0000000000205c68-0x0000000000205c70)  0x00005c68 0x00000008 0x00000003 a.out..jcr
  0x00000018 regular          [0x0000000000205c70-0x0000000000205d88)  0x00005c70 0x00000118 0x00000003 a.out..data.rel.ro
  0x00000019 regular          [0x0000000000205d88-0x0000000000205f88)  0x00005d88 0x00000200 0x00000003 a.out..dynamic
  0x0000001a regular          [0x0000000000205f88-0x0000000000205fe0)  0x00005f88 0x00000058 0x00000003 a.out..got
  0x0000001b regular          [0x0000000000205fe8-0x0000000000206258)  0x00005fe8 0x00000270 0x00000003 a.out..got.plt
  0x0000001c data             [0x0000000000206258-0x0000000000206270)  0x00006258 0x00000018 0x00000003 a.out..data
  0x0000001d zero-fill        [0x0000000000206270-0x0000000000207280)  0x00006270 0x00000000 0x00000003 a.out..bss
  0x0000001e regular                                                   0x00006270 0x00000048 0x00000030 a.out..comment
  0x0000001f dwarf-info                                                0x000062b8 0x0000dd7b 0x00000000 a.out..debug_info
  0x00000020 dwarf-abbrev                                              0x00014033 0x00000502 0x00000000 a.out..debug_abbrev
  0x00000021 dwarf-line                                                0x00014535 0x00000c33 0x00000000 a.out..debug_line
  0x00000022 dwarf-str                                                 0x00015168 0x00013d9f 0x00000030 a.out..debug_str
  0x00000023 dwarf-pubtypes                                            0x00028f07 0x00000ba1 0x00000000 a.out..debug_pubtypes
  0x00000024 dwarf-ranges                                              0x00029aa8 0x000000f0 0x00000000 a.out..debug_ranges
  0x00000025 regular                                                   0x00029b98 0x0000016c 0x00000000 a.out..shstrtab
  0x00000026 regular                                                   0x0002a6c8 0x00001410 0x00000000 a.out..symtab
  0x00000027 regular                                                   0x0002bad8 0x00001b0c 0x00000000 a.out..strtab


Note from the ".comment" section on down, they no longer show file addresses.

Now we can try some symbolication with LLDB on the binary:

% lldb a.out
Current executable set to 'a.out' (x86_64).
(lldb) target modules lo
Available completions:
	load
	lookup
(lldb) image lookup -va 0x0000000000002d90
      Address: a.out[0x0000000000002d90] (a.out..text + 832)
      Summary: a.out`main + 32 at main.cpp:176
       Module: file = "/private/tmp/lookup/a.out", arch = "x86_64"
  CompileUnit: id = {0x00000000}, file = "/usr/local/google/home/dvyukov/llvm/tools/lldb/examples/lookup/main.cpp", language = "ISO C++:1998"
     Function: id = {0x000018c2}, name = "main", range = [0x0000000000002d70-0x000000000000332c)
     FuncType: id = {0x000018c2}, decl = main.cpp:155, clang_type = "int (int, const char **)"
       Blocks: id = {0x000018c2}, range = [0x00002d70-0x0000332c)
               id = {0x000018fc}, ranges = [0x00002d90-0x000032e8)[0x000032f4-0x0000332c)
    LineEntry: [0x0000000000002d90-0x0000000000002de6): /usr/local/google/home/dvyukov/llvm/tools/lldb/examples/lookup/main.cpp:176:68
       Symbol: uid={   167}, range = [0x0000000000002d70-0x000000000000332c), name="main"
     Variable: id = {0x00001901}, name = "ls", type= "StreamSP", location = DW_OP_fbreg(-80), decl = main.cpp:176
     Variable: id = {0x00001910}, name = "la", type= "const char *", location = DW_OP_fbreg(-104), decl = main.cpp:177
     Variable: id = {0x0000191f}, name = "log", type= "LogSP", location = DW_OP_fbreg(-120), decl = main.cpp:178
     Variable: id = {0x0000192e}, name = "exe_file_path", type= "const char *", location = DW_OP_fbreg(-128), decl = main.cpp:185
     Variable: id = {0x0000193d}, name = "file_addr", type= "addr_t", location = DW_OP_fbreg(-136), decl = main.cpp:187
     Variable: id = {0x0000194c}, name = "debugger", type= "SBDebugger", location = DW_OP_fbreg(-168), decl = main.cpp:193
     Variable: id = {0x000018e0}, name = "argc", type= "int", location = DW_OP_fbreg(-56), decl = main.cpp:154
     Variable: id = {0x000018ee}, name = "argv", type= "const char **", location = DW_OP_fbreg(-64), decl = main.cpp:154



Not this lookup succeeded before we set the load address. In your main.cpp that is attached to the bug, you then slide all of the sections by a given address using:

	  target.SetModuleLoadAddress(module, (lldb::addr_t)info->dlpi_addr);


I can simulate sliding the entire image by 0x1000 by using the "target modules load --slide <slide>" command:

(lldb) target modules load --file a.out --slide 0x1000

Now if we dump the sections we see them at their "load" address:

(lldb) image dump sections 
Dumping sections for 1 modules.
Sections for '/private/tmp/lookup/a.out' (x86_64):
  SectID     Type             Load Address                             File Off.  File Size  Flags      Section Name
  ---------- ---------------- ---------------------------------------  ---------- ---------- ---------- ----------------------------
  0x00000001 regular                                                   0x00000000 0x00000000 0x00000000 a.out.
  0x00000002 regular          [0x0000000000001238-0x0000000000001254)  0x00000238 0x0000001c 0x00000002 a.out..interp
  0x00000003 regular          [0x0000000000001254-0x0000000000001274)  0x00000254 0x00000020 0x00000002 a.out..note.ABI-tag
  0x00000004 regular          [0x0000000000001274-0x0000000000001298)  0x00000274 0x00000024 0x00000002 a.out..note.gnu.build-id
  0x00000005 regular          [0x0000000000001298-0x0000000000001528)  0x00000298 0x00000290 0x00000002 a.out..hash
  0x00000006 regular          [0x0000000000001528-0x0000000000001584)  0x00000528 0x0000005c 0x00000002 a.out..gnu.hash
  0x00000007 regular          [0x0000000000001588-0x0000000000001e70)  0x00000588 0x000008e8 0x00000002 a.out..dynsym
  0x00000008 regular          [0x0000000000001e70-0x0000000000002973)  0x00000e70 0x00000b03 0x00000002 a.out..dynstr
  0x00000009 regular          [0x0000000000002974-0x0000000000002a32)  0x00001974 0x000000be 0x00000002 a.out..gnu.version
  0x0000000a regular          [0x0000000000002a38-0x0000000000002ac8)  0x00001a38 0x00000090 0x00000002 a.out..gnu.version_r
  0x0000000b regular          [0x0000000000002ac8-0x0000000000002e70)  0x00001ac8 0x000003a8 0x00000002 a.out..rela.dyn
  0x0000000c regular          [0x0000000000002e70-0x0000000000003578)  0x00001e70 0x00000708 0x00000002 a.out..rela.plt
  0x0000000d regular          [0x0000000000003578-0x0000000000003590)  0x00002578 0x00000018 0x00000006 a.out..init
  0x0000000e regular          [0x0000000000003590-0x0000000000003a50)  0x00002590 0x000004c0 0x00000006 a.out..plt
  0x0000000f code             [0x0000000000003a50-0x0000000000005988)  0x00002a50 0x00001f38 0x00000006 a.out..text
  0x00000010 regular          [0x0000000000005988-0x0000000000005996)  0x00004988 0x0000000e 0x00000006 a.out..fini
  0x00000011 regular          [0x00000000000059a0-0x0000000000005b34)  0x000049a0 0x00000194 0x00000002 a.out..rodata
  0x00000012 regular          [0x0000000000005b34-0x0000000000005ca8)  0x00004b34 0x00000174 0x00000002 a.out..eh_frame_hdr
  0x00000013 eh-frame         [0x0000000000005ca8-0x0000000000006244)  0x00004ca8 0x0000059c 0x00000002 a.out..eh_frame
  0x00000014 regular          [0x0000000000006244-0x00000000000068e0)  0x00005244 0x0000069c 0x00000002 a.out..gcc_except_table
  0x00000015 regular          [0x0000000000206c48-0x0000000000206c58)  0x00005c48 0x00000010 0x00000003 a.out..ctors
  0x00000016 regular          [0x0000000000206c58-0x0000000000206c68)  0x00005c58 0x00000010 0x00000003 a.out..dtors
  0x00000017 regular          [0x0000000000206c68-0x0000000000206c70)  0x00005c68 0x00000008 0x00000003 a.out..jcr
  0x00000018 regular          [0x0000000000206c70-0x0000000000206d88)  0x00005c70 0x00000118 0x00000003 a.out..data.rel.ro
  0x00000019 regular          [0x0000000000206d88-0x0000000000206f88)  0x00005d88 0x00000200 0x00000003 a.out..dynamic
  0x0000001a regular          [0x0000000000206f88-0x0000000000206fe0)  0x00005f88 0x00000058 0x00000003 a.out..got
  0x0000001b regular          [0x0000000000206fe8-0x0000000000207258)  0x00005fe8 0x00000270 0x00000003 a.out..got.plt
  0x0000001c data             [0x0000000000207258-0x0000000000207270)  0x00006258 0x00000018 0x00000003 a.out..data
  0x0000001d zero-fill        [0x0000000000207270-0x0000000000208280)  0x00006270 0x00000000 0x00000003 a.out..bss
  0x0000001e regular                                                   0x00006270 0x00000048 0x00000030 a.out..comment
  0x0000001f dwarf-info                                                0x000062b8 0x0000dd7b 0x00000000 a.out..debug_info
  0x00000020 dwarf-abbrev                                              0x00014033 0x00000502 0x00000000 a.out..debug_abbrev
  0x00000021 dwarf-line                                                0x00014535 0x00000c33 0x00000000 a.out..debug_line
  0x00000022 dwarf-str                                                 0x00015168 0x00013d9f 0x00000030 a.out..debug_str
  0x00000023 dwarf-pubtypes                                            0x00028f07 0x00000ba1 0x00000000 a.out..debug_pubtypes
  0x00000024 dwarf-ranges                                              0x00029aa8 0x000000f0 0x00000000 a.out..debug_ranges
  0x00000025 regular                                                   0x00029b98 0x0000016c 0x00000000 a.out..shstrtab
  0x00000026 regular                                                   0x0002a6c8 0x00001410 0x00000000 a.out..symtab
  0x00000027 regular                                                   0x0002bad8 0x00001b0c 0x00000000 a.out..strtab



And if we lookup an address in main again, we see the correct results:


(lldb) image lookup -va 0x0000000000003d90
      Address: a.out[0x0000000000002d90] (a.out..text + 832)
      Summary: a.out`main + 32 at main.cpp:176
       Module: file = "/private/tmp/lookup/a.out", arch = "x86_64"
  CompileUnit: id = {0x00000000}, file = "/usr/local/google/home/dvyukov/llvm/tools/lldb/examples/lookup/main.cpp", language = "ISO C++:1998"
     Function: id = {0x000018c2}, name = "main", range = [0x0000000000003d70-0x000000000000432c)
     FuncType: id = {0x000018c2}, decl = main.cpp:155, clang_type = "int (int, const char **)"
       Blocks: id = {0x000018c2}, range = [0x00003d70-0x0000432c)
               id = {0x000018fc}, ranges = [0x00003d90-0x000042e8)[0x000042f4-0x0000432c)
    LineEntry: [0x0000000000003d90-0x0000000000003de6): /usr/local/google/home/dvyukov/llvm/tools/lldb/examples/lookup/main.cpp:176:68
       Symbol: uid={   167}, range = [0x0000000000003d70-0x000000000000432c), name="main"
     Variable: id = {0x00001901}, name = "ls", type= "StreamSP", location = DW_OP_fbreg(-80), decl = main.cpp:176
     Variable: id = {0x00001910}, name = "la", type= "const char *", location = DW_OP_fbreg(-104), decl = main.cpp:177
     Variable: id = {0x0000191f}, name = "log", type= "LogSP", location = DW_OP_fbreg(-120), decl = main.cpp:178
     Variable: id = {0x0000192e}, name = "exe_file_path", type= "const char *", location = DW_OP_fbreg(-128), decl = main.cpp:185
     Variable: id = {0x0000193d}, name = "file_addr", type= "addr_t", location = DW_OP_fbreg(-136), decl = main.cpp:187
     Variable: id = {0x0000194c}, name = "debugger", type= "SBDebugger", location = DW_OP_fbreg(-168), decl = main.cpp:193
     Variable: id = {0x000018e0}, name = "argc", type= "int", location = DW_OP_fbreg(-56), decl = main.cpp:154
     Variable: id = {0x000018ee}, name = "argv", type= "const char **", location = DW_OP_fbreg(-64), decl = main.cpp:154


Dmitry: are you seeing an address not work correctly when you look it up? If you can print out the address you are using to load your PIE executable by uncommenting:

  //printf("LOADING '%s' at %p\n", info->dlpi_name, (void*)info->dlpi_addr);

And send me the addresses that you then are looking up, I might be able to help, but from what I see this is working as expected (after my fixes):

% svn commit
Sending        source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
Sending        source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Sending        source/Symbol/ObjectFile.cpp
Transmitting file data ...
Committed revision 153496.


Let me know if this now works for you? 

Greg Clayton


On Mar 26, 2012, at 11:01 AM, Dmitry Vyukov wrote:

> On Mon, Mar 26, 2012 at 9:22 PM, Greg Clayton <gclayton at apple.com> wrote:
> Dmitry,
> 
> Can you attach an example ELF file with DWARF and the main.cpp source file to the bug so that I can take a look? "-pie" is not a valid argument for our current darwin clang++, so this might be a linux specific compiler driver option.
> 
> 
> Hi Greg,
> 
> I've attached source and binary:
> http://llvm.org/bugs/show_bug.cgi?id=12355
> 
> 
> On Mar 26, 2012, at 2:16 AM, Dmitry Vyukov wrote:
> 
> > On Wed, Feb 29, 2012 at 12:50 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
> > On Tue, Feb 28, 2012 at 10:25 PM, Greg Clayton <gclayton at apple.com> wrote:
> > > Ironically the symbolizer works great on gcc-compiled binaries,
> > > but fails on clang-compiled binaries.
> > > It provides some info but it's dead wrong (point into some
> > > random STL source files).
> > > objdump -dlS shows
> > > correct info for the binaries, and I guess you mostly work with
> > > clang-compiled binaries.
> > > So are there any known problems? What may I be missing?
> >
> > Not that we know of. Clang binaries work great on MacOSX and symbolicate just fine. If you have any quick examples where address lookups fail, please send me examples off the list.
> >
> >
> > I've tracked down the problem.
> > When I build the lookup example as
> > $ clang++ main.cpp -I../../include -llldb -g -frtti
> > It works.
> > However when I build it as:
> > $ clang++ main.cpp -I../../include -llldb -g -frtti -fPIE -pie
> > It fails to symbolize itself. While objdump -dSl symbolizes it (shows line numbers inside of functions). If I build a program with gcc with -fPIE -pie, it also able to symbolize itself (with lldb).
> > So, the problem seems to be in tricky interaction of clang, lldb and -pie.
> > It's all Linux/amd64 and tip clang.
> >
> >
> > Ping. Any progress on this? It's critical for us, we build everything only with -pie, so this thing renders lldb useless for us. I've filed an issue:
> > http://llvm.org/bugs/show_bug.cgi?id=12355
> >
> 
> 




More information about the lldb-dev mailing list