GDB (xrefs)

/tmp/gdb-8.1/gdb/i386-windows-nat.c
Go to the documentation of this file.
1 /* Copyright (C) 2008-2018 Free Software Foundation, Inc.
2
3 This file is part of GDB.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 #include "defs.h"
19 #include "windows-nat.h"
20 #include "x86-nat.h"
21 #include "i386-tdep.h"
22
23 #include <windows.h>
24
25 #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
26 static const int mappings[] =
27 {
28 context_offset (Eax),
29 context_offset (Ecx),
30 context_offset (Edx),
31 context_offset (Ebx),
32 context_offset (Esp),
33 context_offset (Ebp),
34 context_offset (Esi),
35 context_offset (Edi),
36 context_offset (Eip),
37 context_offset (EFlags),
38 context_offset (SegCs),
39 context_offset (SegSs),
40 context_offset (SegDs),
41 context_offset (SegEs),
42 context_offset (SegFs),
43 context_offset (SegGs),
44 context_offset (FloatSave.RegisterArea[0 * 10]),
45 context_offset (FloatSave.RegisterArea[1 * 10]),
46 context_offset (FloatSave.RegisterArea[2 * 10]),
47 context_offset (FloatSave.RegisterArea[3 * 10]),
48 context_offset (FloatSave.RegisterArea[4 * 10]),
49 context_offset (FloatSave.RegisterArea[5 * 10]),
50 context_offset (FloatSave.RegisterArea[6 * 10]),
51 context_offset (FloatSave.RegisterArea[7 * 10]),
52 context_offset (FloatSave.ControlWord),
53 context_offset (FloatSave.StatusWord),
54 context_offset (FloatSave.TagWord),
55 context_offset (FloatSave.ErrorSelector),
56 context_offset (FloatSave.ErrorOffset),
57 context_offset (FloatSave.DataSelector),
58 context_offset (FloatSave.DataOffset),
59 context_offset (FloatSave.ErrorSelector)
60 /* XMM0-7 */ ,
61 context_offset (ExtendedRegisters[10*16]),
62 context_offset (ExtendedRegisters[11*16]),
63 context_offset (ExtendedRegisters[12*16]),
64 context_offset (ExtendedRegisters[13*16]),
65 context_offset (ExtendedRegisters[14*16]),
66 context_offset (ExtendedRegisters[15*16]),
67 context_offset (ExtendedRegisters[16*16]),
68 context_offset (ExtendedRegisters[17*16]),
69 /* MXCSR */
70 context_offset (ExtendedRegisters[24])
71 };
72 #undef context_offset
73
74 /* segment_register_p_ftype implementation for x86. */
75
76 static int
77 i386_windows_segment_register_p (int regnum)
78 {
79 return regnum >= I386_CS_REGNUM && regnum <= I386_GS_REGNUM;
80 }
81
82 void
83 _initialize_i386_windows_nat (void)
84 {
85 windows_set_context_register_offsets (mappings);
86 windows_set_segment_register_p (i386_windows_segment_register_p);
87 x86_set_debug_register_length (4);
88 }
defs.h
windows_set_context_register_offsets
void windows_set_context_register_offsets(const int *offsets)
Definition: windows-nat.c:309
I386_CS_REGNUM
Definition: i386-tdep.h:281
I386_GS_REGNUM
Definition: i386-tdep.h:286
windows-nat.h
x86-nat.h
context_offset
#define context_offset(x)
Definition: i386-windows-nat.c:25
i386_windows_segment_register_p
static int i386_windows_segment_register_p(int regnum)
Definition: i386-windows-nat.c:77
regnum
int regnum
Definition: aarch64-tdep.c:77
mappings
static const int mappings[]
Definition: i386-windows-nat.c:26
_initialize_i386_windows_nat
void _initialize_i386_windows_nat(void)
Definition: i386-windows-nat.c:83
x86_set_debug_register_length
void x86_set_debug_register_length(int len)
Definition: x86-nat.c:303
i386-tdep.h
windows_set_segment_register_p
void windows_set_segment_register_p(segment_register_p_ftype *fun)
Definition: windows-nat.c:317