https://bugs.llvm.org/show_bug.cgi?id=50327
Bug ID: 50327
Summary: Incorrect call frame info on X86_64 target
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected],
[email protected]
$ cat test.c
#include <stdlib.h>
int f2(char *input) { return crasher(input, 1); }
int crasher(char *input, int crash) {
if (crash)
input = NULL;
input[0] = '1';
input[1] = '2';
input[2] = '3';
input[3] = '\0';
f2(input);
if (crash)
return 0;
else
return 1;
}
int f1() {
char *input = (char *)malloc(sizeof(char) * 10);
return crasher(input, 0);
}
int main(int argc, char **argv) {
f1();
return 0;
}
This small example when compiled with -O1 produces call frame info that causes
incorrect backtrace in GDB.
$ clang -O1 test.c -o test
$ ./test
Segmentation fault (core dumped)
$ lldb test -c core.test
...
(lldb) bt
* thread #1, name = 'test', stop reason = signal SIGSEGV
* frame #0: 0x0000000000401156 test`f2 + 6
frame #1: 0x000000000040116c test`crasher + 12
frame #2: 0x000000000040115b test`f2 + 11
frame #3: 0x000000000040116c test`crasher + 12
frame #4: 0x000000000040115b test`f2 + 11
frame #5: 0x000000000040116c test`crasher + 12
frame #6: 0x000000000040115b test`f2 + 11
frame #7: 0x000000000040116c test`crasher + 12
frame #8: 0x000000000040115b test`f2 + 11
frame #9: 0x000000000040116c test`crasher + 12
frame #10: 0x000000000040115b test`f2 + 11
frame #11: 0x000000000040116c test`crasher + 12
frame #12: 0x000000000040115b test`f2 + 11
frame #13: 0x000000000040116c test`crasher + 12
...
With gcc, it looks ok:
$ gcc -O1 test.c -o test-gcc
$ ./test-gcc
Segmentation fault (core dumped)
$ lldb ./test-gcc -c core.test-gcc
...
(lldb) bt
* thread #1, name = 'test-gcc', stop reason = signal SIGSEGV
* frame #0: 0x000000000040115b test-gcc`crasher + 14
frame #1: 0x000000000040118c test-gcc`f2 + 19
frame #2: 0x000000000040116f test-gcc`crasher + 34
frame #3: 0x00000000004011ac test-gcc`f1 + 27
frame #4: 0x00000000004011bf test-gcc`main + 14
frame #5: 0x00007fea1df1c555 libc.so.6`__libc_start_main + 245
frame #6: 0x0000000000401089 test-gcc`_start + 41
This has been reproduced with x86_64 GNU/Linux platform.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs