GDB (xrefs)
Loading...
Searching...
No Matches
amd64-sol2-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for AMD64 Solaris.
2
3 Copyright (C) 2001-2023 Free Software Foundation, Inc.
4
5 Contributed by Joseph Myers, CodeSourcery, LLC.
6
7 This file is part of GDB.
8
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.
13
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.
18
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/>. */
21
22#include "defs.h"
23#include "frame.h"
24#include "gdbcore.h"
25#include "regcache.h"
26#include "osabi.h"
27#include "symtab.h"
28
29#include "sol2-tdep.h"
30#include "amd64-tdep.h"
31#include "gdbsupport/x86-xstate.h"
32#include "solib-svr4.h"
33
34/* Mapping between the general-purpose registers in gregset_t format
35 and GDB's register cache layout. */
36
37/* From <sys/regset.h>. */
39 14 * 8, /* %rax */
40 11 * 8, /* %rbx */
41 13 * 8, /* %rcx */
42 12 * 8, /* %rdx */
43 9 * 8, /* %rsi */
44 8 * 8, /* %rdi */
45 10 * 8, /* %rbp */
46 20 * 8, /* %rsp */
47 7 * 8, /* %r8 ... */
48 6 * 8,
49 5 * 8,
50 4 * 8,
51 3 * 8,
52 2 * 8,
53 1 * 8,
54 0 * 8, /* ... %r15 */
55 17 * 8, /* %rip */
56 19 * 8, /* %eflags */
57 18 * 8, /* %cs */
58 21 * 8, /* %ss */
59 25 * 8, /* %ds */
60 24 * 8, /* %es */
61 22 * 8, /* %fs */
62 23 * 8 /* %gs */
63};
64
65
66/* Solaris doesn't have a 'struct sigcontext', but it does have a
67 'mcontext_t' that contains the saved set of machine registers. */
68
69static CORE_ADDR
71{
72 CORE_ADDR sp, ucontext_addr;
73
75 ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 8);
76
77 return ucontext_addr + 72;
78}
79
80static void
82{
83 i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
84
87 tdep->sizeof_gregset = 28 * 8;
88
90 amd64_target_description (X86_XSTATE_SSE_MASK, true));
91
92 sol2_init_abi (info, gdbarch);
93
97 tdep->sc_num_regs = tdep->gregset_num_regs;
98
99 /* Solaris uses SVR4-style shared libraries. */
102}
103
105void
107{
108 gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
110}
static void amd64_sol2_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static CORE_ADDR amd64_sol2_mcontext_addr(frame_info_ptr this_frame)
static int amd64_sol2_gregset_reg_offset[]
void _initialize_amd64_sol2_tdep()
const struct target_desc * amd64_target_description(uint64_t xcr0, bool segments)
void amd64_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch, const target_desc *default_tdesc)
@ AMD64_RSP_REGNUM
Definition amd64-tdep.h:42
ULONGEST get_frame_register_unsigned(frame_info_ptr frame, int regnum)
Definition frame.c:1399
ULONGEST get_frame_memory_unsigned(frame_info_ptr this_frame, CORE_ADDR addr, int len)
Definition frame.c:3007
void gdbarch_register_osabi(enum bfd_architecture arch, unsigned long machine, enum gdb_osabi osabi, void(*init_osabi)(struct gdbarch_info, struct gdbarch *))
Definition osabi.c:146
@ GDB_OSABI_SOLARIS
Definition osabi.h:31
void sol2_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition sol2-tdep.c:105
int sol2_sigtramp_p(frame_info_ptr this_frame)
Definition sol2-tdep.c:55
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
struct link_map_offsets * svr4_lp64_fetch_link_map_offsets(void)
int * gregset_reg_offset
Definition i386-tdep.h:64
int(* sigtramp_p)(frame_info_ptr)
Definition i386-tdep.h:230
CORE_ADDR(* sigcontext_addr)(frame_info_ptr)
Definition i386-tdep.h:233
size_t sizeof_gregset
Definition i386-tdep.h:66