GDB (API)
|
00001 /* Copyright (C) 2008-2013 Free Software Foundation, Inc. 00002 00003 This file is part of GDB. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00017 00018 #include "defs.h" 00019 #include "windows-nat.h" 00020 #include "i386-nat.h" 00021 #include "i386-tdep.h" 00022 00023 #include <windows.h> 00024 00025 #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x)) 00026 static const int mappings[] = 00027 { 00028 context_offset (Eax), 00029 context_offset (Ecx), 00030 context_offset (Edx), 00031 context_offset (Ebx), 00032 context_offset (Esp), 00033 context_offset (Ebp), 00034 context_offset (Esi), 00035 context_offset (Edi), 00036 context_offset (Eip), 00037 context_offset (EFlags), 00038 context_offset (SegCs), 00039 context_offset (SegSs), 00040 context_offset (SegDs), 00041 context_offset (SegEs), 00042 context_offset (SegFs), 00043 context_offset (SegGs), 00044 context_offset (FloatSave.RegisterArea[0 * 10]), 00045 context_offset (FloatSave.RegisterArea[1 * 10]), 00046 context_offset (FloatSave.RegisterArea[2 * 10]), 00047 context_offset (FloatSave.RegisterArea[3 * 10]), 00048 context_offset (FloatSave.RegisterArea[4 * 10]), 00049 context_offset (FloatSave.RegisterArea[5 * 10]), 00050 context_offset (FloatSave.RegisterArea[6 * 10]), 00051 context_offset (FloatSave.RegisterArea[7 * 10]), 00052 context_offset (FloatSave.ControlWord), 00053 context_offset (FloatSave.StatusWord), 00054 context_offset (FloatSave.TagWord), 00055 context_offset (FloatSave.ErrorSelector), 00056 context_offset (FloatSave.ErrorOffset), 00057 context_offset (FloatSave.DataSelector), 00058 context_offset (FloatSave.DataOffset), 00059 context_offset (FloatSave.ErrorSelector) 00060 /* XMM0-7 */ , 00061 context_offset (ExtendedRegisters[10*16]), 00062 context_offset (ExtendedRegisters[11*16]), 00063 context_offset (ExtendedRegisters[12*16]), 00064 context_offset (ExtendedRegisters[13*16]), 00065 context_offset (ExtendedRegisters[14*16]), 00066 context_offset (ExtendedRegisters[15*16]), 00067 context_offset (ExtendedRegisters[16*16]), 00068 context_offset (ExtendedRegisters[17*16]), 00069 /* MXCSR */ 00070 context_offset (ExtendedRegisters[24]) 00071 }; 00072 #undef context_offset 00073 00074 /* segment_register_p_ftype implementation for x86. */ 00075 00076 static int 00077 i386_windows_segment_register_p (int regnum) 00078 { 00079 return regnum >= I386_CS_REGNUM && regnum <= I386_GS_REGNUM; 00080 } 00081 00082 /* -Wmissing-prototypes */ 00083 extern initialize_file_ftype _initialize_i386_windows_nat; 00084 00085 void 00086 _initialize_i386_windows_nat (void) 00087 { 00088 windows_set_context_register_offsets (mappings); 00089 windows_set_segment_register_p (i386_windows_segment_register_p); 00090 i386_set_debug_register_length (4); 00091 }