GDB (xrefs)
/tmp/gdb-8.1/gdb/arm-obsd-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for OpenBSD/arm.
2 
3  Copyright (C) 2006-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 #include "trad-frame.h"
23 #include "tramp-frame.h"
24 
25 #include "obsd-tdep.h"
26 #include "arm-tdep.h"
27 #include "solib-svr4.h"
28 
29 /* Signal trampolines. */
30 
31 static void
32 armobsd_sigframe_init (const struct tramp_frame *self,
33  struct frame_info *this_frame,
34  struct trad_frame_cache *cache,
36 {
38  int regnum;
39 
40  /* We find the appropriate instance of `struct sigcontext' at a
41  fixed offset in the signal frame. */
43  sigcontext_addr = sp + 16;
44 
45  /* PC. */
47 
48  /* GPRs. */
49  for (regnum = ARM_A1_REGNUM, addr = sigcontext_addr + 12;
50  regnum <= ARM_LR_REGNUM; regnum++, addr += 4)
51  trad_frame_set_reg_addr (cache, regnum, addr);
52 
54 }
55 
56 static const struct tramp_frame armobsd_sigframe =
57 {
59  4,
60  {
61  { 0xe28d0010, -1 }, /* add r0, sp, #16 */
62  { 0xef000067, -1 }, /* swi SYS_sigreturn */
63  { 0xef000001, -1 }, /* swi SYS_exit */
64  { 0xeafffffc, -1 }, /* b . - 8 */
65  { TRAMP_SENTINEL_INSN, -1 }
66  },
68 };
69 
70 
71 /* Override default thumb breakpoints. */
72 static const gdb_byte arm_obsd_thumb_le_breakpoint[] = {0xfe, 0xdf};
73 static const gdb_byte arm_obsd_thumb_be_breakpoint[] = {0xdf, 0xfe};
74 
75 static void
77  struct gdbarch *gdbarch)
78 {
79  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
80 
81  if (tdep->fp_model == ARM_FLOAT_AUTO)
83 
85 
86  /* OpenBSD/arm uses SVR4-style shared libraries. */
90 
91  tdep->jb_pc = 24;
92  tdep->jb_elt_size = 4;
93 
96 
97  /* OpenBSD/arm uses -fpcc-struct-return by default. */
99 
100  /* Single stepping. */
102 
103  /* Breakpoints. */
104  switch (info.byte_order)
105  {
106  case BFD_ENDIAN_BIG:
109  break;
110 
111  case BFD_ENDIAN_LITTLE:
114  break;
115  }
116 }
117 
118 void
120 {
121  gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_OPENBSD,
123 }
void _initialize_armobsd_tdep(void)
void trad_frame_set_reg_addr(struct trad_frame_cache *this_trad_cache, int regnum, CORE_ADDR addr)
Definition: trad-frame.c:126
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition: frame.c:624
const gdb_byte * thumb_breakpoint
Definition: arm-tdep.h:121
bfd_vma CORE_ADDR
Definition: common-types.h:41
#define TRAMP_SENTINEL_INSN
Definition: tramp-frame.h:44
void(* func)(char *)
void trad_frame_set_id(struct trad_frame_cache *this_trad_cache, struct frame_id this_id)
Definition: trad-frame.c:171
enum arm_float_model fp_model
Definition: arm-tdep.h:101
static const gdb_byte arm_obsd_thumb_be_breakpoint[]
Definition: arm-obsd-tdep.c:73
CORE_ADDR(* sigcontext_addr)(struct frame_info *)
Definition: alpha-tdep.h:82
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3183
static void armobsd_sigframe_init(const struct tramp_frame *self, struct frame_info *this_frame, struct trad_frame_cache *cache, CORE_ADDR func)
Definition: arm-obsd-tdep.c:32
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1491
static const gdb_byte arm_obsd_thumb_le_breakpoint[]
Definition: arm-obsd-tdep.c:72
static void armobsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: arm-obsd-tdep.c:76
int thumb_breakpoint_size
Definition: arm-tdep.h:122
enum struct_return struct_return
Definition: arm-tdep.h:137
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
Definition: solib-svr4.c:3137
LONGEST get_frame_register_signed(struct frame_info *frame, int regnum)
Definition: frame.c:1273
int regnum
Definition: aarch64-tdep.c:77
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
size_t jb_elt_size
Definition: aarch64-tdep.h:65
void set_gdbarch_software_single_step(struct gdbarch *gdbarch, gdbarch_software_single_step_ftype software_single_step)
Definition: gdbarch.c:3258
bfd_byte gdb_byte
Definition: common-types.h:38
void tramp_frame_prepend_unwinder(struct gdbarch *gdbarch, const struct tramp_frame *tramp_frame)
Definition: tramp-frame.c:146
struct m32c_reg * sp
Definition: m32c-tdep.c:119
std::vector< CORE_ADDR > arm_software_single_step(struct regcache *regcache)
Definition: arm-tdep.c:6251
static const struct tramp_frame armobsd_sigframe
Definition: arm-obsd-tdep.c:56
CORE_ADDR obsd_skip_solib_resolver(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition: obsd-tdep.c:28
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
Definition: gdbarch.c:3647
enum bfd_endian byte_order
Definition: gdbarch.h:1632
void set_gdbarch_skip_solib_resolver(struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
Definition: gdbarch.c:3333
void armbsd_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
Definition: arm-bsd-tdep.c:115