* Makefile.in (ALLDEPFILES): Add i386-cygwin-tdep.c.
[external/binutils.git] / gdb / i386-cygwin-tdep.c
1 /* Target-dependent code for Cygwin running on i386's, for GDB.
2    Copyright 2003 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19
20 #include "defs.h"
21
22 #include "gdb_string.h"
23 #include "i386-tdep.h"
24 #include "osabi.h"
25
26 static void
27 i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
28 {
29   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
30
31   tdep->struct_return = reg_struct_return;
32 }
33
34 static enum gdb_osabi
35 i386_cygwin_osabi_sniffer (bfd * abfd)
36
37   char *target_name = bfd_get_target (abfd);
38
39   /* Interix also uses pei-i386. 
40      We need a way to distinguish between the two. */
41   if (strcmp (target_name, "pei-i386") == 0)
42     return GDB_OSABI_CYGWIN;
43
44   return GDB_OSABI_UNKNOWN;
45 }
46
47 void
48 _initialize_i386_cygwin_tdep (void)
49 {
50   gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
51                                   i386_cygwin_osabi_sniffer);
52
53   gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,
54                           i386_cygwin_init_abi);
55 }