Cygwin: (mostly) drop NT4 and Samba < 3.0 support
[newlib-cygwin.git] / winsup / cygwin / local_includes / exception.h
blob13159d17b0bc4ccb81e26d82fc517f4361fa2a68
1 /* exception.h
3 This software is a copyrighted work licensed under the terms of the
4 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
5 details. */
7 #pragma once
9 #define exception_list void
10 typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT;
12 class exception
14 static EXCEPTION_DISPOSITION myfault (EXCEPTION_RECORD *, exception_list *,
15 CONTEXT *, PDISPATCHER_CONTEXT);
16 static EXCEPTION_DISPOSITION handle (EXCEPTION_RECORD *, exception_list *,
17 CONTEXT *, PDISPATCHER_CONTEXT);
18 public:
19 exception () __attribute__ ((always_inline))
21 /* Install SEH handler. */
22 asm volatile ("\n\
23 1: \n\
24 .seh_handler \
25 _ZN9exception6handleEP17_EXCEPTION_RECORDPvP8_CONTEXTP19_DISPATCHER_CONTEXT, \
26 @except \n\
27 .seh_handlerdata \n\
28 .long 1 \n\
29 .rva 1b, 2f, 2f, 2f \n\
30 .seh_code \n");
32 ~exception () __attribute__ ((always_inline))
34 asm volatile ("\n\
35 nop \n\
36 2: \n\
37 nop \n");
41 LONG CALLBACK myfault_altstack_handler (EXCEPTION_POINTERS *);
43 class cygwin_exception
45 PUINT_PTR framep;
46 PCONTEXT ctx;
47 EXCEPTION_RECORD *e;
48 HANDLE h;
49 void dump_exception ();
50 void open_stackdumpfile ();
51 public:
52 cygwin_exception (PUINT_PTR in_framep, PCONTEXT in_ctx = NULL, EXCEPTION_RECORD *in_e = NULL):
53 framep (in_framep), ctx (in_ctx), e (in_e), h (NULL) {}
54 void dumpstack ();
55 PCONTEXT context () const {return ctx;}
56 EXCEPTION_RECORD *exception_record () const {return e;}