1 /* Target-dependent code for AMD64 Solaris.
3 Copyright (C) 2001-2016 Free Software Foundation, Inc.
5 Contributed by Joseph Myers, CodeSourcery, LLC.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
29 #include "sol2-tdep.h"
30 #include "amd64-tdep.h"
31 #include "solib-svr4.h"
33 /* Mapping between the general-purpose registers in gregset_t format
34 and GDB's register cache layout. */
36 /* From <sys/regset.h>. */
37 static int amd64_sol2_gregset_reg_offset[] = {
65 /* Return whether THIS_FRAME corresponds to a Solaris sigtramp
69 amd64_sol2_sigtramp_p (struct frame_info *this_frame)
71 CORE_ADDR pc = get_frame_pc (this_frame);
74 find_pc_partial_function (pc, &name, NULL, NULL);
75 return (name && (strcmp ("sigacthandler", name) == 0
76 || strcmp (name, "ucbsigvechandler") == 0));
79 /* Solaris doesn't have a 'struct sigcontext', but it does have a
80 'mcontext_t' that contains the saved set of machine registers. */
83 amd64_sol2_mcontext_addr (struct frame_info *this_frame)
85 CORE_ADDR sp, ucontext_addr;
87 sp = get_frame_register_unsigned (this_frame, AMD64_RSP_REGNUM);
88 ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 8);
90 return ucontext_addr + 72;
94 amd64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
96 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
98 tdep->gregset_reg_offset = amd64_sol2_gregset_reg_offset;
99 tdep->gregset_num_regs = ARRAY_SIZE (amd64_sol2_gregset_reg_offset);
100 tdep->sizeof_gregset = 28 * 8;
102 amd64_init_abi (info, gdbarch);
104 tdep->sigtramp_p = amd64_sol2_sigtramp_p;
105 tdep->sigcontext_addr = amd64_sol2_mcontext_addr;
106 tdep->sc_reg_offset = tdep->gregset_reg_offset;
107 tdep->sc_num_regs = tdep->gregset_num_regs;
109 /* Solaris uses SVR4-style shared libraries. */
110 set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
111 set_solib_svr4_fetch_link_map_offsets
112 (gdbarch, svr4_lp64_fetch_link_map_offsets);
114 /* How to print LWP PTIDs from core files. */
115 set_gdbarch_core_pid_to_str (gdbarch, sol2_core_pid_to_str);
119 /* Provide a prototype to silence -Wmissing-prototypes. */
120 extern void _initialize_amd64_sol2_tdep (void);
123 _initialize_amd64_sol2_tdep (void)
125 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
126 GDB_OSABI_SOLARIS, amd64_sol2_init_abi);