xref: /titanic_51/usr/src/cmd/sgs/liblddbg/common/llib-llddbg (revision 1a7c1b724419d3cb5fa6eea75123c6b2060ba31b)
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_bind_title(int);
71void Dbg_file_bind_title64(int);
72void Dbg_file_cntl(Lm_list *, Aliste, Aliste);
73void Dbg_file_config_dis(const char *, int);
74void Dbg_file_config_dis64(const char *, int);
75void Dbg_file_config_obj(const char *, const char *, const char *);
76void Dbg_file_config_obj64(const char *, const char *, const char *);
77void Dbg_file_delete(const char *);
78void Dbg_file_delete64(const char *);
79void Dbg_file_dlclose(const char *, int);
80void Dbg_file_dlclose64(const char *, int);
81void Dbg_file_dldump(const char *, const char *, int);
82void Dbg_file_dldump64(const char *, const char *, int);
83void Dbg_file_dlopen(const char *, const char *, int);
84void Dbg_file_dlopen64(const char *, const char *, int);
85void Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
86	Aliste);
87void Dbg_file_elf64(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t,
88	Aliste);
89void Dbg_file_filtee(const char *, const char *, int);
90void Dbg_file_filtee64(const char *, const char *, int);
91void Dbg_file_filter(const char *, const char *, int);
92void Dbg_file_filter64(const char *, const char *, int);
93void Dbg_file_fixname(const char *, const char *);
94void Dbg_file_fixname64(const char *, const char *);
95void Dbg_file_generic(Ifl_desc *);
96void Dbg_file_generic64(Ifl_desc *);
97void Dbg_file_handle_collect(Grp_hdl *, const char *);
98void Dbg_file_handle_collect64(Grp_hdl *, const char *);
99void Dbg_file_handle(Grp_hdl *, Rt_map *, int);
100void Dbg_file_handle64(Grp_hdl *, Rt_map *, int);
101void Dbg_file_lazyload(const char *, const char *, const char *);
102void Dbg_file_lazyload64(const char *, const char *, const char *);
103void Dbg_file_ldso(const char *, ulong_t, ulong_t, char **, auxv_t *);
104void Dbg_file_ldso64(const char *, ulong_t, ulong_t, char **, auxv_t *);
105void Dbg_file_mode_promote(const char *, int);
106void Dbg_file_needed(const char *, const char *);
107void Dbg_file_needed64(const char *, const char *);
108void Dbg_file_nl(void);
109void Dbg_file_nl64(void);
110void Dbg_file_output(Ofl_desc *);
111void Dbg_file_output64(Ofl_desc *);
112void Dbg_file_preload(const char *);
113void Dbg_file_preload64(const char *);
114void Dbg_file_prot(const char *, int);
115void Dbg_file_prot64(const char *, int);
116void Dbg_file_rejected(Rej_desc *);
117void Dbg_file_reuse(const char *, const char *);
118void Dbg_file_reuse64(const char *, const char *);
119void Dbg_file_ar_rescan(void);
120void Dbg_file_del_rescan(void);
121void Dbg_file_skip(const char *, const char *);
122void Dbg_file_skip64(const char *, const char *);
123void Dbg_got_display(Gottable *, Ofl_desc *);
124void Dbg_got_display64(Gottable *, Ofl_desc *);
125void Dbg_libs_audit(const char *, const char *);
126void Dbg_libs_ignore(const char *);
127void Dbg_libs_init(List *, List *);
128void Dbg_libs_l(const char *, const char *);
129void Dbg_libs_path(const char *, Half, const char *);
130void Dbg_libs_req(const char *, const char *, const char *);
131void Dbg_libs_update(List *, List *);
132void Dbg_libs_yp(const char *);
133void Dbg_libs_ylu(const char *, const char *, int);
134void Dbg_libs_find(const char *);
135void Dbg_libs_found(const char *, int);
136void Dbg_map_atsign(Boolean);
137void Dbg_map_atsign64(Boolean);
138void Dbg_map_dash(const char *, Sdf_desc *);
139void Dbg_map_dash64(const char *, Sdf_desc *);
140void Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *);
141void Dbg_map_ent64(Boolean, Ent_desc *, Ofl_desc *);
142void Dbg_map_equal(Boolean);
143void Dbg_map_equal64(Boolean);
144void Dbg_map_parse(const char *);
145void Dbg_map_parse64(const char *);
146void Dbg_map_pipe(Sg_desc *, const char *, const Word);
147void Dbg_map_pipe64(Sg_desc *, const char *, const Word);
148void Dbg_map_seg(Half, int, Sg_desc *);
149void Dbg_map_seg64(Half, int, Sg_desc *);
150void Dbg_map_size_new(const char *);
151void Dbg_map_size_new64(const char *);
152void Dbg_map_size_old(Ehdr *, Sym_desc *);
153void Dbg_map_size_old64(Ehdr *, Sym_desc *);
154void Dbg_map_sort_fini(Sg_desc *);
155void Dbg_map_sort_fini64(Sg_desc *);
156void Dbg_map_sort_orig(Sg_desc *);
157void Dbg_map_sort_orig64(Sg_desc *);
158void Dbg_map_symbol(Ehdr *, Sym_desc *);
159void Dbg_map_symbol64(Ehdr *, Sym_desc *);
160void Dbg_map_version(const char *, const char *, int);
161void Dbg_map_version64(const char *, const char *, int);
162void Dbg_move_adjexpandreloc(ulong_t, const char *);
163void Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *);
164void Dbg_move_data(const char *);
165void Dbg_move_expanding(Move *, Addr);
166void Dbg_move_input1(const char *);
167void Dbg_move_mventry(int, Move *, Sym_desc *);
168void Dbg_move_mventry64(int, Move *, Sym_desc *);
169void Dbg_move_mventry2(Move *, Word, char *);
170void Dbg_move_mventry264(Move *, Word, char *);
171void Dbg_move_outmove(const uchar_t *);
172void Dbg_move_outsctadj(Sym_desc *);
173void Dbg_move_outsctadj64(Sym_desc *);
174void Dbg_move_parexpn(const char *, const char *);
175void Dbg_pltpad_bindto64(const char *, const char *, Addr);
176void Dbg_pltpad_boundto64(const char *, Addr, const char *, const char *);
177void Dbg_reloc_apply(unsigned long long, unsigned long long);
178void Dbg_reloc_ars_entry(Half, Rel_desc *);
179void Dbg_reloc_ars_entry64(Half, Rel_desc *);
180void Dbg_reloc_copy(const char *, const char *, const char *, int);
181void Dbg_reloc_discard(Half, Rel_desc *);
182void Dbg_reloc_discard64(Half, Rel_desc *);
183void Dbg_reloc_doact(Half, Word, Xword, Xword, const char *, Os_desc *);
184void Dbg_reloc_doact64(Half, Word, Xword, Xword, const char *, Os_desc *);
185void Dbg_reloc_doactiverel(void);
186void Dbg_reloc_dooutrel(GElf_Word);
187void Dbg_reloc_dooutrel64(GElf_Word);
188void Dbg_reloc_in(Half, Word, void *, const char *, const char *);
189void Dbg_reloc_in64(Half, Word, void *, const char *, const char *);
190void Dbg_reloc_ors_entry(Half, Rel_desc *);
191void Dbg_reloc_ors_entry64(Half, Rel_desc *);
192void Dbg_reloc_out(Half, Word, void *, const char *, const char *);
193void Dbg_reloc_out64(Half, Word, void *, const char *, const char *);
194void Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *);
195void Dbg_reloc_proc64(Os_desc *, Is_desc *, Is_desc *);
196void Dbg_reloc_run(const char *, uint_t, int, int);
197void Dbg_reloc_reg_apply(unsigned long long, unsigned long long);
198void Dbg_reloc_reg_apply64(unsigned long long, unsigned long long);
199void Dbg_sec_added(Os_desc *, Sg_desc *);
200void Dbg_sec_added64(Os_desc *, Sg_desc *);
201void Dbg_sec_created(Os_desc *, Sg_desc *);
202void Dbg_sec_created64(Os_desc *, Sg_desc *);
203void Dbg_sec_group(Is_desc *, Group_desc *);
204void Dbg_sec_group64(Is_desc *, Group_desc *);
205void Dbg_sec_in(Is_desc *);
206void Dbg_sec_in64(Is_desc *);
207void Dbg_sec_order_list(Ofl_desc *, int);
208void Dbg_sec_order_list64(Ofl_desc *, int);
209void Dbg_sec_order_error(Ifl_desc *, Word, int);
210void Dbg_sec_order_error64(Ifl_desc *, Word, int);
211void Dbg_seg_entry(Half, int, Sg_desc *);
212void Dbg_seg_entry64(Half, int, Sg_desc *);
213void Dbg_seg_list(Half, List *);
214void Dbg_seg_list64(Half, List *);
215void Dbg_seg_os(Ofl_desc *, Os_desc *, int);
216void Dbg_seg_os64(Ofl_desc *, Os_desc *, int);
217void Dbg_seg_title(void);
218void Dbg_seg_title64(void);
219void Dbg_statistics_ld(Ofl_desc *);
220void Dbg_statistics_ld64(Ofl_desc *);
221void Dbg_statistics_ar(Ofl_desc *);
222void Dbg_statistics_ar64(Ofl_desc *);
223void Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *);
224void Dbg_syms_ar_checking64(Xword, Elf_Arsym *, const char *);
225void Dbg_syms_ar_entry(Xword, Elf_Arsym *);
226void Dbg_syms_ar_entry64(Xword, Elf_Arsym *);
227void Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *, int);
228void Dbg_syms_ar_resolve64(Xword, Elf_Arsym *, const char *, int);
229void Dbg_syms_ar_title(const char *, int);
230void Dbg_syms_ar_title64(const char *, int);
231void Dbg_syms_created(const char *);
232void Dbg_syms_created64(const char *);
233void Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *);
234void Dbg_syms_entered64(Ehdr *, Sym *, Sym_desc *);
235void Dbg_syms_entry(Xword, Sym_desc *);
236void Dbg_syms_entry64(Xword, Sym_desc *);
237void Dbg_syms_global(Xword, const char *);
238void Dbg_syms_global64(Xword, const char *);
239void Dbg_syms_new(Ehdr *, Sym *, Sym_desc *);
240void Dbg_syms_new64(Ehdr *, Sym *, Sym_desc *);
241void Dbg_syms_nl(void);
242void Dbg_syms_nl64(void);
243void Dbg_syms_old(Ehdr *, Sym_desc *);
244void Dbg_syms_old64(Ehdr *, Sym_desc *);
245void Dbg_syms_process(Ifl_desc *);
246void Dbg_syms_process64(Ifl_desc *);
247void Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int, const char *);
248void Dbg_syms_reduce64(int, Ehdr *, Sym_desc *, int, const char *);
249void Dbg_syms_reloc(Ehdr *, Sym_desc *);
250void Dbg_syms_reloc64(Ehdr *, Sym_desc *);
251void Dbg_syms_resolved(Ehdr *, Sym_desc *);
252void Dbg_syms_resolved64(Ehdr *, Sym_desc *);
253void Dbg_syms_resolving1(Xword, const char *, int, int);
254void Dbg_syms_resolving164(Xword, const char *, int, int);
255void Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
256void Dbg_syms_resolving264(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *);
257void Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *);
258void Dbg_syms_sec_entry64(int, Sg_desc *, Os_desc *);
259void Dbg_syms_sec_title(void);
260void Dbg_syms_sec_title64(void);
261void Dbg_syms_sec_unused(Is_desc *, uint_t);
262void Dbg_syms_sec_unused64(Is_desc *, uint_t);
263void Dbg_syms_spec_title(void);
264void Dbg_syms_spec_title64(void);
265void Dbg_syms_up_title(Ehdr *);
266void Dbg_syms_up_title64(Ehdr *);
267void Dbg_syms_updated(Ehdr *, Sym_desc *, const char *);
268void Dbg_syms_updated64(Ehdr *, Sym_desc *, const char *);
269void Dbg_syms_dlsym(const char *, const char *, const char *, int);
270void Dbg_syms_dlsym64(const char *, const char *, const char *, int);
271void Dbg_syms_lookup_aout(const char *);
272void Dbg_syms_lookup_aout64(const char *);
273void Dbg_syms_lookup(const char *, const char *, const char *);
274void Dbg_syms_lookup64(const char *, const char *, const char *);
275void Dbg_syminfo_entry(int, Syminfo *, Sym *, const char *, Dyn *);
276void Dbg_syminfo_entry64(int, Syminfo *, Sym *, const char *, Dyn *);
277void Dbg_syminfo_title(void);
278void Dbg_syminfo_title64(void);
279void Dbg_support_action(const char *, const char *, Support_ndx, const char *);
280void Dbg_support_load(const char *, const char *);
281void Dbg_support_req(const char *, int);
282void Dbg_unused_file(const char *, int);
283void Dbg_unused_rtldinfo(const char *, const char *);
284void Dbg_unused_sec(Is_desc *);
285void Dbg_unused_sec64(Is_desc *);
286void Dbg_unused_unref(const char *, const char *);
287void Dbg_util_call_fini(const char *);
288void Dbg_util_call_init(const char *, int);
289void Dbg_util_call_main(const char *);
290void Dbg_util_intoolate(const char *);
291void Dbg_util_nl(void);
292void Dbg_util_no_init(const char *);
293void Dbg_util_str(const char *);
294void Dbg_ver_avail_entry(Ver_index *, const char *);
295void Dbg_ver_avail_entry64(Ver_index *, const char *);
296void Dbg_ver_avail_title(const char *);
297void Dbg_ver_def_title(const char *);
298void Dbg_ver_desc_entry(Ver_desc *);
299void Dbg_ver_desc_entry64(Ver_desc *);
300void Dbg_ver_need_title(const char *);
301void Dbg_ver_need_entry(Half, const char *, const char *);
302void Dbg_ver_symbol(const char *);
303
304/*
305 * Gelf related functions, used by elfdump
306 */
307const char * Gelf_sym_dem(const char *);
308
309void Gelf_cap_print(GElf_Cap *, int, Half);
310void Gelf_cap_title(void);
311void Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half);
312void Gelf_dyn_title(void);
313void Gelf_elf_data_title(void);
314void Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *);
315void Gelf_got_title(uchar_t);
316void Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr, GElf_Xword,
317	GElf_Word, void *, const char *);
318void Gelf_note_entry(GElf_Word *, GElf_Word);
319void Gelf_phdr_entry(Half, GElf_Phdr *);
320void Gelf_reloc_entry(const char *, GElf_Half, GElf_Word,
321	GElf_Rela *, const char *, const char *);
322void Gelf_shdr_entry(Half, GElf_Shdr *);
323void Gelf_sym_table_entry(const char *, GElf_Ehdr *, GElf_Sym *,
324	GElf_Word, const char *, const char *);
325void Gelf_sym_table_title(GElf_Ehdr *, const char *, const char *);
326void Gelf_syminfo_entry(int, GElf_Syminfo *, const char *, const char *);
327void Gelf_syminfo_title(void);
328void Gelf_ver_def_title(void);
329void Gelf_ver_need_title(void);
330void Gelf_ver_line_1(const char *, const char *, const char *, const char *);
331void Gelf_ver_line_2(const char *, const char *);
332void Gelf_ver_line_3(const char *, const char *, const char *);
333