1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/* Copyright (C) 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Bartley <dtbartle@csclub.uwaterloo.ca>, 2008.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _RTLD_DB_H
#define _RTLD_DB_H
#include <sys/types.h>
#include <features.h>
#include <proc_service.h>
#include <sys/link.h>
#include <dlfcn.h>
#define RD_VERSION1 1
#define RD_VERSION2 2
#define RD_VERSION3 3
#define RD_VERSION4 4
#define RD_VERSION RD_VERSION4
typedef enum
{
RD_ERR,
RD_OK,
RD_NOCAPAB,
RD_DBERR,
RD_NOBASE,
RD_NODYNAM,
RD_NOMAPS
} rd_err_e;
typedef struct rd_agent rd_agent_t;
typedef struct rd_loadobj
{
psaddr_t rl_nameaddr;
unsigned int rl_flags;
psaddr_t rl_base;
psaddr_t rl_data_base;
Lmid_t rl_lmident;
psaddr_t rl_refnameaddr;
psaddr_t rl_plt_base;
unsigned int rl_plt_size;
psaddr_t rl_bend;
psaddr_t rl_padstart;
psaddr_t rl_padend;
psaddr_t rl_dynamic;
unsigned long rl_tlsmodid;
} rd_loadobj_t;
/* r_flags values. */
#define RD_FLG_MEM_OBJECT 0x0001
typedef int rl_iter_f (const rd_loadobj_t *, void *);
typedef enum
{
RD_NOTIFY_BPT,
RD_NOTIFY_AUTOBPT,
RD_NOTIFY_SYSCALL
} rd_notify_e;
typedef struct rd_notify
{
rd_notify_e type;
union
{
psaddr_t bptaddr;
long syscallno;
} u;
} rd_notify_t;
typedef enum
{
RD_NOSTATE = 0,
RD_CONSISTENT,
RD_ADD,
RD_DELETE
} rd_state_e;
typedef struct rd_event_msg
{
rd_event_e type;
union
{
rd_state_e state;
} u;
} rd_event_msg_t;
typedef enum
{
RD_RESOLVE_NONE,
RD_RESOLVE_STEP,
RD_RESOLVE_TARGET,
RD_RESOLVE_TARGET_STEP
} rd_skip_e;
typedef struct rd_plt_info
{
rd_skip_e pi_skip_method;
long pi_nstep;
psaddr_t pi_target;
psaddr_t pi_baddr;
unsigned int pi_flags;
} rd_plt_info_t;
/* pi_flags values. */
#define RD_FLG_PI_PLTBOUND 0x01
/* rd_ctl commands. */
#define RD_CTL_SET_HELPPATH 0x01
__BEGIN_DECLS
extern void rd_delete (rd_agent_t *);
extern char * rd_errstr (rd_err_e);
extern rd_err_e rd_event_addr (rd_agent_t *, rd_event_e, rd_notify_t *);
extern rd_err_e rd_event_enable (rd_agent_t *, int);
extern rd_err_e rd_event_getmsg (rd_agent_t *, rd_event_msg_t *);
extern rd_err_e rd_init (int);
extern rd_err_e rd_ctl (int, void *);
extern rd_err_e rd_loadobj_iter (rd_agent_t *, rl_iter_f *, void *);
extern void rd_log (const int);
extern rd_agent_t * rd_new (struct ps_prochandle *);
extern rd_err_e rd_objpad_enable(struct rd_agent *, size_t);
extern rd_err_e rd_plt_resolution (rd_agent_t *, psaddr_t, lwpid_t, psaddr_t,
rd_plt_info_t *);
extern rd_err_e rd_get_dyns (rd_agent_t *, psaddr_t, void **, size_t *);
extern rd_err_e rd_reset (struct rd_agent *);
__END_DECLS
#endif /* _RTLD_DB_H */
|