GDB (API)
|
00001 /* Native-dependent code for NetBSD/amd64. 00002 00003 Copyright (C) 2003-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #include "defs.h" 00021 #include "target.h" 00022 00023 #include "gdb_assert.h" 00024 00025 #include "nbsd-nat.h" 00026 #include "amd64-tdep.h" 00027 #include "amd64-nat.h" 00028 00029 /* Mapping between the general-purpose registers in NetBSD/amd64 00030 `struct reg' format and GDB's register cache layout for 00031 NetBSD/i386. 00032 00033 Note that most (if not all) NetBSD/amd64 registers are 64-bit, 00034 while the NetBSD/i386 registers are all 32-bit, but since we're 00035 little-endian we get away with that. */ 00036 00037 /* From <machine/reg.h>. */ 00038 static int amd64nbsd32_r_reg_offset[] = 00039 { 00040 14 * 8, /* %eax */ 00041 3 * 8, /* %ecx */ 00042 2 * 8, /* %edx */ 00043 13 * 8, /* %ebx */ 00044 24 * 8, /* %esp */ 00045 12 * 8, /* %ebp */ 00046 1 * 8, /* %esi */ 00047 0 * 8, /* %edi */ 00048 21 * 8, /* %eip */ 00049 23 * 8, /* %eflags */ 00050 22 * 8, /* %cs */ 00051 25 * 8, /* %ss */ 00052 18 * 8, /* %ds */ 00053 17 * 8, /* %es */ 00054 16 * 8, /* %fs */ 00055 15 * 8 /* %gs */ 00056 }; 00057 00058 00059 /* Provide a prototype to silence -Wmissing-prototypes. */ 00060 void _initialize_amd64nbsd_nat (void); 00061 00062 void 00063 _initialize_amd64nbsd_nat (void) 00064 { 00065 struct target_ops *t; 00066 00067 amd64_native_gregset32_reg_offset = amd64nbsd32_r_reg_offset; 00068 amd64_native_gregset32_num_regs = ARRAY_SIZE (amd64nbsd32_r_reg_offset); 00069 amd64_native_gregset64_reg_offset = amd64nbsd_r_reg_offset; 00070 00071 /* Add some extra features to the common *BSD/amd64 target. */ 00072 t = amd64bsd_target (); 00073 t->to_pid_to_exec_file = nbsd_pid_to_exec_file; 00074 add_target (t); 00075 }