[lldb-dev] Various strange errors while debugging PostgreSQL

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Thu Mar 24 10:43:25 PDT 2016


The files I posted before are for reading core files, not generating them. The ObjectFile subclasses are what are responsible for creating a core file of a specific type.

ObjectFileELF doesn't support creating core files as we can see by the functions it registers with the plug-in manager:

ObjectFileELF::Initialize()
{
    PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                  GetPluginDescriptionStatic(),
                                  CreateInstance,
                                  CreateMemoryInstance,
                                  GetModuleSpecifications);
}

Note that ObjectFileMachO does (see the extra SaveCore function it registers):

void
ObjectFileMachO::Initialize()
{
    PluginManager::RegisterPlugin (GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   CreateInstance,
                                   CreateMemoryInstance,
                                   GetModuleSpecifications,
                                   SaveCore);
}

So it looks like this is not supported. If you feel like implementing this, let me know as I did the ObjectFileMachO::SaveCore() implementation and am familiar with what goes into it.

Greg


> On Mar 24, 2016, at 10:23 AM, Aleksander Alekseev <afiskon at devzen.ru> wrote:
> 
>> So I am guessing these are the only architectures that are supported.
>> I am guessing you might be on an i386 system?
> 
> No I'm afraid it's x86_64. File RegisterContextPOSIXCore_x86_64.cpp is
> present in source tree I used to build lldb.
> 
> This bug is very easy to reproduce.
> 
> 0. You need Ubuntu 14.04 LTS x64 with latest updates
> 1. Create a new LXC container to exclude any possible side effects from
> other installed applications
> 2. Build LLDB using this script: http://paste.ubuntu.com/15488691/
> 3. Run `sudo ninja install`
> 4. Create t.c:
> 
> ```
> #include <stdio.h>
> 
> int main()
> {
>  printf("Hello!\n");
>  return 0;
> }
> ```
> 
> 5. Run ` /usr/local/bin/clang-3.8 t.c -o t ` (or ... -g - it doesn't
> matter)
> 6. Then:
> 
> $ ./t
> Hello!
> $ lldb ./t
> (lldb) target create "./t"
> Current executable set to './t' (x86_64).
> (lldb) b main
> Breakpoint 1: where = t`main, address = 0x0000000000400530
> (lldb) r
> Process 24974 launching
> Process 24974 launched: './t' (x86_64)
> Process 24974 stopped
> * thread #1: tid = 24974, 0x0000000000400530 t`main, name = 't', stop
> reason = breakpoint 1.1 frame #0: 0x0000000000400530 t`main
> -> 0x400530 <main>: pushq  %rbp
>   0x400531 <main+1>: movq   %rsp, %rbp
>   0x400534 <main+4>: subq   $0x10, %rsp
>   0x400538 <main+8>: movabsq $0x4005e4, %rdi
> (lldb) process save-core /tmp/1.core
> 
> error: Failed to save core file for process: no ObjectFile plugins were
> able to save a core for this process
> 
> (lldb) ^D
> 
> -- 
> Best regards,
> Aleksander Alekseev
> http://eax.me/



More information about the lldb-dev mailing list