Stackdump in C++ not showing the stack trace
I have an app that crashes sometimes and creates the next file: (APP.exe.stackdump)
Exception: STATUS_ACCESS_VIOLATION at eip=6BA4B246
eax=67452301 ebx=EFCDAB89 ecx=98BADCFE edx=10325476 esi=FFFFFFFF edi=98BADCFE
ebp=FFFFFFFF esp=01A2C928 program=C:\APP.exe, pid 168, thread unknown 开发者_如何学C(0x13E8)
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame Function Args
End of stack trace
I'm compiling with g++ in Windows, Ubuntu and Centos. The error happens sometimes only, inside a thread, there is anyway to get the stack trace of where is happening? Or any extra info?
Update 1:
I can capture it with:
signal(SIGSEGV, sigHandler);
But still I don't have stacktrace info.
Or any extra info?
Use valgrind or efence. Both are very good at finding usage of wild pointers at the time of dereference, instead of later when the corrupted data is used.
There are a few possibilities why stack trace is not available:
- you compiled your code without stack frame (as far as I remember this is default behaviour for x86_64 code generated by gcc/g++)
- you corrupted your stack (stack overflow ;))
- There is nothing to trace ;) (you are in code executed before or after main and you haven't entered any functions yet or already returned from them)
Judging from a fact that EBP=FFFFFFFF I would go for #2 unless the problem exists in low level C or assembler code which touches EBP. Can you provide dissassembly from a dump?
精彩评论