2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _RTLD_DB_H
27 #define _RTLD_DB_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #include <sys/types.h>
37 #include <sys/lwp.h>
38 #include <sys/elf.h>
39 #include <link.h>
40 #include <proc_service.h>
41
42
43 /*
44 * librtld_db interface versions
45 */
46 #define RD_VERSION1 1
47 #define RD_VERSION2 2
48 #define RD_VERSION3 3
49 #define RD_VERSION4 4
50 #define RD_VERSION RD_VERSION4
51
118 psaddr_t rl_padend; /* end of image after padding */
119 psaddr_t rl_dynamic; /* points to the DYNAMIC section */
120 /* in the target process */
121 unsigned long rl_tlsmodid; /* module ID for TLS references */
122 } rd_loadobj_t;
123
124 /*
125 * Values for rl_flags
126 */
127 #define RD_FLG_MEM_OBJECT 0x0001 /* Identifies this object as */
128 /* originating from a relocatable */
129 /* module which was dynamically */
130 /* loaded */
131
132 /*
133 * Commands for rd_ctl()
134 */
135 #define RD_CTL_SET_HELPPATH 0x01 /* Set the path used to find helpers */
136
137 typedef struct rd_agent rd_agent_t;
138 #ifdef __STDC__
139 typedef int rl_iter_f(const rd_loadobj_t *, void *);
140 #else
141 typedef int rl_iter_f();
142 #endif
143
144
145 /*
146 * PLT skipping
147 */
148 typedef enum {
149 RD_RESOLVE_NONE, /* don't do anything special */
150 RD_RESOLVE_STEP, /* step 'pi_nstep' instructions */
151 RD_RESOLVE_TARGET, /* resolved target is in 'pi_target' */
152 RD_RESOLVE_TARGET_STEP /* put a bpt on target, then step nstep times */
153 } rd_skip_e;
154
155
156 typedef struct rd_plt_info {
157 rd_skip_e pi_skip_method;
158 long pi_nstep;
159 psaddr_t pi_target;
160 psaddr_t pi_baddr;
161 unsigned int pi_flags;
162 } rd_plt_info_t;
163
164
165 /*
166 * Values for pi_flags
167 */
168 #define RD_FLG_PI_PLTBOUND 0x0001 /* Indicates that the PLT */
169 /* has been bound - and that */
170 /* pi_baddr will contain its */
171 /* destination address */
172
173 struct ps_prochandle;
174
175 /*
176 * librtld_db.so entry points
177 */
178 #ifdef __STDC__
179 extern void rd_delete(rd_agent_t *);
180 extern char *rd_errstr(rd_err_e rderr);
181 extern rd_err_e rd_event_addr(rd_agent_t *, rd_event_e, rd_notify_t *);
182 extern rd_err_e rd_event_enable(rd_agent_t *, int);
183 extern rd_err_e rd_event_getmsg(rd_agent_t *, rd_event_msg_t *);
184 extern rd_err_e rd_init(int);
185 extern rd_err_e rd_ctl(int, void *);
186 extern rd_err_e rd_loadobj_iter(rd_agent_t *, rl_iter_f *,
187 void *);
188 extern void rd_log(const int);
189 extern rd_agent_t *rd_new(struct ps_prochandle *);
190 extern rd_err_e rd_objpad_enable(struct rd_agent *, size_t);
191 extern rd_err_e rd_plt_resolution(rd_agent_t *, psaddr_t, lwpid_t,
192 psaddr_t, rd_plt_info_t *);
193 extern rd_err_e rd_get_dyns(rd_agent_t *, psaddr_t, void **, size_t *);
194 extern rd_err_e rd_reset(struct rd_agent *);
195 #else /* !__STDC__ */
196 extern void rd_delete();
197 extern char *rd_errstr();
198 extern rd_err_e rd_event_addr();
199 extern rd_err_e rd_event_enable();
200 extern rd_err_e rd_event_getmsg();
201 extern rd_err_e rd_init();
202 extern rd_err_e rd_ctl();
203 extern rd_err_e rd_loadobj_iter();
204 extern void rd_log();
205 extern rd_agent_t *rd_new();
206 extern rd_err_e rd_objpad_enable();
207 extern rd_err_e rd_plt_resolution();
208 extern rd_err_e rd_get_dyns();
209 extern rd_err_e rd_reset();
210 #endif /* !__STDC__ */
211
212 #ifdef __cplusplus
213 }
214 #endif
215
216 #endif /* _RTLD_DB_H */
|
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 #ifndef _RTLD_DB_H
29 #define _RTLD_DB_H
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <sys/types.h>
36 #include <sys/lwp.h>
37 #include <sys/elf.h>
38 #include <link.h>
39 #include <proc_service.h>
40
41
42 /*
43 * librtld_db interface versions
44 */
45 #define RD_VERSION1 1
46 #define RD_VERSION2 2
47 #define RD_VERSION3 3
48 #define RD_VERSION4 4
49 #define RD_VERSION RD_VERSION4
50
117 psaddr_t rl_padend; /* end of image after padding */
118 psaddr_t rl_dynamic; /* points to the DYNAMIC section */
119 /* in the target process */
120 unsigned long rl_tlsmodid; /* module ID for TLS references */
121 } rd_loadobj_t;
122
123 /*
124 * Values for rl_flags
125 */
126 #define RD_FLG_MEM_OBJECT 0x0001 /* Identifies this object as */
127 /* originating from a relocatable */
128 /* module which was dynamically */
129 /* loaded */
130
131 /*
132 * Commands for rd_ctl()
133 */
134 #define RD_CTL_SET_HELPPATH 0x01 /* Set the path used to find helpers */
135
136 typedef struct rd_agent rd_agent_t;
137 typedef int rl_iter_f(const rd_loadobj_t *, void *);
138
139
140 /*
141 * PLT skipping
142 */
143 typedef enum {
144 RD_RESOLVE_NONE, /* don't do anything special */
145 RD_RESOLVE_STEP, /* step 'pi_nstep' instructions */
146 RD_RESOLVE_TARGET, /* resolved target is in 'pi_target' */
147 RD_RESOLVE_TARGET_STEP /* put a bpt on target, then step nstep times */
148 } rd_skip_e;
149
150
151 typedef struct rd_plt_info {
152 rd_skip_e pi_skip_method;
153 long pi_nstep;
154 psaddr_t pi_target;
155 psaddr_t pi_baddr;
156 unsigned int pi_flags;
157 } rd_plt_info_t;
158
159
160 /*
161 * Values for pi_flags
162 */
163 #define RD_FLG_PI_PLTBOUND 0x0001 /* Indicates that the PLT */
164 /* has been bound - and that */
165 /* pi_baddr will contain its */
166 /* destination address */
167
168 struct ps_prochandle;
169
170 /*
171 * librtld_db.so entry points
172 */
173 extern void rd_delete(rd_agent_t *);
174 extern char *rd_errstr(rd_err_e rderr);
175 extern rd_err_e rd_event_addr(rd_agent_t *, rd_event_e, rd_notify_t *);
176 extern rd_err_e rd_event_enable(rd_agent_t *, int);
177 extern rd_err_e rd_event_getmsg(rd_agent_t *, rd_event_msg_t *);
178 extern rd_err_e rd_init(int);
179 extern rd_err_e rd_ctl(int, void *);
180 extern rd_err_e rd_loadobj_iter(rd_agent_t *, rl_iter_f *,
181 void *);
182 extern void rd_log(const int);
183 extern rd_agent_t *rd_new(struct ps_prochandle *);
184 extern rd_err_e rd_objpad_enable(struct rd_agent *, size_t);
185 extern rd_err_e rd_plt_resolution(rd_agent_t *, psaddr_t, lwpid_t,
186 psaddr_t, rd_plt_info_t *);
187 extern rd_err_e rd_get_dyns(rd_agent_t *, psaddr_t, void **, size_t *);
188 extern rd_err_e rd_reset(struct rd_agent *);
189
190 #ifdef __cplusplus
191 }
192 #endif
193
194 #endif /* _RTLD_DB_H */
|