Yuri
2010-Jul-16 00:36 UTC
[LLVMdev] Strange exception code behavior: insertion of trace instructions makes result incorrect
Here is what I did: I took c.C (attached), compiled it into my.ll code with command 'clang++ -O3 -fexceptions -emit-llvm -S -o my.ll c.C' and added tracing command on every line, see attached my.ll Running my.ll in interpreter with this command 'llvm-as my.ll && lli -jit-enable-eh my.bc', I get this log: TRACE num=20 TRACE num=22 TRACE num=27 TRACE num=29 TRACE num=31 TRACE num=33 TRACE num=58 TRACE num=60 TRACE num=62 TRACE num=64 TRACE num=66 TRACE num=70 TRACE num=72 Stack dump: 0. Program arguments: lli -jit-enable-eh my.bc Bus error: 10 The line: TRACE num=72 is the next after _Unwind_Resume_or_Rethrow that is marked noreturn. Runing the same code as binary also bahaves in a similar way: 'llvm-as my.ll && llc -o my.s my.bc && as -o my.o my.s && g++ -o my my.o && my': TRACE num=20 TRACE num=22 TRACE num=27 TRACE num=29 TRACE num=31 TRACE num=33 TRACE num=58 TRACE num=60 TRACE num=62 TRACE num=64 TRACE num=66 TRACE num=70 TRACE num=72 TRACE num=134515344 Segmentation fault Removing all calls to mytrace makes behavior correct. Why I can't insert trace instructions? What is the state that is saved between commands that causes such crashes? Also only leaving one 'mytrace ' instruction before or after llvm.eh.exception near the label lpad1 already causes the crash. I think something is wrong with llvm.eh.exception and/or llvm.eh.selector. Do they pass each other values in registers or something like this? Yuri -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: c.C URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20100715/1741704f/attachment.ksh> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: my.ll URL: <lists.llvm.org/pipermail/llvm-dev/attachments/20100715/1741704f/attachment-0001.ksh>
Duncan Sands
2010-Jul-16 09:32 UTC
[LLVMdev] Strange exception code behavior: insertion of trace instructions makes result incorrect
Hi Yuri, there shouldn't be any non-trivial instructions between the start of the landing pad and the eh.selector call, except for calls to eh.exception. Ciao, Duncan.
Reasonably Related Threads
- 2 commits - libswfdec/swfdec_as_array.c test/trace
- [LLVMdev] RFC: How to represent SEH (__try / __except) in LLVM IR
- [LLVMdev] RFC: Native Windows C++ exception handling
- [LLVMdev] C++ exception handling
- Branch 'vivi' - 9 commits - libswfdec/swfdec_as_array.c libswfdec/swfdec_as_function.c libswfdec/swfdec_as_function.h libswfdec/swfdec_as_internal.h libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_native_function.c