Welcome to mirror list, hosted at ThFree Co, Russian Federation.

exutil.c « seh « samples « mingw « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9d98d835003b2f79d37801cc8cf794d771fc2154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

#include <stdlib.h>
#include <stdio.h>
#include <excpt.h>
#include <windows.h>

#include "exutil.h"

void
WalkExceptionHandlers ()
{
	PEXCEPTION_REGISTRATION_RECORD	p;
	int				i;

	__asm__("movl %%fs:0,%%eax;movl %%eax,%0" : "=g" (p) : : "%eax");

	i = 0;
	while (p != (PEXCEPTION_REGISTRATION_RECORD) -1 && p)
	{
		printf ("Registration %d at %08x : ", i, p);
		printf ("Handler = %08x ", p->handler);
		printf ("Next Registration = %08x\n", p->prev);
		p = p->prev;
		i++;
	}
	printf ("End of exception handler list.\n");
	fflush (stdout);
}

void
DumpExceptionRecord (struct _EXCEPTION_RECORD* pExRec)
{
	printf ("Exception: Code = %08x Flags %08x", pExRec->ExceptionCode,
		pExRec->ExceptionFlags);

	if (pExRec->ExceptionFlags)
	{
		printf (" ( ");
		if (pExRec->ExceptionFlags & EH_NONCONTINUABLE)
		{
			printf ("EH_NONCONTINUABLE ");
		}
		if (pExRec->ExceptionFlags & EH_UNWINDING)
		{
			printf ("EH_UNWINDING ");
		}
		if (pExRec->ExceptionFlags & EH_EXIT_UNWIND)
		{
			printf ("EH_EXIT_UNWIND ");
		}
		if (pExRec->ExceptionFlags & EH_STACK_INVALID)
		{
			printf ("EH_STACK_INVALID ");
		}
		if (pExRec->ExceptionFlags & EH_NESTED_CALL)
		{
			printf ("EH_NESTED_CALL ");
		}
		printf (")\n");
	}
	else
	{
		printf ("\n");
	}

	fflush(stdout);
}