<div dir="ltr">Thanks Greg for the suggestion. <div>But still symbol resolution is not working.<br></div><div><br></div><div>I am still browsing the lldb source and learning the architecture.</div><div>So I am attaching my patch, please go through and let me know if I am missing something,</div>
<div style>If you can apply and debug the problem it would be great.</div><div style><br></div><div style>Note - I will cleanup and add more comments and send new one for committing, once this problem is fixed and after adding AUXV processing code.<br>
</div><div><div><br></div><div style>Samuel</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 11, 2013 at 10:12 AM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Samuel:<br>
<br>
My guess as to why the symbols aren't resolving is the dynamic loader plug-in for Linux most likely isn't being selected.<br>
<br>
<br>
lldb_private::DynamicLoader *<br>
ProcessMachCore::GetDynamicLoader ()<br>
{<br>
if (m_dyld_ap.get() == NULL)<br>
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, m_dyld_plugin_name.empty() ? NULL : m_dyld_plugin_name.c_str()));<br>
return m_dyld_ap.get();<br>
}<br>
<br>
In the mach-o case, we can either be connecting to a kernel core file, or a user space core file and the dynamic loader will be different. The Mach-O plug-in determines which one in:<br>
<br>
bool<br>
ProcessMachCore::GetDynamicLoaderAddress (lldb::addr_t addr);<br>
<br>
For now you can probably just hard code your<br>
<br>
lldb_private::DynamicLoader *<br>
ProcessELFCore::GetDynamicLoader ()<br>
{<br>
if (m_dyld_ap.get() == NULL)<br>
m_dyld_ap.reset (DynamicLoader::FindPlugin(this, "linux-dyld"));<br>
return m_dyld_ap.get();<br>
}<br>
<br>
If the ELF core file plug-in is functional, please do commit it, or if you don't have commit access, just send a patch to this group and one of us will commit it for you.<br>
<br>
Greg Clayton<br>
<div><div class="h5"><br>
On Feb 8, 2013, at 3:00 PM, Samuel Jacob <<a href="mailto:samueldotj@gmail.com">samueldotj@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> I am new to lldb and creating a patch to support Linux coredumps.<br>
> This plugin is based on mach-core plugin.<br>
> Currently it can parss the NOTE segments and loads all the threads found in the corefile(x86_64).<br>
> That is "thread list" works fine.<br>
><br>
> It also reads the PRSTATUS structure and populates the register infromation.<br>
> That is "register read" works fine.<br>
><br>
> However lldb is not using the symbol files while using the core file. Because of this it is not using DWARF structures while creating frames. That is frame variables and arguments are not available. Also lldb not resolving address to symbols.<br>
><br>
> $lldb<br>
> (lldb) target create -c ./core<br>
> Core file '/mts/home3/jacobs/test/core' (x86_64) was loaded.<br>
> Process 0 stopped<br>
> * thread #1: tid = 0x0000, 0x00000000004004c4, stop reason = signal SIGCONT<br>
> frame #0: 0x00000000004004c4<br>
> error: core file does not contain 0x4004c4<br>
> (lldb) target modules add ./a.out<br>
> (lldb) image lookup --address 0x4004c4<br>
> Address: a.out[0x00000000004004c4] (a.out..text + 244)<br>
> Summary: a.out`function4 + 16 at test.c:4<br>
> (lldb) bt<br>
> * thread #1: tid = 0x0000, 0x00000000004004c4, stop reason = signal SIGCONT<br>
> frame #0: 0x00000000004004c4<br>
> frame #1: 0x00000000004004d7<br>
> frame #2: 0x00000000004004e7<br>
> frame #3: 0x00000000004004f7<br>
> frame #4: 0x0000000000400507<br>
> (lldb) image lookup --address 0x00000000004004d7<br>
> Address: a.out[0x00000000004004d7] (a.out..text + 263)<br>
> Summary: a.out`function3 + 11 at test.c:8<br>
><br>
> In the above example the IP's are not resolved to symbol in "bt" although lldb is able to resolve the addresses using "image lookukp" . What command should be used to link a target with symbol file?<br>
><br>
> Here is the program that I used which compiled with "gcc -O0 -g3"<br>
> $cat test.c<br>
> void function4(unsigned int arg)<br>
> {<br>
> char *local = 0;<br>
> *local = 0;<br>
> }<br>
> void function3()<br>
> {<br>
> function4(-1);<br>
> }<br>
> void function2(long arg)<br>
> {<br>
> function3();<br>
> }<br>
> void function1(int arg1, long arg2, char *str)<br>
> {<br>
> function2(1);<br>
> }<br>
> void main()<br>
> {<br>
> function1(0, 1L, "Test\n");<br>
> }<br>
><br>
> GDB output<br>
><br>
> $gdb --quiet a.out core<br>
> Reading symbols from /mts/home3/jacobs/test/a.out...done.<br>
><br>
> warning: exec file is newer than core file.<br>
> [New LWP 26718]<br>
><br>
> warning: Can't read pathname for load map: Input/output error.<br>
> Core was generated by `./a.out'.<br>
> Program terminated with signal 11, Segmentation fault.<br>
> #0 0x00000000004004c4 in function4 (arg=0) at test.c:4<br>
> 4 *local = 0;<br>
> (gdb) bt<br>
> #0 0x00000000004004c4 in function4 (arg=0) at test.c:4<br>
> #1 0x00000000004004d7 in function3 () at test.c:8<br>
> #2 0x00000000004004e7 in function2 (arg=4195559) at test.c:11<br>
> #3 0x00000000004004f7 in function1 (arg1=0, arg2=140736328348032, str=0x4004e7 <incomplete sequence \370\270>) at test.c:15<br>
> #4 0x0000000000400507 in function1 (arg1=0, arg2=140736328348048, str=0x4004f7 "\345H\203\354\030\211}\374H\211u\360H\211U\350\277\001") at test.c:15<br>
> #5 0x00007fbcdfe6c76d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6<br>
> #6 0x00000000004003f9 in _start ()<br>
><br>
> I can post the patch if anyone interested(but it needs to be cleaned up).<br>
><br>
> Thanks<br>
> Samuel<br>
</div></div>> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@cs.uiuc.edu">lldb-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div><br></div>