GDB (xrefs)

/tmp/gdb-8.1/gdb/arm-nbsd-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for NetBSD/arm.
2
3 Copyright (C) 2002-2018 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 #include "defs.h"
21 #include "osabi.h"
22
23 #include "arch/arm.h"
24 #include "arm-tdep.h"
25 #include "solib-svr4.h"
26
27 /* Description of the longjmp buffer. */
28 #define ARM_NBSD_JB_PC 24
29 #define ARM_NBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE
30
31 /* For compatibility with previous implemenations of GDB on arm/NetBSD,
32 override the default little-endian breakpoint. */
33 static const gdb_byte arm_nbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6};
34 static const gdb_byte arm_nbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11};
35 static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
36 static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
37
38 static void
39 arm_netbsd_init_abi_common (struct gdbarch_info info,
40 struct gdbarch *gdbarch)
41 {
42 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
43
44 tdep->lowest_pc = 0x8000;
45 switch (info.byte_order)
46 {
47 case BFD_ENDIAN_LITTLE:
48 tdep->arm_breakpoint = arm_nbsd_arm_le_breakpoint;
49 tdep->thumb_breakpoint = arm_nbsd_thumb_le_breakpoint;
50 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_le_breakpoint);
51 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_le_breakpoint);
52 break;
53
54 case BFD_ENDIAN_BIG:
55 tdep->arm_breakpoint = arm_nbsd_arm_be_breakpoint;
56 tdep->thumb_breakpoint = arm_nbsd_thumb_be_breakpoint;
57 tdep->arm_breakpoint_size = sizeof (arm_nbsd_arm_be_breakpoint);
58 tdep->thumb_breakpoint_size = sizeof (arm_nbsd_thumb_be_breakpoint);
59 break;
60
61 default:
62 internal_error (__FILE__, __LINE__,
63 _("arm_gdbarch_init: bad byte order for float format"));
64 }
65
66 tdep->jb_pc = ARM_NBSD_JB_PC;
67 tdep->jb_elt_size = ARM_NBSD_JB_ELEMENT_SIZE;
68
69 /* Single stepping. */
70 set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
71 }
72
73 static void
74 arm_netbsd_elf_init_abi (struct gdbarch_info info,
75 struct gdbarch *gdbarch)
76 {
77 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
78
79 arm_netbsd_init_abi_common (info, gdbarch);
80 if (tdep->fp_model == ARM_FLOAT_AUTO)
81 tdep->fp_model = ARM_FLOAT_SOFT_VFP;
82
83 /* NetBSD ELF uses SVR4-style shared libraries. */
84 set_solib_svr4_fetch_link_map_offsets
85 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
86 }
87
88 void
89 _initialize_arm_netbsd_tdep (void)
90 {
91 gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_NETBSD,
92 arm_netbsd_elf_init_abi);
93 }
gdbarch
Definition: gdbarch.c:127
gdbarch_tdep::thumb_breakpoint
const gdb_byte * thumb_breakpoint
Definition: arm-tdep.h:121
arm_nbsd_thumb_be_breakpoint
static const gdb_byte arm_nbsd_thumb_be_breakpoint[]
Definition: arm-nbsd-tdep.c:36
ARM_NBSD_JB_ELEMENT_SIZE
#define ARM_NBSD_JB_ELEMENT_SIZE
Definition: arm-nbsd-tdep.c:29
gdbarch_tdep::fp_model
enum arm_float_model fp_model
Definition: arm-tdep.h:101
arm_nbsd_arm_le_breakpoint
static const gdb_byte arm_nbsd_arm_le_breakpoint[]
Definition: arm-nbsd-tdep.c:33
internal_error
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
gdbarch_tdep
Definition: aarch64-tdep.h:55
gdbarch_tdep::arm_breakpoint
const gdb_byte * arm_breakpoint
Definition: arm-tdep.h:119
svr4_ilp32_fetch_link_map_offsets
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3183
gdbarch_tdep::lowest_pc
CORE_ADDR lowest_pc
Definition: aarch64-tdep.h:58
_
#define _(String)
Definition: gdb_locale.h:35
defs.h
gdbarch_tdep
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1491
ARM_NBSD_JB_PC
#define ARM_NBSD_JB_PC
Definition: arm-nbsd-tdep.c:28
gdbarch_tdep::thumb_breakpoint_size
int thumb_breakpoint_size
Definition: arm-tdep.h:122
arm-tdep.h
solib-svr4.h
osabi.h
arm_nbsd_thumb_le_breakpoint
static const gdb_byte arm_nbsd_thumb_le_breakpoint[]
Definition: arm-nbsd-tdep.c:35
gdbarch_tdep::jb_pc
int jb_pc
Definition: aarch64-tdep.h:62
set_solib_svr4_fetch_link_map_offsets
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
Definition: solib-svr4.c:3137
ARM_FLOAT_SOFT_VFP
Definition: arm-tdep.h:72
arm_netbsd_init_abi_common
static void arm_netbsd_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: arm-nbsd-tdep.c:39
gdbarch_register_osabi
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition: osabi.c:143
gdbarch_tdep::jb_elt_size
size_t jb_elt_size
Definition: aarch64-tdep.h:65
set_gdbarch_software_single_step
void set_gdbarch_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype software_single_step)
Definition: gdbarch.c:3258
gdb_byte
bfd_byte gdb_byte
Definition: common-types.h:38
ARM_FLOAT_AUTO
Definition: arm-tdep.h:69
GDB_OSABI_NETBSD
Definition: defs.h:519
gdbarch_info
Definition: gdbarch.h:1626
arm_software_single_step
std::vector< CORE_ADDR > arm_software_single_step(struct regcache *regcache)
Definition: arm-tdep.c:6251
gdbarch_info::byte_order
enum bfd_endian byte_order
Definition: gdbarch.h:1632
arm_netbsd_elf_init_abi
static void arm_netbsd_elf_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: arm-nbsd-tdep.c:74
arm.h
_initialize_arm_netbsd_tdep
void _initialize_arm_netbsd_tdep(void)
Definition: arm-nbsd-tdep.c:89
gdbarch_tdep::arm_breakpoint_size
int arm_breakpoint_size
Definition: arm-tdep.h:120
arm_nbsd_arm_be_breakpoint
static const gdb_byte arm_nbsd_arm_be_breakpoint[]
Definition: arm-nbsd-tdep.c:34