Open b374043b-35b5-422a-b8ed-de440d214f13 opened 14 years ago
No, that violates the specification of llvm.trap. Trap does not continue.
Alright, what about changing behaviour of existing 'llvm.trap' instruction? Without attached debugger on Win32 program will terminated as with 'ud2' instruction. With attached debugger we get more debug-friendly trap unlike current one. I guess patch for it should looks like attached file ( I retain 'ud2' name coz GNU 'as' don't recognize 'icebp' intruction unlike 'objdump' )
This is a target specific thing. I'm not opposed to adding target specific builtins to expose things (e.g. cpuid would be a nice one on x86) but I don't want to generalizing something that isn't general. Anyway, I don't know of anyone working on this. Unless you plan to do it, I'll move it to the X86 README.txt file which is where we keep random ideas for new features (non-bugs).
Another idea is to add target-specific 'dbg.trap' instrinsic with opcode 0xf1 for x86 backend or change behaviour of 'llvm.trap' to generate 'icebp' instead of 'ud2'.
Is this general enough to warrant an intrinsic? This might be better off done with inline asm.
Visual Studio catches 'ud2' but disallow to continue execution and terminating app after step over. For 'int3' / 'int 3' VS shows dialog with break/continue buttons. With 'icebp' VS immediately breaks at location showing disassembly (nicest behaviour =) ).
Sure, this should be easy to add if you're interested. Does llvm.trap (which codegens to ud2) do what you need? If not, adding something similar should be easy.
Extended Description
It will be great to add intrinsic 'x86_icebp' with opcode 0xF1 ( not documented, but supported by all x86 hardware ) intrinsic for X86 to simplify JIT debugging with Visual Studio ( it breaks execution and immediately jumps to disassembly without prompting ).