GDB (API)
|
00001 /* Target-dependent code for NetBSD/arm. 00002 00003 Copyright (C) 2002-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 "osabi.h" 00022 00023 #include "gdb_string.h" 00024 00025 #include "arm-tdep.h" 00026 #include "solib-svr4.h" 00027 00028 /* Description of the longjmp buffer. */ 00029 #define ARM_NBSD_JB_PC 24 00030 #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE 00031 00032 /* For compatibility with previous implemenations of GDB on arm/NetBSD, 00033 override the default little-endian breakpoint. */ 00034 static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6}; 00035 static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11}; 00036 static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde}; 00037 static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe}; 00038 00039 static void 00040 arm_netbsd_init_abi_common (struct gdbarch_info info, 00041 struct gdbarch *gdbarch) 00042 { 00043 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 00044 00045 tdep->lowest_pc = 0x8000; 00046 switch (info.byte_order) 00047 { 00048 case BFD_ENDIAN_LITTLE: 00049 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint; 00050 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint; 00051 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint); 00052 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint); 00053 break; 00054 00055 case BFD_ENDIAN_BIG: 00056 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint; 00057 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint; 00058 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint); 00059 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint); 00060 break; 00061 00062 default: 00063 internal_error (__FILE__, __LINE__, 00064 _("arm_gdbarch_init: bad byte order for float format")); 00065 } 00066 00067 tdep->jb_pc = ARM_NBSD_JB_PC; 00068 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE; 00069 00070 /* Single stepping. */ 00071 set_gdbarch_software_single_step (gdbarch, arm_software_single_step); 00072 } 00073 00074 static void 00075 arm_netbsd_aout_init_abi (struct gdbarch_info info, 00076 struct gdbarch *gdbarch) 00077 { 00078 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 00079 00080 arm_netbsd_init_abi_common (info, gdbarch); 00081 if (tdep->fp_model == ARM_FLOAT_AUTO) 00082 tdep->fp_model = ARM_FLOAT_SOFT_FPA; 00083 } 00084 00085 static void 00086 arm_netbsd_elf_init_abi (struct gdbarch_info info, 00087 struct gdbarch *gdbarch) 00088 { 00089 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); 00090 00091 arm_netbsd_init_abi_common (info, gdbarch); 00092 if (tdep->fp_model == ARM_FLOAT_AUTO) 00093 tdep->fp_model = ARM_FLOAT_SOFT_VFP; 00094 00095 /* NetBSD ELF uses SVR4-style shared libraries. */ 00096 set_solib_svr4_fetch_link_map_offsets 00097 (gdbarch, svr4_ilp32_fetch_link_map_offsets); 00098 } 00099 00100 static enum gdb_osabi 00101 arm_netbsd_aout_osabi_sniffer (bfd *abfd) 00102 { 00103 if (strcmp (bfd_get_target (abfd), "a.out-arm-netbsd") == 0) 00104 return GDB_OSABI_NETBSD_AOUT; 00105 00106 return GDB_OSABI_UNKNOWN; 00107 } 00108 00109 /* Provide a prototype to silence -Wmissing-prototypes. */ 00110 extern initialize_file_ftype _initialize_arm_netbsd_tdep; 00111 00112 void 00113 _initialize_arm_netbsd_tdep (void) 00114 { 00115 gdbarch_register_osabi_sniffer (bfd_arch_arm, bfd_target_aout_flavour, 00116 arm_netbsd_aout_osabi_sniffer); 00117 00118 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_AOUT, 00119 arm_netbsd_aout_init_abi); 00120 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD_ELF, 00121 arm_netbsd_elf_init_abi); 00122 }