On Thu, 17 Jul 2003, Leopold Toetsch wrote: > > Replacing the next instruction with a branch to the signal handler > > (like adding a breakpoint) out of the question? > > I don't know, how to get the address of the next instruction i.e. the > "PC" above. Going this way would either mean: > - fill the bytecode segment with the handler opcode function or
Yuck. > - locate the PC on the stack or in registers (like %esi in CGP) > The former seems rather expensive (at least if we heavily use events), > the latter seems to be possible only per platform/compiler(-revision). For non-jit code, the latter seems doable if we can find a way to force registers back out to memory if necessary (short of declaring the PC volatile, which would just suck). The Boehm collector uses a platform-independent setjmp() hack to do this. For jit code, we know the jit PC reg, so it shouldn't be a problem. Of course, you should probably take this with a grain of salt with size inversely proportional to the amount of the solution I've coded. (An infinite grain in this case...) /s