gdb/amd64-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 "amd64-tdep.h"

  17. #include <windows.h>

  18. #define context_offset(x) (offsetof (CONTEXT, x))
  19. static const int mappings[] =
  20. {
  21.   context_offset (Rax),
  22.   context_offset (Rbx),
  23.   context_offset (Rcx),
  24.   context_offset (Rdx),
  25.   context_offset (Rsi),
  26.   context_offset (Rdi),
  27.   context_offset (Rbp),
  28.   context_offset (Rsp),
  29.   context_offset (R8),
  30.   context_offset (R9),
  31.   context_offset (R10),
  32.   context_offset (R11),
  33.   context_offset (R12),
  34.   context_offset (R13),
  35.   context_offset (R14),
  36.   context_offset (R15),
  37.   context_offset (Rip),
  38.   context_offset (EFlags),
  39.   context_offset (SegCs),
  40.   context_offset (SegSs),
  41.   context_offset (SegDs),
  42.   context_offset (SegEs),
  43.   context_offset (SegFs),
  44.   context_offset (SegGs),
  45.   context_offset (FloatSave.FloatRegisters[0]),
  46.   context_offset (FloatSave.FloatRegisters[1]),
  47.   context_offset (FloatSave.FloatRegisters[2]),
  48.   context_offset (FloatSave.FloatRegisters[3]),
  49.   context_offset (FloatSave.FloatRegisters[4]),
  50.   context_offset (FloatSave.FloatRegisters[5]),
  51.   context_offset (FloatSave.FloatRegisters[6]),
  52.   context_offset (FloatSave.FloatRegisters[7]),
  53.   context_offset (FloatSave.ControlWord),
  54.   context_offset (FloatSave.StatusWord),
  55.   context_offset (FloatSave.TagWord),
  56.   context_offset (FloatSave.ErrorSelector),
  57.   context_offset (FloatSave.ErrorOffset),
  58.   context_offset (FloatSave.DataSelector),
  59.   context_offset (FloatSave.DataOffset),
  60.   context_offset (FloatSave.ErrorSelector)
  61.   /* XMM0-7 */ ,
  62.   context_offset (Xmm0),
  63.   context_offset (Xmm1),
  64.   context_offset (Xmm2),
  65.   context_offset (Xmm3),
  66.   context_offset (Xmm4),
  67.   context_offset (Xmm5),
  68.   context_offset (Xmm6),
  69.   context_offset (Xmm7),
  70.   context_offset (Xmm8),
  71.   context_offset (Xmm9),
  72.   context_offset (Xmm10),
  73.   context_offset (Xmm11),
  74.   context_offset (Xmm12),
  75.   context_offset (Xmm13),
  76.   context_offset (Xmm14),
  77.   context_offset (Xmm15),
  78.   /* MXCSR */
  79.   context_offset (FloatSave.MxCsr)
  80. };
  81. #undef context_offset

  82. /* segment_register_p_ftype implementation for amd64.  */

  83. static int
  84. amd64_windows_segment_register_p (int regnum)
  85. {
  86.   return regnum >= AMD64_CS_REGNUM && regnum <= AMD64_GS_REGNUM;
  87. }

  88. /* -Wmissing-prototypes */
  89. extern initialize_file_ftype _initialize_amd64_windows_nat;

  90. void
  91. _initialize_amd64_windows_nat (void)
  92. {
  93.   windows_set_context_register_offsets (mappings);
  94.   windows_set_segment_register_p (amd64_windows_segment_register_p);
  95.   x86_set_debug_register_length (8);
  96. }