GDB (xrefs)

/tmp/gdb-8.1/gdb/i386-go32-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for DJGPP/i386.
2
3 Copyright (C) 1988-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 "i386-tdep.h"
22 #include "x86-xstate.h"
23 #include "target-descriptions.h"
24 #include "osabi.h"
25
26 static void
27 i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
28 {
29 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
30
31 /* DJGPP doesn't have any special frames for signal handlers. */
32 tdep->sigtramp_p = NULL;
33
34 tdep->jb_pc_offset = 36;
35
36 /* DJGPP does not support the SSE registers. */
37 if (!tdesc_has_registers (info.target_desc))
38 tdep->tdesc = i386_target_description (X86_XSTATE_X87_MASK);
39
40 /* Native compiler is GCC, which uses the SVR4 register numbering
41 even in COFF and STABS. See the comment in i386_gdbarch_init,
42 before the calls to set_gdbarch_stab_reg_to_regnum and
43 set_gdbarch_sdb_reg_to_regnum. */
44 set_gdbarch_stab_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
45 set_gdbarch_sdb_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
46
47 set_gdbarch_has_dos_based_file_system (gdbarch, 1);
48
49 set_gdbarch_wchar_bit (gdbarch, 16);
50 set_gdbarch_wchar_signed (gdbarch, 0);
51 }
52
53
54 static enum gdb_osabi
55 i386_coff_osabi_sniffer (bfd *abfd)
56 {
57 if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0
58 || strcmp (bfd_get_target (abfd), "coff-go32") == 0)
59 return GDB_OSABI_GO32;
60
61 return GDB_OSABI_UNKNOWN;
62 }
63
64
65 void
66 _initialize_i386_go32_tdep ()
67 {
68 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
69 i386_coff_osabi_sniffer);
70
71 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
72 i386_go32_init_abi);
73 }
gdbarch
Definition: gdbarch.c:127
gdbarch_tdep::jb_pc_offset
int jb_pc_offset
Definition: i386-tdep.h:210
set_gdbarch_wchar_bit
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
Definition: gdbarch.c:1789
set_gdbarch_stab_reg_to_regnum
void set_gdbarch_stab_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
Definition: gdbarch.c:2224
set_gdbarch_sdb_reg_to_regnum
void set_gdbarch_sdb_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_sdb_reg_to_regnum_ftype sdb_reg_to_regnum)
Definition: gdbarch.c:2258
gdbarch_tdep
Definition: aarch64-tdep.h:55
gdbarch_register_osabi_sniffer
void gdbarch_register_osabi_sniffer(enum bfd_architecture arch, enum bfd_flavour flavour, enum gdb_osabi(*sniffer_fn)(bfd *))
Definition: osabi.c:219
x86-xstate.h
defs.h
gdbarch_tdep
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1491
GDB_OSABI_UNKNOWN
Definition: defs.h:512
set_gdbarch_wchar_signed
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
Definition: gdbarch.c:1807
osabi.h
GDB_OSABI_GO32
Definition: defs.h:522
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
i386_coff_osabi_sniffer
static enum gdb_osabi i386_coff_osabi_sniffer(bfd *abfd)
Definition: i386-go32-tdep.c:55
gdbarch_info::target_desc
const struct target_desc * target_desc
Definition: gdbarch.h:1660
X86_XSTATE_X87_MASK
#define X86_XSTATE_X87_MASK
Definition: x86-xstate.h:41
gdbarch_tdep::sigtramp_p
int(* sigtramp_p)(struct frame_info *)
Definition: i386-tdep.h:220
i386_svr4_reg_to_regnum
int i386_svr4_reg_to_regnum(struct gdbarch *gdbarch, int reg)
Definition: i386-tdep.c:572
_initialize_i386_go32_tdep
void _initialize_i386_go32_tdep()
Definition: i386-go32-tdep.c:66
target-descriptions.h
i386_go32_init_abi
static void i386_go32_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: i386-go32-tdep.c:27
gdbarch_tdep::tdesc
const struct target_desc * tdesc
Definition: i386-tdep.h:204
gdbarch_info
Definition: gdbarch.h:1626
i386-tdep.h
set_gdbarch_has_dos_based_file_system
void set_gdbarch_has_dos_based_file_system(struct gdbarch *gdbarch, int has_dos_based_file_system)
Definition: gdbarch.c:4747
tdesc_has_registers
int tdesc_has_registers(const struct target_desc *target_desc)
Definition: target-descriptions.c:926
i386_target_description
const struct target_desc * i386_target_description(uint64_t xcr0)
Definition: i386-tdep.c:8714
gdb_osabi
gdb_osabi
Definition: defs.h:508