xref: /titanic_44/usr/src/cmd/sgs/liblddbg/common/llib-llddbg (revision 3a5240e95e08e42ac1fc82775b3d0ba6e072a74c)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License").  You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22/* LINTLIBRARY */
23/* PROTOLIB1 */
24
25/*
26 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
27 * Use is subject to license terms.
28 */
29
30#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32#include <sys/types.h>
33#include <sys/auxv.h>
34#include <gelf.h>
35#include "debug.h"
36
37uint_t Dbg_setup(const char *);
38void Dbg_set(uint_t);
39
40void Dbg_args_files(int, char *);
41void Dbg_args_flags(int, int);
42void Dbg_audit_interface(const char *, const char *);
43void Dbg_audit_interface64(const char *, const char *);
44void Dbg_audit_lib(const char *);
45void Dbg_audit_lib64(const char *);
46void Dbg_audit_object(const char *, const char *);
47void Dbg_audit_object64(const char *, const char *);
48void Dbg_audit_symval(const char *, const char *, const char *, Addr, Addr);
49void Dbg_audit_symval64(const char *, const char *, const char *, Addr, Addr);
50void Dbg_audit_version(const char *, ulong_t);
51void Dbg_audit_version64(const char *, ulong_t);
52void Dbg_bind_global(const char *, caddr_t, caddr_t, Xword, Pltbindtype,
53	const char *, caddr_t, caddr_t, const char *, uint_t);
54void Dbg_bind_profile(uint_t, uint_t);
55void Dbg_bind_weak(const char *, caddr_t, caddr_t, const char *);
56void Dbg_cap_hw_candidate(const char *);
57void Dbg_cap_hw_filter(const char *, const char *);
58void Dbg_cap_hw_1(Xword, Half);
59void Dbg_cap_sec_entry(uint_t, Xword, Xword, Half);
60void Dbg_cap_sec_title(const char *);
61void Dbg_ent_print(Half, List *, Boolean);
62void Dbg_file_analyze(Rt_map *);
63void Dbg_file_analyze64(Rt_map *);
64void Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t);
65void Dbg_file_aout64(const char *, ulong_t, ulong_t, ulong_t);
66void Dbg_file_archive(const char *, int);
67void Dbg_file_archive64(const char *, int);
68void Dbg_file_bind_entry(Bnd_desc *);
69void Dbg_file_bind_entry64(Bnd_desc *);
70void Dbg_file_bindings(Rt_map *, int, Word);
71void Dbg_file_bindings64(Rt_map *, int, Word);
72void Dbg_file_bind_title(int);
73void Dbg_file_bind_title64(int);
74void Dbg_file_cntl(Lm_list *, Aliste, Aliste);
75void Dbg_file_config_dis(const char *, int);
76void Dbg_file_config_dis64(const char *, int);
77void Dbg_file_config_obj(const char *, const char *, const char *);
78void Dbg_file_config_obj64(const char *, const char *, const char *);
79void Dbg_file_delete(const char *);
80void Dbg_file_delete64(const char *);
81void Dbg_file_dlclose(const char *, int);
82void Dbg_file_dlclose64(const char *, int);
83void Dbg_file_dldump(const char *, const char *, int);
84void Dbg_file_dldump64(const char *, const char *, int);
85void Dbg_file_dlopen(const char *, const char *, int);
86void Dbg_file_dlopen64(const char *, const char *, int);
87void Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
88	Aliste);
89void Dbg_file_elf64(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
90	Aliste);
91void Dbg_file_filtee(const char *, const char *, int);
92void Dbg_file_filtee64(const char *, const char *, int);
93void Dbg_file_filter(const char *, const char *, int);
94void Dbg_file_filter64(const char *, const char *, int);
95void Dbg_file_fixname(const char *, const char *);
96void Dbg_file_fixname64(const char *, const char *);
97void Dbg_file_generic(Ifl_desc *);
98void Dbg_file_generic64(Ifl_desc *);
99void Dbg_file_handle_collect(Grp_hdl *, const char *);
100void Dbg_file_handle_collect64(Grp_hdl *, const char *);
101void Dbg_file_handle(Grp_hdl *, Rt_map *, int);
102void Dbg_file_handle64(Grp_hdl *, Rt_map *, int);
103void Dbg_file_lazyload(const char *, const char *, const char *);
104void Dbg_file_lazyload64(const char *, const char *, const char *);
105void Dbg_file_ldso(const char *, ulong_t, ulong_t, char **, auxv_t *);
106void Dbg_file_ldso64(const char *, ulong_t, ulong_t, char **, auxv_t *);
107void Dbg_file_mode_promote(const char *, int);
108void Dbg_file_needed(const char *, const char *);
109void Dbg_file_needed64(const char *, const char *);
110void Dbg_file_nl(void);
111void Dbg_file_nl64(void);
112void Dbg_file_output(Ofl_desc *);
113void Dbg_file_output64(Ofl_desc *);
114void Dbg_file_preload(const char *);
115void Dbg_file_preload64(const char *);
116void Dbg_file_prot(const char *, int);
117void Dbg_file_prot64(const char *, int);
118void Dbg_file_rejected(Rej_desc *);
119void Dbg_file_reuse(const char *, const char *);
120void Dbg_file_reuse64(const char *, const char *);
121void Dbg_file_ar_rescan(void);
122void Dbg_file_del_rescan(void);
123void Dbg_file_skip(const char *, const char *);
124void Dbg_file_skip64(const char *, const char *);
125void Dbg_got_display(Gottable *, Ofl_desc *);
126void Dbg_got_display64(Gottable *, Ofl_desc *);
127void Dbg_libs_audit(const char *, const char *);
128void Dbg_libs_ignore(const char *);
129void Dbg_libs_init(List *, List *);
130void Dbg_libs_l(const char *, const char *);
131void Dbg_libs_path(const char *, Half, const char *);
132void Dbg_libs_req(const char *, const char *, const char *);
133void Dbg_libs_update(List *, List *);
134void Dbg_libs_yp(const char *);
135void Dbg_libs_ylu(const char *, const char *, int);
136void Dbg_libs_find(const char *);
137void Dbg_libs_found(const char *, int);
138void Dbg_map_atsign(Boolean);
139void Dbg_map_atsign64(Boolean);
140void Dbg_map_dash(const char *, Sdf_desc *);
141void Dbg_map_dash64(const char *, Sdf_desc *);
142void Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *);
143void Dbg_map_ent64(Boolean, Ent_desc *, Ofl_desc *);
144void Dbg_map_equal(Boolean);
145void Dbg_map_equal64(Boolean);
146void Dbg_map_parse(const char *);
147void Dbg_map_parse64(const char *);
148void Dbg_map_pipe(Sg_desc *, const char *, const Word);
149void Dbg_map_pipe64(Sg_desc *, const char *, const Word);
150void Dbg_map_seg(Half, int, Sg_desc *);
151void Dbg_map_seg64(Half, int, Sg_desc *);
152void Dbg_map_size_new(const char *);
153void Dbg_map_size_new64(const char *);
154void Dbg_map_size_old(Ehdr *, Sym_desc *);
155void Dbg_map_size_old64(Ehdr *, Sym_desc *);
156void Dbg_map_sort_fini(Sg_desc *);
157void Dbg_map_sort_fini64(Sg_desc *);
158void Dbg_map_sort_orig(Sg_desc *);
159void Dbg_map_sort_orig64(Sg_desc *);
160void Dbg_map_symbol(Ehdr *, Sym_desc *);
161void Dbg_map_symbol64(Ehdr *, Sym_desc *);
162void Dbg_map_version(const char *, const char *, int);
163void Dbg_map_version64(const char *, const char *, int);
164void Dbg_move_adjexpandreloc(ulong_t, const char *);
165void Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *);
166void Dbg_move_data(const char *);
167void Dbg_move_expanding(Move *, Addr);
168void Dbg_move_input1(const char *);
169void Dbg_move_mventry(int, Move *, Sym_desc *);
170void Dbg_move_mventry64(int, Move *, Sym_desc *);
171void Dbg_move_mventry2(Move *, Word, char *);
172void Dbg_move_mventry264(Move *, Word, char *);
173void Dbg_move_outmove(const uchar_t *);
174void Dbg_move_outsctadj(Sym_desc *);
175void Dbg_move_outsctadj64(Sym_desc *);
176void Dbg_move_parexpn(const char *, const char *);
177void Dbg_pltpad_bindto64(const char *, const char *, Addr);
178void Dbg_pltpad_boundto64(const char *, Addr, const char *, const char *);
179void Dbg_reloc_apply(unsigned long long, unsigned long long);
180void Dbg_reloc_ars_entry(Half, Rel_desc *);
181void Dbg_reloc_ars_entry64(Half, Rel_desc *);
182void Dbg_reloc_copy(const char *, const char *, const char *, int);
183void Dbg_reloc_discard(Half, Rel_desc *);
184void Dbg_reloc_discard64(Half, Rel_desc *);
185void Dbg_reloc_doact(Half, Word, Xword, Xword, const char *, Os_desc *);
186void Dbg_reloc_doact64(Half, Word, Xword, Xword, const char *, Os_desc *);
187void Dbg_reloc_doactiverel(void);
188void Dbg_reloc_dooutrel(GElf_Word);
189void Dbg_reloc_dooutrel64(GElf_Word);
190void Dbg_reloc_in(Half, Word, void *, const char *, const char *);
191void Dbg_reloc_in64(Half, Word, void *, const char *, const char *);
192void Dbg_reloc_ors_entry(Half, Rel_desc *);
193void Dbg_reloc_ors_entry64(Half, Rel_desc *);
194void Dbg_reloc_out(Half, Word, void *, const char *, const char *);
195void Dbg_reloc_out64(Half, Word, void *, const char *, const char *);
196void Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *);
197void Dbg_reloc_proc64(Os_desc *, Is_desc *, Is_desc *);
198void Dbg_reloc_run(const char *, uint_t, int, int);
199void Dbg_reloc_reg_apply(unsigned long long, unsigned long long);
200void Dbg_reloc_reg_apply64(unsigned long long, unsigned long long);
201void Dbg_sec_added(Os_desc *, Sg_desc *);
202void Dbg_sec_added64(Os_desc *, Sg_desc *);
203void Dbg_sec_created(Os_desc *, Sg_desc *);
204void Dbg_sec_created64(Os_desc *, Sg_desc *);
205void Dbg_sec_group(Is_desc *, Group_desc *);
206void Dbg_sec_group64(Is_desc *, Group_desc *);
207void Dbg_sec_in(Is_desc *);
208void Dbg_sec_in64(Is_desc *);
209void Dbg_sec_order_list(Ofl_desc *, int);
210void Dbg_sec_order_list64(Ofl_desc *, int);
211void Dbg_sec_order_error(Ifl_desc *, Word, int);
212void Dbg_sec_order_error64(Ifl_desc *, Word, int);
213void Dbg_seg_entry(Half, int, Sg_desc *);
214void Dbg_seg_entry64(Half, int, Sg_desc *);
215void Dbg_seg_list(Half, List *);
216void Dbg_seg_list64(Half, List *);
217void Dbg_seg_os(Ofl_desc *, Os_desc *, int);
218void Dbg_seg_os64(Ofl_desc *, Os_desc *, int);
219void Dbg_seg_title(void);
220void Dbg_seg_title64(void);
221void Dbg_statistics_ld(Ofl_desc *);
222void Dbg_statistics_ld64(Ofl_desc *);
223void Dbg_statistics_ar(Ofl_desc *);
224void Dbg_statistics_ar64(Ofl_desc *);
225void Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *);
226void Dbg_syms_ar_checking64(Xword, Elf_Arsym *, const char *);
227void Dbg_syms_ar_entry(Xword, Elf_Arsym *);
228void Dbg_syms_ar_entry64(Xword, Elf_Arsym *);
229void Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *, int);
230void Dbg_syms_ar_resolve64(Xword, Elf_Arsym *, const char *, int);
231void Dbg_syms_ar_title(const char *, int);
232void Dbg_syms_ar_title64(const char *, int);
233void Dbg_syms_created(const char *);
234void Dbg_syms_created64(const char *);
235void Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *);
236void Dbg_syms_entered64(Ehdr *, Sym *, Sym_desc *);
237void Dbg_syms_entry(Xword, Sym_desc *);
238void Dbg_syms_entry64(Xword, Sym_desc *);
239void Dbg_syms_global(Xword, const char *);
240void Dbg_syms_global64(Xword, const char *);
241void Dbg_syms_new(Ehdr *, Sym *, Sym_desc *);
242void Dbg_syms_new64(Ehdr *, Sym *, Sym_desc *);
243void Dbg_syms_nl(void);
244void Dbg_syms_nl64(void);
245void Dbg_syms_old(Ehdr *, Sym_desc *);
246void Dbg_syms_old64(Ehdr *, Sym_desc *);
247void Dbg_syms_process(Ifl_desc *);
248void Dbg_syms_process64(Ifl_desc *);
249void Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int, const char *);
250void Dbg_syms_reduce64(int, Ehdr *, Sym_desc *, int, const char *);
251void Dbg_syms_reloc(Ehdr *, Sym_desc *);
252void Dbg_syms_reloc64(Ehdr *, Sym_desc *);
253void Dbg_syms_resolved(Ehdr *, Sym_desc *);
254void Dbg_syms_resolved64(Ehdr *, Sym_desc *);
255void Dbg_syms_resolving1(Xword, const char *, int, int);
256void Dbg_syms_resolving164(Xword, const char *, int, int);
257void Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
258void Dbg_syms_resolving264(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
259void Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *);
260void Dbg_syms_sec_entry64(int, Sg_desc *, Os_desc *);
261void Dbg_syms_sec_title(void);
262void Dbg_syms_sec_title64(void);
263void Dbg_syms_sec_unused(Is_desc *, uint_t);
264void Dbg_syms_sec_unused64(Is_desc *, uint_t);
265void Dbg_syms_spec_title(void);
266void Dbg_syms_spec_title64(void);
267void Dbg_syms_up_title(Ehdr *);
268void Dbg_syms_up_title64(Ehdr *);
269void Dbg_syms_updated(Ehdr *, Sym_desc *, const char *);
270void Dbg_syms_updated64(Ehdr *, Sym_desc *, const char *);
271void Dbg_syms_dlsym(const char *, const char *, const char *, int);
272void Dbg_syms_dlsym64(const char *, const char *, const char *, int);
273void Dbg_syms_lookup_aout(const char *);
274void Dbg_syms_lookup_aout64(const char *);
275void Dbg_syms_lookup(const char *, const char *, const char *);
276void Dbg_syms_lookup64(const char *, const char *, const char *);
277void Dbg_syminfo_entry(int, Syminfo *, Sym *, const char *, Dyn *);
278void Dbg_syminfo_entry64(int, Syminfo *, Sym *, const char *, Dyn *);
279void Dbg_syminfo_title(void);
280void Dbg_syminfo_title64(void);
281void Dbg_support_action(const char *, const char *, Support_ndx, const char *);
282void Dbg_support_load(const char *, const char *);
283void Dbg_support_req(const char *, int);
284void Dbg_unused_file(const char *, int, int);
285void Dbg_unused_rtldinfo(const char *, const char *);
286void Dbg_unused_sec(Is_desc *);
287void Dbg_unused_sec64(Is_desc *);
288void Dbg_unused_unref(const char *, const char *);
289void Dbg_util_broadcast(const char *name);
290void Dbg_util_call_array(const char *libname, void *addr, uint_t ndx,
291    uint_t shtype);
292void Dbg_util_call_fini(const char *name);
293void Dbg_util_call_init(const char *name, int flag);
294void Dbg_util_call_main(const char *name);
295void Dbg_util_collect(const char *name, int flag, int ndx);
296void Dbg_util_dbnotify(rd_event_e event, r_state_e state);
297void Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag);
298void Dbg_util_edge_out(const char *cname, int ndx, const char *dname);
299void Dbg_util_intoolate(const char *name);
300void Dbg_util_nl();
301void Dbg_util_no_init(const char *name);
302void Dbg_util_scc_entry(uint_t idx, const char *name);
303void Dbg_util_scc_title(int sec);
304void Dbg_util_str(const char *name);
305void Dbg_util_wait(int what, const char *cname, const char *dname);
306void Dbg_ver_avail_entry(Ver_index *, const char *);
307void Dbg_ver_avail_entry64(Ver_index *, const char *);
308void Dbg_ver_avail_title(const char *);
309void Dbg_ver_def_title(const char *);
310void Dbg_ver_desc_entry(Ver_desc *);
311void Dbg_ver_desc_entry64(Ver_desc *);
312void Dbg_ver_need_title(const char *);
313void Dbg_ver_need_entry(Half, const char *, const char *);
314void Dbg_ver_symbol(const char *);
315
316/*
317 * Gelf related functions, used by elfdump
318 */
319const char * Gelf_sym_dem(const char *);
320
321void Gelf_cap_print(GElf_Cap *, int, Half);
322void Gelf_cap_title(void);
323void Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half);
324void Gelf_dyn_title(void);
325void Gelf_elf_data_title(void);
326void Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *);
327void Gelf_got_title(uchar_t);
328void Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr, GElf_Xword,
329	GElf_Word, void *, const char *);
330void Gelf_note_entry(GElf_Word *, GElf_Word);
331void Gelf_phdr_entry(Half, GElf_Phdr *);
332void Gelf_reloc_entry(const char *, GElf_Half, GElf_Word,
333	GElf_Rela *, const char *, const char *);
334void Gelf_shdr_entry(Half, GElf_Shdr *);
335void Gelf_sym_table_entry(const char *, GElf_Ehdr *, GElf_Sym *,
336	GElf_Word, const char *, const char *);
337void Gelf_sym_table_title(GElf_Ehdr *, const char *, const char *);
338void Gelf_syminfo_entry(int, GElf_Syminfo *, const char *, const char *);
339void Gelf_syminfo_title(void);
340void Gelf_ver_def_title(void);
341void Gelf_ver_need_title(void);
342void Gelf_ver_line_1(const char *, const char *, const char *, const char *);
343void Gelf_ver_line_2(const char *, const char *);
344void Gelf_ver_line_3(const char *, const char *, const char *);
345