gdb/amd64nbsd-nat.c - gdb

Global variables defined

Functions defined

Source code

  1. /* Native-dependent code for NetBSD/amd64.

  2.    Copyright (C) 2003-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

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

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

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

  14. #include "defs.h"
  15. #include "target.h"

  16. #include "nbsd-nat.h"
  17. #include "amd64-tdep.h"
  18. #include "amd64-nat.h"

  19. /* Mapping between the general-purpose registers in NetBSD/amd64
  20.    `struct reg' format and GDB's register cache layout for
  21.    NetBSD/i386.

  22.    Note that most (if not all) NetBSD/amd64 registers are 64-bit,
  23.    while the NetBSD/i386 registers are all 32-bit, but since we're
  24.    little-endian we get away with that.  */

  25. /* From <machine/reg.h>.  */
  26. static int amd64nbsd32_r_reg_offset[] =
  27. {
  28.   14 * 8,                        /* %eax */
  29.   3 * 8,                        /* %ecx */
  30.   2 * 8,                        /* %edx */
  31.   13 * 8,                        /* %ebx */
  32.   24 * 8,                        /* %esp */
  33.   12 * 8,                        /* %ebp */
  34.   1 * 8,                        /* %esi */
  35.   0 * 8,                        /* %edi */
  36.   21 * 8,                        /* %eip */
  37.   23 * 8,                        /* %eflags */
  38.   22 * 8,                        /* %cs */
  39.   25 * 8,                        /* %ss */
  40.   18 * 8,                        /* %ds */
  41.   17 * 8,                        /* %es */
  42.   16 * 8,                        /* %fs */
  43.   15 * 8                        /* %gs */
  44. };


  45. /* Provide a prototype to silence -Wmissing-prototypes.  */
  46. void _initialize_amd64nbsd_nat (void);

  47. void
  48. _initialize_amd64nbsd_nat (void)
  49. {
  50.   struct target_ops *t;

  51.   amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset;
  52.   amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset);
  53.   amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset;

  54.   /* Add some extra features to the common *BSD/amd64 target.  */
  55.   t = amd64bsd_target ();
  56.   t->to_pid_to_exec_file = nbsd_pid_to_exec_file;
  57.   add_target (t);
  58. }