1 /* Target-dependent code for AMD64 Solaris.
3 Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 Contributed by Joseph Myers, CodeSourcery, LLC.
8 This file is part of GDB.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>. */
30 #include "gdb_string.h"
32 #include "sol2-tdep.h"
33 #include "amd64-tdep.h"
34 #include "solib-svr4.h"
36 /* Mapping between the general-purpose registers in gregset_t format
37 and GDB's register cache layout. */
39 /* From <sys/regset.h>. */
40 static int amd64_sol2_gregset_reg_offset
[] = {
68 /* Return whether THIS_FRAME corresponds to a Solaris sigtramp
72 amd64_sol2_sigtramp_p (struct frame_info
*this_frame
)
74 CORE_ADDR pc
= get_frame_pc (this_frame
);
77 find_pc_partial_function (pc
, &name
, NULL
, NULL
);
78 return (name
&& (strcmp ("sigacthandler", name
) == 0
79 || strcmp (name
, "ucbsigvechandler") == 0));
82 /* Solaris doesn't have a 'struct sigcontext', but it does have a
83 'mcontext_t' that contains the saved set of machine registers. */
86 amd64_sol2_mcontext_addr (struct frame_info
*this_frame
)
88 CORE_ADDR sp
, ucontext_addr
;
90 sp
= get_frame_register_unsigned (this_frame
, AMD64_RSP_REGNUM
);
91 ucontext_addr
= get_frame_memory_unsigned (this_frame
, sp
+ 8, 8);
93 return ucontext_addr
+ 72;
97 amd64_sol2_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
99 struct gdbarch_tdep
*tdep
= gdbarch_tdep (gdbarch
);
101 tdep
->gregset_reg_offset
= amd64_sol2_gregset_reg_offset
;
102 tdep
->gregset_num_regs
= ARRAY_SIZE (amd64_sol2_gregset_reg_offset
);
103 tdep
->sizeof_gregset
= 28 * 8;
105 amd64_init_abi (info
, gdbarch
);
107 tdep
->sigtramp_p
= amd64_sol2_sigtramp_p
;
108 tdep
->sigcontext_addr
= amd64_sol2_mcontext_addr
;
109 tdep
->sc_reg_offset
= tdep
->gregset_reg_offset
;
110 tdep
->sc_num_regs
= tdep
->gregset_num_regs
;
112 /* Solaris uses SVR4-style shared libraries. */
113 set_gdbarch_skip_solib_resolver (gdbarch
, sol2_skip_solib_resolver
);
114 set_solib_svr4_fetch_link_map_offsets
115 (gdbarch
, svr4_lp64_fetch_link_map_offsets
);
117 /* Solaris encodes the pid of the inferior in regset section
119 set_gdbarch_core_reg_section_encodes_pid (gdbarch
, 1);
121 /* How to print LWP PTIDs from core files. */
122 set_gdbarch_core_pid_to_str (gdbarch
, sol2_core_pid_to_str
);
126 /* Provide a prototype to silence -Wmissing-prototypes. */
127 extern void _initialize_amd64_sol2_tdep (void);
130 _initialize_amd64_sol2_tdep (void)
132 gdbarch_register_osabi (bfd_arch_i386
, bfd_mach_x86_64
,
133 GDB_OSABI_SOLARIS
, amd64_sol2_init_abi
);