gdb/i386-windows-nat.c - gdb

Global variables defined

Functions defined

Macros defined

Source code

  1. /* Copyright (C) 2008-2015 Free Software Foundation, Inc.

  2.    This file is part of GDB.

  3.    This program is free software; you can redistribute it and/or modify
  4.    it under the terms of the GNU General Public License as published by
  5.    the Free Software Foundation; either version 3 of the License, or
  6.    (at your option) any later version.

  7.    This program is distributed in the hope that it will be useful,
  8.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.    GNU General Public License for more details.

  11.    You should have received a copy of the GNU General Public License
  12.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  13. #include "defs.h"
  14. #include "windows-nat.h"
  15. #include "x86-nat.h"
  16. #include "i386-tdep.h"

  17. #include <windows.h>

  18. #define context_offset(x) ((int)&(((CONTEXT *)NULL)->x))
  19. static const int mappings[] =
  20. {
  21.   context_offset (Eax),
  22.   context_offset (Ecx),
  23.   context_offset (Edx),
  24.   context_offset (Ebx),
  25.   context_offset (Esp),
  26.   context_offset (Ebp),
  27.   context_offset (Esi),
  28.   context_offset (Edi),
  29.   context_offset (Eip),
  30.   context_offset (EFlags),
  31.   context_offset (SegCs),
  32.   context_offset (SegSs),
  33.   context_offset (SegDs),
  34.   context_offset (SegEs),
  35.   context_offset (SegFs),
  36.   context_offset (SegGs),
  37.   context_offset (FloatSave.RegisterArea[0 * 10]),
  38.   context_offset (FloatSave.RegisterArea[1 * 10]),
  39.   context_offset (FloatSave.RegisterArea[2 * 10]),
  40.   context_offset (FloatSave.RegisterArea[3 * 10]),
  41.   context_offset (FloatSave.RegisterArea[4 * 10]),
  42.   context_offset (FloatSave.RegisterArea[5 * 10]),
  43.   context_offset (FloatSave.RegisterArea[6 * 10]),
  44.   context_offset (FloatSave.RegisterArea[7 * 10]),
  45.   context_offset (FloatSave.ControlWord),
  46.   context_offset (FloatSave.StatusWord),
  47.   context_offset (FloatSave.TagWord),
  48.   context_offset (FloatSave.ErrorSelector),
  49.   context_offset (FloatSave.ErrorOffset),
  50.   context_offset (FloatSave.DataSelector),
  51.   context_offset (FloatSave.DataOffset),
  52.   context_offset (FloatSave.ErrorSelector)
  53.   /* XMM0-7 */ ,
  54.   context_offset (ExtendedRegisters[10*16]),
  55.   context_offset (ExtendedRegisters[11*16]),
  56.   context_offset (ExtendedRegisters[12*16]),
  57.   context_offset (ExtendedRegisters[13*16]),
  58.   context_offset (ExtendedRegisters[14*16]),
  59.   context_offset (ExtendedRegisters[15*16]),
  60.   context_offset (ExtendedRegisters[16*16]),
  61.   context_offset (ExtendedRegisters[17*16]),
  62.   /* MXCSR */
  63.   context_offset (ExtendedRegisters[24])
  64. };
  65. #undef context_offset

  66. /* segment_register_p_ftype implementation for x86.  */

  67. static int
  68. i386_windows_segment_register_p (int regnum)
  69. {
  70.   return regnum >= I386_CS_REGNUM && regnum <= I386_GS_REGNUM;
  71. }

  72. /* -Wmissing-prototypes */
  73. extern initialize_file_ftype _initialize_i386_windows_nat;

  74. void
  75. _initialize_i386_windows_nat (void)
  76. {
  77.   windows_set_context_register_offsets (mappings);
  78.   windows_set_segment_register_p (i386_windows_segment_register_p);
  79.   x86_set_debug_register_length (4);
  80. }