xref: /freebsd/lib/librtld_db/librtld_db.3 (revision 5c2bc3db201a4fe8d7911cf816bea104d5dc2138)
1cb314988SRui Paulo.\"-
2cb314988SRui Paulo.\" Copyright (c) 2010 The FreeBSD Foundation
3cb314988SRui Paulo.\"
4cb314988SRui Paulo.\" This software was developed by Rui Paulo under sponsorship from
5cb314988SRui Paulo.\" the FreeBSD Foundation.
6cb314988SRui Paulo.\"
7cb314988SRui Paulo.\" Redistribution and use in source and binary forms, with or without
8cb314988SRui Paulo.\" modification, are permitted provided that the following conditions
9cb314988SRui Paulo.\" are met:
10cb314988SRui Paulo.\" 1. Redistributions of source code must retain the above copyright
11cb314988SRui Paulo.\"    notice, this list of conditions and the following disclaimer.
12cb314988SRui Paulo.\" 2. Redistributions in binary form must reproduce the above copyright
13cb314988SRui Paulo.\"    notice, this list of conditions and the following disclaimer in the
14cb314988SRui Paulo.\"    documentation and/or other materials provided with the distribution.
15cb314988SRui Paulo.\"
16cb314988SRui Paulo.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17cb314988SRui Paulo.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18cb314988SRui Paulo.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19cb314988SRui Paulo.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20cb314988SRui Paulo.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21cb314988SRui Paulo.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22cb314988SRui Paulo.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23cb314988SRui Paulo.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24cb314988SRui Paulo.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25cb314988SRui Paulo.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26cb314988SRui Paulo.\" SUCH DAMAGE.
27cb314988SRui Paulo.\"
28cb314988SRui Paulo.Dd June 10, 2010
29cb314988SRui Paulo.Dt LIBRTLD_DB 3
30cb314988SRui Paulo.Os
31cb314988SRui Paulo.Sh NAME
32cb314988SRui Paulo.Nm librtld_db
33cb314988SRui Paulo.Nd library for run-time linker debugging
34cb314988SRui Paulo.Sh LIBRARY
35cb314988SRui Paulo.Lb librtld_db
36cb314988SRui Paulo.Sh SYNOPSIS
37cb314988SRui Paulo.In rtld_db.h
38cb314988SRui Paulo.Ft void
39cb314988SRui Paulo.Fo rd_delete
40cb314988SRui Paulo.Fa "rd_agent_t *rdap"
41cb314988SRui Paulo.Fc
42cb314988SRui Paulo.Ft char *
43cb314988SRui Paulo.Fo rd_errstr
44cb314988SRui Paulo.Fa "rd_err_e rderr"
45cb314988SRui Paulo.Fc
46cb314988SRui Paulo.Ft rd_err_e
47cb314988SRui Paulo.Fo rd_event_addr
4859c56d6cSMark Johnston.Fa "rd_agent_t *rdap, rd_event_e event, rd_notify_t *notify"
49cb314988SRui Paulo.Fc
50cb314988SRui Paulo.Ft rd_err_e
51cb314988SRui Paulo.Fo rd_event_enable
52cb314988SRui Paulo.Fa "rd_agent_t *rdap, int onoff"
53cb314988SRui Paulo.Fc
54cb314988SRui Paulo.Ft rd_err_e
55cb314988SRui Paulo.Fo rd_event_getmsg
56cb314988SRui Paulo.Fa "rd_agent_t *rdap, rd_event_msg_t *msg"
57cb314988SRui Paulo.Fc
58cb314988SRui Paulo.Ft rd_err_e
59cb314988SRui Paulo.Fo rd_init
60cb314988SRui Paulo.Fa "int version"
61cb314988SRui Paulo.Fc
62cb314988SRui Paulo.Ft typedef int
63cb314988SRui Paulo.Fo rl_iter_f
64cb314988SRui Paulo.Fa "const rd_loadobj_t *, void *"
65cb314988SRui Paulo.Fc
66cb314988SRui Paulo.Ft rd_err_e
67cb314988SRui Paulo.Fo rd_loadobj_iter
68cb314988SRui Paulo.Fa "rd_agent_t *rdap, rl_iter_f *cb, void *clnt_data"
69cb314988SRui Paulo.Fc
70cb314988SRui Paulo.Ft void
71cb314988SRui Paulo.Fo rd_log
72cb314988SRui Paulo.Fa "const int onoff"
73cb314988SRui Paulo.Fc
74cb314988SRui Paulo.Ft rd_agent_t *
75cb314988SRui Paulo.Fo rd_new
76cb314988SRui Paulo.Fa "struct proc_handle *php"
77cb314988SRui Paulo.Fc
78cb314988SRui Paulo.Ft rd_err_e
79cb314988SRui Paulo.Fo rd_objpad_enable
80cb314988SRui Paulo.Fa "rd_agent_t *rdap, size_t padsize"
81cb314988SRui Paulo.Fc
82cb314988SRui Paulo.Ft rd_err_e
83cb314988SRui Paulo.Fo rd_plt_resolution
84b919e637SUlrich Spörlein.Fa "rd_agent_t *rdap, uintptr_t pc, struct proc *proc"
85cb314988SRui Paulo.Fa "uintptr_t plt_base, rd_plt_info_t *rpi"
86cb314988SRui Paulo.Fc
87cb314988SRui Paulo.Ft rd_err_e
88cb314988SRui Paulo.Fo rd_reset
89cb314988SRui Paulo.Fa "rd_agent_t *rdap"
90cb314988SRui Paulo.Fc
91cb314988SRui Paulo.Sh DESCRIPTION
92cb314988SRui PauloThe
93cb314988SRui Paulo.Nm librtld_db
94cb314988SRui Paulolibrary provides a debugging interface to the run-time linker (rtld).
95cb314988SRui PauloThis library must be used along with
96cb314988SRui Paulo.Xr libproc 3 .
97cb314988SRui Paulo.Pp
98cb314988SRui PauloMost library functions take a
99cb314988SRui Paulo.Ft rd_agent_t
100cb314988SRui Pauloargument.
101cb314988SRui PauloThis argument is an opaque structure containing information associated with
102cb314988SRui Paulothe current status of the agent.
103cb314988SRui Paulo.Pp
104cb314988SRui PauloBefore you start using
105cb314988SRui Paulo.Nm
106cb314988SRui Pauloyou should call
107cb314988SRui Paulo.Fn rd_init
108cb314988SRui Paulowith the
109cb314988SRui Paulo.Ft RD_VERSION
110cb314988SRui Pauloargument.
111cb314988SRui PauloThis initializes the library to the correct version your program was compiled
112cb314988SRui Paulowith and provides proper ABI stability.
113cb314988SRui Paulo.Pp
114cb314988SRui PauloWhat follows is a description of what each function.
115cb314988SRui Paulo.Pp
116cb314988SRui Paulo.Fn rd_new
117cb314988SRui Paulocreates a new
118cb314988SRui Paulo.Nm
119cb314988SRui Pauloagent.
120cb314988SRui PauloThe
121cb314988SRui Paulo.Ft php
122cb314988SRui Pauloargument should be the
123cb314988SRui Paulo.Ft proc_handle
124cb314988SRui Pauloyou received from
125cb314988SRui Paulo.Xr libproc 3 .
126cb314988SRui Paulo.Pp
127cb314988SRui Paulo.Fn rd_reset
128cb314988SRui Pauloresets your previously created agent.
129cb314988SRui Paulo.Pp
130cb314988SRui Paulo.Fn rd_delete
131799162a6SJoel Dahldeallocates the resources associated with the agent.
132cb314988SRui Paulo.Pp
133cb314988SRui Paulo.Fn rd_errstr
134cb314988SRui Pauloreturns an error string describing the error present in
135cb314988SRui Paulo.Ft rderr .
136cb314988SRui Paulo.Pp
137cb314988SRui Paulo.Fn rd_event_enable
138cb314988SRui Pauloenables reporting of events.
139cb314988SRui PauloThis function always returns RD_OK.
140cb314988SRui Paulo.Pp
141cb314988SRui Paulo.Fn rd_event_addr
14259c56d6cSMark Johnstonreturns the event address corresponding to the
143cb314988SRui Paulo.Ft event
144799162a6SJoel Dahlparameter.
14559c56d6cSMark JohnstonAt the moment we only report events of type RD_NOTIFY_BPT.
146cb314988SRui Paulo.Pp
147cb314988SRui Paulo.Fn rd_event_getmsg
148799162a6SJoel Dahlreturns the message associated with the latest event.
149cb314988SRui PauloAt the moment only RD_POSTINIT events are supported.
150cb314988SRui Paulo.Pp
151cb314988SRui Paulo.Fn rd_loadobj_iter
152cb314988SRui Pauloallows you to iterate over the program's loaded objects.
153cb314988SRui Paulo.Ft cb
154cb314988SRui Paulois a callback of type
155cb314988SRui Paulo.Fn rl_iter_f .
156cb314988SRui Paulo.Sh RETURN VALUES
157cb314988SRui PauloMost functions return an
158cb314988SRui Paulo.Ft rd_err_e
159cb314988SRui Paulotype error.
160cb314988SRui PauloThe error codes are described in the header file for this library.
161cb314988SRui PauloYou can get the error string using
162cb314988SRui Paulo.Fn rd_errstr .
163cb314988SRui Paulo.Sh SEE ALSO
164cb314988SRui Paulo.Xr ld 1 ,
165cb314988SRui Paulo.Xr ld-elf.so.1 1 ,
166cb314988SRui Paulo.Xr ld.so 1 ,
167*4990a1c0SJoel Dahl.Xr rtld 1 ,
168*4990a1c0SJoel Dahl.Xr libproc 3
169cb314988SRui Paulo.Sh HISTORY
170cb314988SRui PauloThe
171cb314988SRui Paulo.Nm librtld_db
172cb314988SRui Paulolibrary first appeared in
173cb314988SRui Paulo.Fx 9.0
174cb314988SRui Pauloand was modeled after the same library present in the Solaris operating system.
175cb314988SRui Paulo.Sh AUTHORS
176cb314988SRui PauloThe
177cb314988SRui Paulo.Nm librtld_db
178cb314988SRui Paulolibrary and this manual page were written by
1792b7af31cSBaptiste Daroussin.An Rui Paulo Aq Mt rpaulo@FreeBSD.org
180cb314988SRui Paulounder sponsorship from the FreeBSD Foundation.
181b919e637SUlrich Spörlein.Sh CAVEATS
182b919e637SUlrich SpörleinThe functions
183b919e637SUlrich Spörlein.Fn rd_event_enable ,
184b919e637SUlrich Spörlein.Fn rd_log ,
185b919e637SUlrich Spörlein.Fn rd_objpad_enable
186b919e637SUlrich Spörleinand
187b919e637SUlrich Spörlein.Fn rd_plt_resolution
188b919e637SUlrich Spörleinare not yet implemented.
189