GDB (xrefs)

/tmp/gdb-8.1/gdb/solib-svr4.h
Go to the documentation of this file.
1 /* Handle shared libraries for GDB, the GNU Debugger.
2
3 Copyright (C) 2000-2018 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 #ifndef SOLIB_SVR4_H
21 #define SOLIB_SVR4_H
22
23 #include "solist.h"
24
25 struct objfile;
26 struct target_so_ops;
27
28 extern struct target_so_ops svr4_so_ops;
29
30 /* Link map info to include in an allocated so_list entry. */
31
32 struct lm_info_svr4 : public lm_info_base
33 {
34 /* Amount by which addresses in the binary should be relocated to
35 match the inferior. The direct inferior value is L_ADDR_INFERIOR.
36 When prelinking is involved and the prelink base address changes,
37 we may need a different offset - the recomputed offset is in L_ADDR.
38 It is commonly the same value. It is cached as we want to warn about
39 the difference and compute it only once. L_ADDR is valid
40 iff L_ADDR_P. */
41 CORE_ADDR l_addr = 0, l_addr_inferior = 0;
42 bool l_addr_p = false;
43
44 /* The target location of lm. */
45 CORE_ADDR lm_addr = 0;
46
47 /* Values read in from inferior's fields of the same name. */
48 CORE_ADDR l_ld = 0, l_next = 0, l_prev = 0, l_name = 0;
49 };
50
51 /* Critical offsets and sizes which describe struct r_debug and
52 struct link_map on SVR4-like targets. All offsets and sizes are
53 in bytes unless otherwise specified. */
54
55 struct link_map_offsets
56 {
57 /* Offset and size of r_debug.r_version. */
58 int r_version_offset, r_version_size;
59
60 /* Offset of r_debug.r_map. */
61 int r_map_offset;
62
63 /* Offset of r_debug.r_brk. */
64 int r_brk_offset;
65
66 /* Offset of r_debug.r_ldsomap. */
67 int r_ldsomap_offset;
68
69 /* Size of struct link_map (or equivalent), or at least enough of it
70 to be able to obtain the fields below. */
71 int link_map_size;
72
73 /* Offset to l_addr field in struct link_map. */
74 int l_addr_offset;
75
76 /* Offset to l_ld field in struct link_map. */
77 int l_ld_offset;
78
79 /* Offset to l_next field in struct link_map. */
80 int l_next_offset;
81
82 /* Offset to l_prev field in struct link_map. */
83 int l_prev_offset;
84
85 /* Offset to l_name field in struct link_map. */
86 int l_name_offset;
87 };
88
89 /* set_solib_svr4_fetch_link_map_offsets() is intended to be called by
90 a <arch>_gdbarch_init() function. It is used to establish an
91 architecture specific link_map_offsets fetcher for the architecture
92 being defined. */
93
94 extern void set_solib_svr4_fetch_link_map_offsets
95 (struct gdbarch *gdbarch, struct link_map_offsets *(*func) (void));
96
97 /* This function is called by thread_db.c. Return the address of the
98 link map for the given objfile. */
99 extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
100
101 /* Fetch (and possibly build) an appropriate `struct link_map_offsets'
102 for ILP32 and LP64 SVR4 systems. */
103 extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
104 extern struct link_map_offsets *svr4_lp64_fetch_link_map_offsets (void);
105
106 /* Return 1 if PC lies in the dynamic symbol resolution code of the
107 SVR4 run time loader. */
108 int svr4_in_dynsym_resolve_code (CORE_ADDR pc);
109
110 #endif /* solib-svr4.h */
gdbarch
Definition: gdbarch.c:127
lm_info_svr4::l_name
CORE_ADDR l_name
Definition: solib-svr4.h:48
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
link_map_offsets::l_addr_offset
int l_addr_offset
Definition: solib-svr4.h:74
solist.h
func
void(* func)(char *)
Definition: remote-fileio.c:1104
link_map_offsets::r_brk_offset
int r_brk_offset
Definition: solib-svr4.h:64
svr4_in_dynsym_resolve_code
int svr4_in_dynsym_resolve_code(CORE_ADDR pc)
Definition: solib-svr4.c:1628
link_map_offsets::r_version_size
int r_version_size
Definition: solib-svr4.h:58
link_map_offsets::r_version_offset
int r_version_offset
Definition: solib-svr4.h:58
link_map_offsets::r_map_offset
int r_map_offset
Definition: solib-svr4.h:61
link_map_offsets
Definition: solib-svr4.h:55
svr4_lp64_fetch_link_map_offsets
struct link_map_offsets * svr4_lp64_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3214
target_so_ops
Definition: solist.h:91
lm_info_svr4::l_prev
CORE_ADDR l_prev
Definition: solib-svr4.h:48
svr4_fetch_objfile_link_map
CORE_ADDR svr4_fetch_objfile_link_map(struct objfile *objfile)
Definition: solib-svr4.c:1579
lm_info_base
Definition: solist.h:34
svr4_ilp32_fetch_link_map_offsets
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
Definition: solib-svr4.c:3183
link_map_offsets::l_ld_offset
int l_ld_offset
Definition: solib-svr4.h:77
lm_info_svr4::l_addr_p
bool l_addr_p
Definition: solib-svr4.h:42
lm_info_svr4::l_next
CORE_ADDR l_next
Definition: solib-svr4.h:48
objfile
Definition: objfiles.h:286
set_solib_svr4_fetch_link_map_offsets
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*func)(void))
Definition: solib-svr4.c:3137
link_map_offsets::l_name_offset
int l_name_offset
Definition: solib-svr4.h:86
link_map_offsets::link_map_size
int link_map_size
Definition: solib-svr4.h:71
lm_info_svr4::l_ld
CORE_ADDR l_ld
Definition: solib-svr4.h:48
lm_info_svr4::l_addr
CORE_ADDR l_addr
Definition: solib-svr4.h:41
svr4_so_ops
struct target_so_ops svr4_so_ops
Definition: solib-svr4.c:3242
link_map_offsets::l_next_offset
int l_next_offset
Definition: solib-svr4.h:80
lm_info_svr4::l_addr_inferior
CORE_ADDR l_addr_inferior
Definition: solib-svr4.h:41
lm_info_svr4
Definition: solib-svr4.h:32
link_map_offsets::l_prev_offset
int l_prev_offset
Definition: solib-svr4.h:83
lm_info_svr4::lm_addr
CORE_ADDR lm_addr
Definition: solib-svr4.h:45
link_map_offsets::r_ldsomap_offset
int r_ldsomap_offset
Definition: solib-svr4.h:67