use gnulib's update-copyright script to update copyright years
[deliverable/binutils-gdb.git] / gdb / shnbsd-tdep.c
CommitLineData
54fe9172
MK
1/* Target-dependent code for NetBSD/sh.
2
7b6bb8da 3 Copyright (C) 2002, 2003, 2006, 2007, 2008, 2009, 2010, 2011
0fb0cc75 4 Free Software Foundation, Inc.
54fe9172 5
13a38d45
JT
6 Contributed by Wasabi Systems, Inc.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
a9762ec7 12 the Free Software Foundation; either version 3 of the License, or
13a38d45
JT
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
a9762ec7 21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
13a38d45
JT
22
23#include "defs.h"
24#include "gdbcore.h"
861fb77c 25#include "regset.h"
13a38d45 26#include "value.h"
4be87837 27#include "osabi.h"
13a38d45 28
861fb77c 29#include "gdb_string.h"
9964235a 30
ab3b8126 31#include "sh-tdep.h"
861fb77c 32#include "solib-svr4.h"
13a38d45 33
c9ac0a72 34/* Convert a register number into an offset into a ptrace
13a38d45 35 register structure. */
c9ac0a72 36static const struct sh_corefile_regmap regmap[] =
13a38d45 37{
c9ac0a72
AS
38 {R0_REGNUM, 20 * 4},
39 {R0_REGNUM + 1, 19 * 4},
40 {R0_REGNUM + 2, 18 * 4},
41 {R0_REGNUM + 3, 17 * 4},
42 {R0_REGNUM + 4, 16 * 4},
43 {R0_REGNUM + 5, 15 * 4},
44 {R0_REGNUM + 6, 14 * 4},
45 {R0_REGNUM + 7, 13 * 4},
46 {R0_REGNUM + 8, 12 * 4},
47 {R0_REGNUM + 9, 11 * 4},
48 {R0_REGNUM + 10, 10 * 4},
49 {R0_REGNUM + 11, 9 * 4},
50 {R0_REGNUM + 12, 8 * 4},
51 {R0_REGNUM + 13, 7 * 4},
52 {R0_REGNUM + 14, 6 * 4},
53 {R0_REGNUM + 15, 5 * 4},
54 {PC_REGNUM, 0 * 4},
55 {SR_REGNUM, 1 * 4},
56 {PR_REGNUM, 2 * 4},
57 {MACH_REGNUM, 3 * 4},
58 {MACL_REGNUM, 4 * 4},
59 {-1 /* Terminator. */, 0}
13a38d45 60};
861fb77c 61\f
13a38d45
JT
62
63static void
20cb8cda 64shnbsd_init_abi (struct gdbarch_info info,
13a38d45
JT
65 struct gdbarch *gdbarch)
66{
c9ac0a72
AS
67 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
68
69 tdep->core_gregmap = (struct sh_corefile_regmap *)regmap;
861fb77c
MK
70
71 set_solib_svr4_fetch_link_map_offsets
72 (gdbarch, svr4_ilp32_fetch_link_map_offsets);
73}
74\f
75
76/* OpenBSD uses uses the traditional NetBSD core file format, even for
77 ports that use ELF. */
78#define GDB_OSABI_NETBSD_CORE GDB_OSABI_OPENBSD_ELF
79
80static enum gdb_osabi
81shnbsd_core_osabi_sniffer (bfd *abfd)
82{
83 if (strcmp (bfd_get_target (abfd), "netbsd-core") == 0)
84 return GDB_OSABI_NETBSD_CORE;
85
86 return GDB_OSABI_UNKNOWN;
13a38d45
JT
87}
88
63807e1d
PA
89/* Provide a prototype to silence -Wmissing-prototypes. */
90extern initialize_file_ftype _initialize_shnbsd_tdep;
91
13a38d45 92void
20cb8cda 93_initialize_shnbsd_tdep (void)
13a38d45 94{
861fb77c
MK
95 /* BFD doesn't set a flavour for NetBSD style a.out core files. */
96 gdbarch_register_osabi_sniffer (bfd_arch_sh, bfd_target_unknown_flavour,
97 shnbsd_core_osabi_sniffer);
13a38d45 98
05816f70
MK
99 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_NETBSD_ELF,
100 shnbsd_init_abi);
54fe9172
MK
101 gdbarch_register_osabi (bfd_arch_sh, 0, GDB_OSABI_OPENBSD_ELF,
102 shnbsd_init_abi);
13a38d45 103}
This page took 0.988459 seconds and 4 git commands to generate.