gdb: Move DJGPP/go32 bits to their own tdep file
[external/binutils.git] / gdb / i386-go32-tdep.c
1 /* Target-dependent code for DJGPP/i386.
2
3    Copyright (C) 1988-2017 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 "target-descriptions.h"
23 #include "osabi.h"
24
25 static void
26 i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
27 {
28   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
29
30   /* DJGPP doesn't have any special frames for signal handlers.  */
31   tdep->sigtramp_p = NULL;
32
33   tdep->jb_pc_offset = 36;
34
35   /* DJGPP does not support the SSE registers.  */
36   if (!tdesc_has_registers (info.target_desc))
37     tdep->tdesc = tdesc_i386_mmx;
38
39   /* Native compiler is GCC, which uses the SVR4 register numbering
40      even in COFF and STABS.  See the comment in i386_gdbarch_init,
41      before the calls to set_gdbarch_stab_reg_to_regnum and
42      set_gdbarch_sdb_reg_to_regnum.  */
43   set_gdbarch_stab_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
44   set_gdbarch_sdb_reg_to_regnum (gdbarch, i386_svr4_reg_to_regnum);
45
46   set_gdbarch_has_dos_based_file_system (gdbarch, 1);
47
48   set_gdbarch_wchar_bit (gdbarch, 16);
49   set_gdbarch_wchar_signed (gdbarch, 0);
50 }
51 \f
52
53 static enum gdb_osabi
54 i386_coff_osabi_sniffer (bfd *abfd)
55 {
56   if (strcmp (bfd_get_target (abfd), "coff-go32-exe") == 0
57       || strcmp (bfd_get_target (abfd), "coff-go32") == 0)
58     return GDB_OSABI_GO32;
59
60   return GDB_OSABI_UNKNOWN;
61 }
62 \f
63
64 void
65 _initialize_i386_go32_tdep ()
66 {
67   gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
68                                   i386_coff_osabi_sniffer);
69
70   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
71                           i386_go32_init_abi);
72 }