#1820: Windows segfault-catching only works for the main thread
---------------------------------+------------------------------------------
Reporter: simonmar | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.12.3
Component: Runtime System | Version: 6.8.1
Keywords: | Difficulty: Unknown
Os: Windows | Testcase: derefnull(ghci),
divbyzero(ghci)
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Changes (by igloo):
* owner: igloo =>
Comment:
This program, with the `seh_excn.*` files in the GHC tree:
{{{
#include "seh_excn.h"
void g(int *p) {
printf("1 Points to %d\n", *p);
printf("2 Not %d\n", 5 / 0);
printf("3 Points to %d\n", *p);
}
void h() {
printf("1 Points to %d\n", 6);
printf("2 Not %d\n", 5 / 0);
printf("3 Points to %d\n", 7);
}
void f(int *p) {
BEGIN_CATCH
g(p);
// h();
END_CATCH
}
int main(void) {
int p;
p = 28;
printf("Start\n");
f(&p);
printf("End\n");
}
}}}
doesn't work properly:
{{{
$ ./seh
Start
1 Points to 28
}}}
(note that we don't get a "divide by zero" message)
whereas if you change it to call `h` rather than `g` then it does:
{{{
$ ./seh
Start
1 Points to 6
divide by zero
}}}
This is a problem because I think we want to do the exception handling in
`workerStart`, where we need to pass the `task` argument on.
I've looked at using the simpler-looking `AddVectoredExceptionHandler`
instead (which would mean we have to drop Win 2k support, I think), but
I'm getting
{{{
C:\cygwin\tmp/ccYnOVfO.o:seh2.c:(.text+0xe3): undefined reference to
`AddVectoredExceptionHandler'
C:\cygwin\tmp/ccYnOVfO.o:seh2.c:(.text+0xf6): undefined reference to
`RemoveVectoredExceptionHandler'
collect2: ld returned 1 exit status
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1820#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs