summaryrefslogtreecommitdiff
path: root/overlay/mgdb/gdb/winnt-nat.h
blob: 6dcab69c3622532fa5dfc40478b07ad86ae0d24e (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
69
70
71
72
73
74
75
76
77
/***************************************************************/
/*  mgdb: midipix-specific bits for gdb                        */
/*  Copyright (C) 2019  Z. Gilboa                              */
/*  Released under GPLv2 and GPLv3; see COPYING.MGDB.          */
/***************************************************************/

#ifndef WINNT_NAT_H
#define WINNT_NAT_H

#include <unistd.h>
#include <stdint.h>
#include <stddef.h>
#include <sys/cmd.h>
#include <sys/debug.h>

#define WINNT_DR_STATE_DIRTY		(0x1)

#define WINNT_THREAD_CONTEXT_READY	(0X0)
#define WINNT_THREAD_CONTEXT_DIRTY	(0Xffffffff)

#define WINNT_EXCEPTION_FIRST_CHANCE	0x01
#define WINNT_EXCEPTION_SECOND_CHANCE	0x02
#define WINNT_EXCEPTION_ALL		0xffffffff

#define WINNT_STATUS_ACCESS_VIOLATION	0xC0000005

struct regcache;

struct winnt_process;
struct winnt_thread;

struct winnt_process {
	int				pfd;
	pid_t				pid;
	pid_t				syspid;
	pid_t				systid;
	pid_t				flags;
	int				nmodules;
	struct __dbg_module_info *	modules;
	struct __dbg_event		event;
	char *				solibs;
	uintptr_t			dr_cache[8];
	uint32_t			dr_state;
	struct winnt_thread *		threads;
};

struct winnt_thread {
	struct winnt_thread *		next;
	struct winnt_process *		process;
	pid_t				tid;
	uint32_t			state;
	mcontext_t			regctx;
};

struct winnt_exception_filter {
	uint32_t			exception_code;
	uint32_t			exception_flags;
	const char *			exception_module;
};

void amd64_winnt_fetch_registers(
	struct regcache *, int regnum,
	struct winnt_thread *);

void amd64_winnt_store_registers(
	const struct regcache *, int regnum,
	struct winnt_thread *);

void i386_winnt_fetch_registers(
	struct regcache *, int regnum,
	struct winnt_thread *);

void i386_winnt_store_registers(
	const struct regcache *, int regnum,
	struct winnt_thread *);

#endif