Patch for review: elf-core dump plugin

Please review the attached patch.

Ashok, thanks for the pre-review comments, please provide if you have more comments.
I am planning to add test cases after this get patch get committed.

Compiles and works fine on Ubuntu 13.04.
Here is the sample output:

$lldb a.out -c core
Core file ‘/usr/build/llvm/core’ (x86_64) was loaded.
Process 0 stopped

  • thread #1: tid = 0x0000, 0x0000000000400570 a.outrecursive_function(i=10) + 44 at test.c:60, name = 'a.out, stop reason = signal SIGSEGV frame #0: 0x0000000000400570 a.outrecursive_function(i=10) + 44 at test.c:60
    57 recursive_function(i+1);
    58 } else {
    59 char *crash=0;
    → 60 *crash = 0;
    61 }
    62 }
    63

(lldb) bt

  • thread #1: tid = 0x0000, 0x0000000000400570 a.outrecursive_function(i=10) + 44 at test.c:60, name = 'a.out, stop reason = signal SIGSEGV frame #0: 0x0000000000400570 a.outrecursive_function(i=10) + 44 at test.c:60
    frame #1: 0x0000000000400562 a.outrecursive_function(i=9) + 30 at test.c:57 frame #2: 0x0000000000400562 a.outrecursive_function(i=8) + 30 at test.c:57
    frame #3: 0x0000000000400562 a.outrecursive_function(i=7) + 30 at test.c:57 frame #4: 0x0000000000400562 a.outrecursive_function(i=6) + 30 at test.c:57
    frame #5: 0x0000000000400562 a.outrecursive_function(i=5) + 30 at test.c:57 frame #6: 0x0000000000400562 a.outrecursive_function(i=4) + 30 at test.c:57
    frame #7: 0x0000000000400562 a.outrecursive_function(i=3) + 30 at test.c:57 frame #8: 0x0000000000400562 a.outrecursive_function(i=2) + 30 at test.c:57
    frame #9: 0x0000000000400562 a.outrecursive_function(i=1) + 30 at test.c:57 frame #10: 0x0000000000400562 a.outrecursive_function(i=0) + 30 at test.c:57
    frame #11: 0x00000000004005a7 a.outstatic_function + 50 at test.c:68 frame #12: 0x00000000004005b5 a.outcall_me6 + 14 at test.c:77
    frame #13: 0x00000000004005c3 a.outcall_me5 + 14 at test.c:80 frame #14: 0x00000000004005d3 a.outcall_me4 + 14 at test.c:81
    frame #15: 0x00000000004005e3 a.outcall_me3 + 14 at test.c:82 frame #16: 0x00000000004005f3 a.outcall_me2 + 14 at test.c:83
    frame #17: 0x0000000000400603 a.outcall_me1 + 14 at test.c:84 frame #18: 0x0000000000400613 a.outcall_me + 14 at test.c:89
    frame #19: 0x0000000000400670 a.outtest_func(para1=0x00000000020a1010) + 91 at test.c:108 frame #20: 0x000000000040070b a.outmain(argc=1, argv=0x00007fffba029498) + 145 at test.c:128

Thanks
Samuel

lldb_elfcore.diff (48.1 KB)

Very nice, looks great. Check in when you get the chance.

Greg

Thanks Samuel, I know this will be much appreciated!

The only change I had to make was the test on ProcessElfCore.cpp:298, which needs to be a null test rather than a comparison with false to build using clang trunk. Works as advertised and introduces no regressions, so I fired r186207.

I noticed that you skipped the call to ReadFPR that reads AVX registers in the constructor of RegisterContext_x86_64. I noticed that register read -a includes all expected registers on an SSE machine. Did you run into issues with the call during construction? Should we be moving to cupid to query this functionality, for instance?

Also, do let us know if you need any help adding tests. Cheers,

- Ashok

Thanks Ashok for committing.

We could run the Linux test suite yesterday with no errors.

We do have to add CC=clang when doing the cmake step, otherwise several of
the samples would fail to build and error out. Like this:

CC=clang cmake -DCMAKE_CXX_FLAGS="-fcolor-diagnostics"
-DCMAKE_BUILD_TYPE=Debug -C ../llvm -G Ninja
-Mike