GDB (xrefs)
/tmp/gdb-7.10/gdb/amd64-sol2-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for AMD64 Solaris.
2 
3  Copyright (C) 2001-2015 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 "solib-svr4.h"
32 
33 /* Mapping between the general-purpose registers in gregset_t format
34  and GDB's register cache layout. */
35 
36 /* From <sys/regset.h>. */
38  14 * 8, /* %rax */
39  11 * 8, /* %rbx */
40  13 * 8, /* %rcx */
41  12 * 8, /* %rdx */
42  9 * 8, /* %rsi */
43  8 * 8, /* %rdi */
44  10 * 8, /* %rbp */
45  20 * 8, /* %rsp */
46  7 * 8, /* %r8 ... */
47  6 * 8,
48  5 * 8,
49  4 * 8,
50  3 * 8,
51  2 * 8,
52  1 * 8,
53  0 * 8, /* ... %r15 */
54  17 * 8, /* %rip */
55  19 * 8, /* %eflags */
56  18 * 8, /* %cs */
57  21 * 8, /* %ss */
58  25 * 8, /* %ds */
59  24 * 8, /* %es */
60  22 * 8, /* %fs */
61  23 * 8 /* %gs */
62 };
63 
64 
65 /* Return whether THIS_FRAME corresponds to a Solaris sigtramp
66  routine. */
67 
68 static int
69 amd64_sol2_sigtramp_p (struct frame_info *this_frame)
70 {
71  CORE_ADDR pc = get_frame_pc (this_frame);
72  const char *name;
73 
74  find_pc_partial_function (pc, &name, NULL, NULL);
75  return (name && (strcmp ("sigacthandler", name) == 0
76  || strcmp (name, "ucbsigvechandler") == 0));
77 }
78 
79 /* Solaris doesn't have a 'struct sigcontext', but it does have a
80  'mcontext_t' that contains the saved set of machine registers. */
81 
82 static CORE_ADDR
84 {
85  CORE_ADDR sp, ucontext_addr;
86 
88  ucontext_addr = get_frame_memory_unsigned (this_frame, sp + 8, 8);
89 
90  return ucontext_addr + 72;
91 }
92 
93 static void
95 {
96  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
97 
100  tdep->sizeof_gregset = 28 * 8;
101 
102  amd64_init_abi (info, gdbarch);
103 
106  tdep->sc_reg_offset = tdep->gregset_reg_offset;
107  tdep->sc_num_regs = tdep->gregset_num_regs;
108 
109  /* Solaris uses SVR4-style shared libraries. */
113 
114  /* How to print LWP PTIDs from core files. */
116 }
117 
118 
119 /* Provide a prototype to silence -Wmissing-prototypes. */
120 extern void _initialize_amd64_sol2_tdep (void);
121 
122 void
124 {
125  gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
127 }
static CORE_ADDR amd64_sol2_mcontext_addr(struct frame_info *this_frame)
CORE_ADDR sol2_skip_solib_resolver(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition: sol2-tdep.c:29
void _initialize_amd64_sol2_tdep(void)
void set_gdbarch_core_pid_to_str(struct gdbarch *gdbarch, gdbarch_core_pid_to_str_ftype core_pid_to_str)
Definition: gdbarch.c:3542
CORE_ADDR get_frame_pc(struct frame_info *frame)
Definition: frame.c:2217
bfd_vma CORE_ADDR
Definition: common-types.h:41
struct link_map_offsets * svr4_lp64_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3180
int sc_num_regs
Definition: i386-tdep.h:216
struct m32c_reg * pc
Definition: m32c-tdep.c:111
CORE_ADDR(* sigcontext_addr)(struct frame_info *)
Definition: alpha-tdep.h:82
ULONGEST get_frame_memory_unsigned(struct frame_info *this_frame, CORE_ADDR addr, int len)
Definition: frame.c:2515
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1402
const char *const name
Definition: aarch64-tdep.c:68
static void amd64_sol2_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
static int amd64_sol2_gregset_reg_offset[]
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
Definition: solib-svr4.c:3108
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
Definition: blockframe.c:321
static int amd64_sol2_sigtramp_p(struct frame_info *this_frame)
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1194
int * gregset_reg_offset
Definition: i386-tdep.h:59
int(* sigtramp_p)(struct frame_info *)
Definition: i386-tdep.h:209
char * sol2_core_pid_to_str(struct gdbarch *gdbarch, ptid_t ptid)
Definition: sol2-tdep.c:44
void amd64_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: amd64-tdep.c:2937
size_t sizeof_gregset
Definition: i386-tdep.h:61
struct m32c_reg * sp
Definition: m32c-tdep.c:114
int * sc_reg_offset
Definition: i386-tdep.h:215
void set_gdbarch_skip_solib_resolver(struct gdbarch *gdbarch, gdbarch_skip_solib_resolver_ftype skip_solib_resolver)
Definition: gdbarch.c:3101
int gregset_num_regs
Definition: i386-tdep.h:60
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:148