GDB (xrefs)
Loading...
Searching...
No Matches
i386-sol2-tdep.c
Go to the documentation of this file.
1/* Target-dependent code for Solaris x86.
2
3 Copyright (C) 2002-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20#include "defs.h"
21#include "value.h"
22#include "osabi.h"
23
24#include "sol2-tdep.h"
25#include "i386-tdep.h"
26#include "solib-svr4.h"
27
28/* From <ia32/sys/reg.h>. */
30{
31 11 * 4, /* %eax */
32 10 * 4, /* %ecx */
33 9 * 4, /* %edx */
34 8 * 4, /* %ebx */
35 17 * 4, /* %esp */
36 6 * 4, /* %ebp */
37 5 * 4, /* %esi */
38 4 * 4, /* %edi */
39 14 * 4, /* %eip */
40 16 * 4, /* %eflags */
41 15 * 4, /* %cs */
42 18 * 4, /* %ss */
43 3 * 4, /* %ds */
44 2 * 4, /* %es */
45 1 * 4, /* %fs */
46 0 * 4 /* %gs */
47};
48
49/* Solaris doesn't have a `struct sigcontext', but it does have a
50 `mcontext_t' that contains the saved set of machine registers. */
51
52static CORE_ADDR
54{
55 CORE_ADDR sp, ucontext_addr;
56
58 ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 4);
59
60 return ucontext_addr + 36;
61}
62
63/* Solaris 2. */
64
65static void
67{
68 i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (gdbarch);
69
70 /* Solaris is SVR4-based. */
72
73 sol2_init_abi (info, gdbarch);
74
75 /* Solaris reserves space for its FPU emulator in `fpregset_t'.
76 There is also some space reserved for the registers of a Weitek
77 math coprocessor. */
80 tdep->sizeof_gregset = 19 * 4;
81 tdep->sizeof_fpregset = 380;
82
83 /* Signal trampolines are slightly different from SVR4. */
87 tdep->sc_num_regs = tdep->gregset_num_regs;
88
89 /* Solaris has SVR4-style shared libraries. */
92}
93
94
95static enum gdb_osabi
97{
98 /* If we have a section named .SUNW_version, then it is almost
99 certainly Solaris 2. */
100 if (bfd_get_section_by_name (abfd, ".SUNW_version"))
101 return GDB_OSABI_SOLARIS;
102
103 return GDB_OSABI_UNKNOWN;
104}
105
107void
109{
110 /* Register an ELF OS ABI sniffer for Solaris 2 binaries. */
111 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
113
114 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SOLARIS,
116}
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
static int i386_sol2_gregset_reg_offset[]
static enum gdb_osabi i386_sol2_osabi_sniffer(bfd *abfd)
void _initialize_i386_sol2_tdep()
static void i386_sol2_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static CORE_ADDR i386_sol2_mcontext_addr(frame_info_ptr this_frame)
void i386_svr4_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition i386-tdep.c:4563
@ I386_ESP_REGNUM
Definition i386-tdep.h:285
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
void gdbarch_register_osabi_sniffer(enum bfd_architecture arch, enum bfd_flavour flavour, enum gdb_osabi(*sniffer_fn)(bfd *))
Definition osabi.c:220
gdb_osabi
Definition osabi.h:25
@ GDB_OSABI_SOLARIS
Definition osabi.h:31
@ GDB_OSABI_UNKNOWN
Definition osabi.h:26
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_ilp32_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
size_t sizeof_fpregset
Definition i386-tdep.h:69
CORE_ADDR(* sigcontext_addr)(frame_info_ptr)
Definition i386-tdep.h:233
size_t sizeof_gregset
Definition i386-tdep.h:66