GDB (xrefs)

/tmp/gdb-8.1/gdb/sh-nbsd-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for NetBSD/sh.
2
3 Copyright (C) 2002-2018 Free Software Foundation, Inc.
4
5 Contributed by Wasabi Systems, Inc.
6
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21
22 #include "defs.h"
23 #include "gdbcore.h"
24 #include "regset.h"
25 #include "value.h"
26 #include "osabi.h"
27
28 #include "sh-tdep.h"
29 #include "solib-svr4.h"
30
31 /* Convert a register number into an offset into a ptrace
32 register structure. */
33 static const struct sh_corefile_regmap regmap[] =
34 {
35 {R0_REGNUM, 20 * 4},
36 {R0_REGNUM + 1, 19 * 4},
37 {R0_REGNUM + 2, 18 * 4},
38 {R0_REGNUM + 3, 17 * 4},
39 {R0_REGNUM + 4, 16 * 4},
40 {R0_REGNUM + 5, 15 * 4},
41 {R0_REGNUM + 6, 14 * 4},
42 {R0_REGNUM + 7, 13 * 4},
43 {R0_REGNUM + 8, 12 * 4},
44 {R0_REGNUM + 9, 11 * 4},
45 {R0_REGNUM + 10, 10 * 4},
46 {R0_REGNUM + 11, 9 * 4},
47 {R0_REGNUM + 12, 8 * 4},
48 {R0_REGNUM + 13, 7 * 4},
49 {R0_REGNUM + 14, 6 * 4},
50 {R0_REGNUM + 15, 5 * 4},
51 {PC_REGNUM, 0 * 4},
52 {SR_REGNUM, 1 * 4},
53 {PR_REGNUM, 2 * 4},
54 {MACH_REGNUM, 3 * 4},
55 {MACL_REGNUM, 4 * 4},
56 {-1 /* Terminator. */, 0}
57 };
58
59
60 static void
61 shnbsd_init_abi (struct gdbarch_info info,
62 struct gdbarch *gdbarch)
63 {
64 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
65
66 tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
67 tdep->sizeof_gregset = 84;
68
69 set_solib_svr4_fetch_link_map_offsets
70 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
71 }
72
73 void
74 _initialize_shnbsd_tdep (void)
75 {
76 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD,
77 shnbsd_init_abi);
78 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD,
79 shnbsd_init_abi);
80 }
gdbarch
Definition: gdbarch.c:127
SR_REGNUM
Definition: sh-tdep.h:38
_initialize_shnbsd_tdep
void _initialize_shnbsd_tdep(void)
Definition: sh-nbsd-tdep.c:74
gdbarch_tdep::core_gregmap
struct sh_corefile_regmap * core_gregmap
Definition: sh-tdep.h:97
gdbarch_tdep
Definition: aarch64-tdep.h:55
svr4_ilp32_fetch_link_map_offsets
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3183
defs.h
gdbarch_tdep
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1491
regmap
static const struct sh_corefile_regmap regmap[]
Definition: sh-nbsd-tdep.c:33
PR_REGNUM
Definition: sh-tdep.h:33
PC_REGNUM
Definition: sh-tdep.h:32
MACH_REGNUM
Definition: sh-tdep.h:36
shnbsd_init_abi
static void shnbsd_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: sh-nbsd-tdep.c:61
solib-svr4.h
osabi.h
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
R0_REGNUM
Definition: m32r-tdep.h:32
MACL_REGNUM
Definition: sh-tdep.h:37
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
gdbcore.h
GDB_OSABI_NETBSD
Definition: defs.h:519
gdbarch_tdep::sizeof_gregset
size_t sizeof_gregset
Definition: i386-tdep.h:63
value.h
sh_corefile_regmap
Definition: sh-tdep.h:86
gdbarch_info
Definition: gdbarch.h:1626
sh-tdep.h
regset.h
GDB_OSABI_OPENBSD
Definition: defs.h:520