From: David Given on 12 Mar 2010 15:17 Here's another really, really obscure question. Any illumination will be gratefully appreciated. My app is using the Posix subsystem, Interix. I want to catch certain null dereferences so I can emulate them in software and continue. On a normal Unix I'd use sigaction with SA_SIGINFO for this; when the dereference occurs the kernel sends me a SIGSEGV with information about the exact state of the processor when the exception happened, so I can just adjust the processor state and longjmp out. Unfortunately Interix doesn't have SA_SIGINFO. This means I have to do something else. Can anyone suggest what else I can do? Just to make life more interesting, Interix doesn't let me use the Win32 APIs (which makes this post technically off-topic but I can't think of a more appropriate place to ask). I *can*, however, use NT kernel APIs, but these are so undocumented that unless I know what to look for I won't find anything. Are the structured event macros suitable for doing this? (They just involve fiddling with %fs:0, so I don't know whether they're handled by the kernel or whether they're a Win32 thing.) If so, does anyone have a pointer to some code implementing resumable exceptions using them? -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL
From: David Given on 13 Mar 2010 11:17 On 12/03/10 20:17, David Given wrote: [...] > Are the structured event macros suitable for doing this? (They just > involve fiddling with %fs:0, so I don't know whether they're handled by > the kernel or whether they're a Win32 thing.) If so, does anyone have a > pointer to some code implementing resumable exceptions using them? Naturally, shortly after posting my query I found the answer myself: the AddVectoredExceptionHandler() function is just a shadow of NTDLL's RtlAddVectoredExceptionHandler(), which is visible to Interix, and does precisely what I want. I have it all working beautifully now. -- ┌─── dg@cowlark.com ───── http://www.cowlark.com ───── │ │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ } │ --- Conway's Game Of Life, in one line of APL
|
Pages: 1 Prev: Adjust the client rect FOR REAL is impossible! Next: Excel Solver from C++/COM |