1 /* Target-dependent code for OpenBSD/i386.
2 Copyright 1988, 1989, 1991, 1992, 1994, 1996, 2000, 2001, 2002
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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 2 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
23 #include "arch-utils.h"
27 #include "i386-tdep.h"
28 #include "i387-tdep.h"
30 /* Provide a prototype to silence -Wmissing-prototypes. */
31 void _initialize_i386obsd_tdep (void);
33 #define SIZEOF_STRUCT_REG (16 * 4)
36 i386obsd_supply_reg (char *regs
, int regno
)
40 for (i
= 0; i
<= 15; i
++)
41 if (regno
== i
|| regno
== -1)
42 supply_register (i
, regs
+ i
* 4);
46 fetch_core_registers (char *core_reg_sect
, unsigned core_reg_size
, int which
,
51 /* We get everything from one section. */
55 if (core_reg_size
< (SIZEOF_STRUCT_REG
+ 108))
57 warning ("Wrong size register set in core file.");
62 fsave
= core_reg_sect
+ SIZEOF_STRUCT_REG
;
64 /* Integer registers. */
65 i386obsd_supply_reg (regs
, -1);
67 /* Floating point registers. */
68 i387_supply_fsave (fsave
);
71 static struct core_fns i386obsd_core_fns
=
73 bfd_target_unknown_flavour
, /* core_flavour */
74 default_check_format
, /* check_format */
75 default_core_sniffer
, /* core_sniffer */
76 fetch_core_registers
, /* core_read_registers */
81 CORE_ADDR i386obsd_sigtramp_start
= 0xbfbfdf20;
82 CORE_ADDR i386obsd_sigtramp_end
= 0xbfbfdff0;
84 /* From <machine/signal.h>. */
85 int i386obsd_sc_pc_offset
= 44;
86 int i386obsd_sc_sp_offset
= 56;
89 i386obsd_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
91 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
93 /* Obviously OpenBSD is BSD-based. */
94 i386bsd_init_abi (info
, gdbarch
);
96 /* OpenBSD uses -freg-struct-return by default. */
97 tdep
->struct_return
= reg_struct_return
;
99 /* OpenBSD uses a different memory layout. */
100 tdep
->sigtramp_start
= i386obsd_sigtramp_start
;
101 tdep
->sigtramp_end
= i386obsd_sigtramp_end
;
103 /* OpenBSD has a `struct sigcontext' that's different from the
104 origional 4.3 BSD. */
105 tdep
->sc_pc_offset
= i386obsd_sc_pc_offset
;
106 tdep
->sc_sp_offset
= i386obsd_sc_sp_offset
;
110 _initialize_i386obsd_tdep (void)
112 add_core_fns (&i386obsd_core_fns
);
114 /* FIXME: kettenis/20021020: Since OpenBSD/i386 binaries are
115 indistingushable from NetBSD/i386 a.out binaries, building a GDB
116 that should support both these targets will probably not work as
118 #define GDB_OSABI_OPENBSD_AOUT GDB_OSABI_NETBSD_AOUT
120 gdbarch_register_osabi (bfd_arch_i386
, GDB_OSABI_OPENBSD_AOUT
,