* linux-low.c (usr_store_inferior_registers): Transfer buf in
[deliverable/binutils-gdb.git] / gdb / i386-cygwin-tdep.c
CommitLineData
1762d96d
CV
1/* Target-dependent code for Cygwin running on i386's, for GDB.
2 Copyright 2003 Free Software Foundation, Inc.
3
4This file is part of GDB.
5
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19
20#include "defs.h"
21
22#include "gdb_string.h"
f870b49b 23#include "gdbcore.h"
1762d96d
CV
24#include "i386-tdep.h"
25#include "osabi.h"
f870b49b
CV
26#include "frame.h"
27#include "dummy-frame.h"
28
29static int
30i386_cygwin_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
31{
32 /* In the context where this is used, we get the saved PC before we've
33 successfully unwound far enough to be sure what we've got (it may
34 be a signal handler caller). If we're dealing with a signal
35 handler caller, this will return valid, which is fine. If not,
36 it'll make the correct test. */
37 return ((get_frame_type (thisframe) == SIGTRAMP_FRAME) || chain != 0);
38}
39/* Return the chain-pointer for FRAME. In the case of the i386, the
40 frame's nominal address is the address of a 4-byte word containing
41 the calling frame's address. */
42static CORE_ADDR
43i386_cygwin_frame_chain (struct frame_info *frame)
44{
45 if (pc_in_dummy_frame (get_frame_pc (frame)))
46 return get_frame_base (frame);
47
48 if (get_frame_type (frame) == SIGTRAMP_FRAME
49 || i386_frameless_signal_p (frame))
50 return get_frame_base (frame);
51
52 return read_memory_unsigned_integer (get_frame_base (frame), 4);
53}
1762d96d
CV
54
55static void
56i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
57{
58 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
59
60 tdep->struct_return = reg_struct_return;
f870b49b
CV
61 set_gdbarch_deprecated_frame_chain (gdbarch, i386_cygwin_frame_chain);
62 set_gdbarch_deprecated_frame_chain_valid (gdbarch, i386_cygwin_frame_chain_valid);
1762d96d
CV
63}
64
65static enum gdb_osabi
66i386_cygwin_osabi_sniffer (bfd * abfd)
67{
68 char *target_name = bfd_get_target (abfd);
69
70 /* Interix also uses pei-i386.
71 We need a way to distinguish between the two. */
72 if (strcmp (target_name, "pei-i386") == 0)
73 return GDB_OSABI_CYGWIN;
74
75 return GDB_OSABI_UNKNOWN;
76}
77
78void
79_initialize_i386_cygwin_tdep (void)
80{
81 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
82 i386_cygwin_osabi_sniffer);
83
84 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_CYGWIN,
85 i386_cygwin_init_abi);
86}
This page took 0.03939 seconds and 4 git commands to generate.