/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _DEBUG_H
#define _DEBUG_H
/*
* Global include file for lddbg debugging.
*
* ld(1) and ld.so.1(1) carry out all diagnostic debugging calls via lazy
* loading the library liblddbg.so. Thus debugging is always enabled. The
* utility elfdump(1) is explicitly dependent upon this library. There are two
* categories of routines defined in this library:
*
* o Debugging routines that have specific linker knowledge, and test the
* class of debugging allowable before proceeding, start with the `Dbg_'
* prefix.
*
* o Lower level routines that provide generic ELF structure interpretation
* start with the `Elf_' prefix. These latter routines are the only
* routines used by the elfdump(1) utility.
*/
#include <sgs.h>
#include <libld.h>
#include <rtld.h>
#include <gelf.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define Dbg_*() interface values. These values direct the debugging routine
* to generate different diagnostics, thus the strings themselves are maintained
* in the debugging library.
*/
#define DBG_DLSYM_DEF 0
#define DBG_DLCLOSE_NULL 0
/*
* Group handle operations - passed to Dbg_file_hdl_title(). Indicate why
* handle dependencies are being manipulated.
*/
/*
* Group handle dependency operations - passed to Dbg_file_hdl_action().
* Identify the dependencies that are associated with a handle.
*/
/*
* Binding information, indicating the result of a symbol binding. Can also
* indicate the reference as being EXTERN or PARENT. Binding information is
* used to augment diagnostic binding information (which in turn can be used by
* lari(1)), and to enable ldd(1) -p processing.
*/
/*
* ld.so.1(1) symbol capabilities processing.
*/
#define DBG_CAP_DEFAULT 0
/* default search model */
/*
* Dbg_state_str() is used to obtain commonly used "state transition"
* strings used in various debugging output.
*/
extern const char *Dbg_state_str(dbg_state_t);
/*
* Define a debug descriptor, and a user macro that inspects the descriptor as
* a means of triggering a class of diagnostic output.
*/
typedef struct {
/* gettimeofday(3c) */
/* gettimeofday(3c) */
} Dbg_desc;
/*
* Macros used to avoid calls to liblddbg unless debugging is enabled.
* liblddbg is lazy loaded --- this prevents it from happening unless
* it will actually be used.
*/
/*
* Most debugging tokens are interpreted within liblddbg, and thus any flags
* within d_class are only meaningful to this library. The following flags
* extend the d_class diagnostic, and are maintained in d_extra. These flags
* may be interpreted by the debugging library itself or from the callers
* dbg_print() routine.
*/
/* ld only */
/* ld.so.1 only */
#define DBG_ISDEMANGLE() \
/*
* Print routine, this must be supplied by the application. The initial
* argument may provide a link-map list to associate with the format statement
* that follows.
*/
/* PRINTFLIKE2 */
/*
* Initialization routine, called before any other Dbg routines to
* establish the necessary state.
*/
extern int Dbg_setup(dbg_setup_caller_t, const char *,
Dbg_desc *, const char **);
/* Call dbg_print() to produce linker version output */
extern void Dbg_version(void);
/* Call dbg_print() to produce help output */
extern void Dbg_help(void);
/*
* Establish ELF32 and ELF64 class Dbg_*() interfaces.
*/
#if defined(_ELF64)
#else
#endif
/*
* External Dbg_*() interface routines.
*/
extern void Dbg_args_file(Lm_list *, int, char *);
extern void Dbg_args_guidance_unknown(Lm_list *, const char *);
extern void Dbg_args_option(Lm_list *, int, int, char *);
extern void Dbg_args_str2chr(Lm_list *, int, const char *, int);
extern void Dbg_args_Wldel(Lm_list *, int, const char *);
extern void Dbg_audit_activity(Lm_list *, const char *, const char *,
uint_t);
extern void Dbg_audit_ignore(Rt_map *);
extern void Dbg_audit_interface(Lm_list *, const char *, const char *);
extern void Dbg_audit_lib(Rt_map *, const char *, int);
extern void Dbg_audit_objclose(Lm_list *, const char *, const char *);
extern void Dbg_audit_objopen(Lm_list *, int, const char *, const char *,
extern void Dbg_audit_objfilter(Lm_list *, int, const char *, const char *,
const char *, const char *);
extern void Dbg_audit_objsearch(Lm_list *, int, const char *, const char *,
uint_t, const char *);
extern void Dbg_audit_pltenter(Lm_list *, int, const char *, const char *,
Addr);
extern void Dbg_audit_pltexit(Lm_list *, const char *, const char *);
extern void Dbg_audit_preinit(Lm_list *, const char *, const char *);
extern void Dbg_audit_symbind(Lm_list *, int, const char *, const char *,
extern void Dbg_audit_skip(Lm_list *, const char *, const char *);
extern void Dbg_audit_terminate(Lm_list *, const char *);
extern void Dbg_basic_collect(Lm_list *);
extern void Dbg_basic_create(Lm_list *);
extern void Dbg_basic_finish(Lm_list *);
extern void Dbg_basic_files(Lm_list *);
extern void Dbg_basic_options(Lm_list *);
extern void Dbg_basic_relocate(Lm_list *);
extern void Dbg_basic_validate(Lm_list *);
#if defined(_ELF64)
#endif
extern void Dbg_cap_candidate(Lm_list *, const char *);
extern void Dbg_cap_identical(Lm_list *, const char *, const char *);
extern void Dbg_cap_post_title(Lm_list *, int *);
extern void Dbg_cap_sec_title(Lm_list *, const char *);
extern void Dbg_dl_dladdr(Rt_map *, void *);
extern void Dbg_dl_dlclose(Rt_map *, const char *, int);
extern void Dbg_dl_dldump(Rt_map *, const char *, const char *, int);
extern void Dbg_dl_dlerror(Rt_map *, const char *);
extern void Dbg_dl_dlinfo(Rt_map *, const char *, int, void *);
extern void Dbg_dl_dlopen(Rt_map *, const char *, int *, int);
extern void Dbg_dl_dlsym(Rt_map *, const char *, int *, const char *, int);
extern void Dbg_dl_iphdr_unmap_ret(Lm_list *);
extern const char *
Dbg_demangle_name(const char *);
extern void Dbg_file_analyze(Rt_map *);
const char *, Aliste);
extern void Dbg_file_ar_rescan(Lm_list *, int, int);
extern void Dbg_file_bindings(Rt_map *, int);
extern void Dbg_file_bindings_done(Lm_list *);
extern void Dbg_file_config_dis(Lm_list *, const char *, int);
extern void Dbg_file_config_obj(Lm_list *, const char *, const char *,
const char *);
extern void Dbg_file_del_rescan(Lm_list *);
extern void Dbg_file_delete(Rt_map *);
extern void Dbg_file_deferred(Lm_list *, const char *, const char *);
const char *, Aliste);
extern void Dbg_file_filtee(Lm_list *, const char *, const char *, int);
extern void Dbg_file_filter(Lm_list *, const char *, const char *, int);
extern void Dbg_file_fixname(Lm_list *, const char *, const char *);
extern void Dbg_file_hdl_collect(Grp_hdl *, const char *);
extern void Dbg_file_hdl_title(int);
extern void Dbg_file_lazyload(Rt_map *, const char *, const char *);
Aliste);
uint_t);
extern void Dbg_file_mode_promote(Rt_map *, int);
extern void Dbg_file_modified(Lm_list *, const char *, const char *,
extern void Dbg_file_needed(Rt_map *, const char *);
extern void Dbg_file_output(Ofl_desc *);
extern void Dbg_file_preload(Lm_list *, const char *);
extern void Dbg_file_prot(Rt_map *, int);
extern void Dbg_file_reuse(Lm_list *, const char *, const char *);
extern void Dbg_file_skip(Lm_list *, const char *, const char *);
extern void Dbg_libs_audit(Lm_list *, const char *, const char *);
extern void Dbg_libs_find(Lm_list *, const char *);
extern void Dbg_libs_found(Lm_list *, const char *, int);
extern void Dbg_libs_insecure(Lm_list *, const char *, int);
extern void Dbg_libs_l(Lm_list *, const char *, const char *);
extern void Dbg_libs_req(Lm_list *, const char *, const char *,
const char *);
extern void Dbg_libs_yp(Lm_list *, const char *);
extern void Dbg_libs_ylu(Lm_list *, const char *, const char *, int);
const char *);
extern void Dbg_map_ent_ord_title(Lm_list *, const char *);
extern void Dbg_map_parse(Lm_list *, const char *, int);
const char *);
extern void Dbg_map_post_title(Lm_list *);
Lineno);
extern void Dbg_map_version(Lm_list *, const char *, const char *, int);
extern void Dbg_move_data(Rt_map *);
extern void Dbg_move_input(Lm_list *, const char *);
extern void Dbg_move_outmove(Lm_list *, const char *);
extern void Dbg_move_parexpn(Lm_list *, const char *, const char *);
extern void Dbg_reloc_doact_title(Lm_list *);
const char *, const char *, const char *);
const char *);
Word, const char *);
const char *);
extern void Dbg_sec_backing(Lm_list *);
extern void Dbg_sec_genstr_compress(Lm_list *, const char *,
extern void Dbg_sec_order_list(Ofl_desc *, int);
Boolean);
extern void Dbg_seg_title(Lm_list *);
extern void Dbg_statistics_ar(Ofl_desc *);
extern void Dbg_statistics_ld(Ofl_desc *);
extern void Dbg_support_action(Lm_list *, const char *, const char *,
Support_ndx, const char *);
extern void Dbg_support_load(Lm_list *, const char *, const char *);
extern void Dbg_support_req(Lm_list *, const char *, int);
extern void Dbg_support_vnone(Lm_list *, const char *);
const char *, Dyn *);
extern void Dbg_syminfo_title(Lm_list *);
extern void Dbg_syms_ar_checking(Lm_list *, const char *, const char *,
Elf_Arsym *);
extern void Dbg_syms_ar_force(Lm_list *, const char *, const char *);
extern void Dbg_syms_ar_resolve(Lm_list *, const char *, const char *,
Elf_Arsym *);
Sym_desc *);
extern void Dbg_syms_cap_title(Ofl_desc *);
extern void Dbg_syms_created(Lm_list *, const char *);
extern void Dbg_syms_dup_sort_addr(Lm_list *, const char *, const char *,
const char *, Addr);
extern void Dbg_syms_lazy_rescan(Lm_list *, const char *);
extern void Dbg_syms_lookup(Rt_map *, const char *, const char *);
#if !(defined(_ELF64))
extern void Dbg_syms_lookup_aout(Lm_list *, const char *);
#endif
const char *);
extern void Dbg_syms_sec_title(Lm_list *);
extern void Dbg_syms_spec_title(Lm_list *);
extern void Dbg_syms_up_title(Lm_list *);
extern void Dbg_util_call_fini(Rt_map *);
extern void Dbg_util_call_init(Rt_map *, int);
extern void Dbg_util_call_main(Rt_map *);
extern void Dbg_util_collect(Rt_map *, int, int);
int, int);
extern void Dbg_util_intoolate(Rt_map *);
extern void Dbg_util_lcinterface(Rt_map *, int, char *);
extern void Dbg_util_nl(Lm_list *, int);
extern void Dbg_util_scc_title(Lm_list *, int);
extern void Dbg_util_str(Lm_list *, const char *);
const char *);
extern void Dbg_unused_unref(Rt_map *, const char *);
extern void Dbg_ver_avail_title(Lm_list *, const char *);
extern void Dbg_ver_def_title(Lm_list *, const char *);
extern void Dbg_ver_need_done(Lm_list *);
const char *);
extern void Dbg_ver_need_title(Lm_list *, const char *);
extern void Dbg_ver_nointerface(Lm_list *, const char *);
extern void Dbg_ver_symbol(Lm_list *, const char *);
/*
* Define Elf_*() interface flags.
*/
/*
* Define generic Elf_*() interfaces.
*/
const char *);
extern void Elf_syminfo_title(Lm_list *);
/*
* Establish ELF32 and ELF64 class Elf_*() interfaces.
*/
#if defined(_ELF64)
#else
#endif
Half);
extern void Elf_cap_title(Lm_list *);
extern const char \
*Elf_demangle_name(const char *);
extern void Elf_dyn_title(Lm_list *);
extern void Elf_got_title(Lm_list *);
void *, const char *, const char *, const char *);
const char *);
extern void Elf_syms_table_title(Lm_list *, int);
extern void Elf_ver_def_title(Lm_list *);
extern void Elf_ver_line_1(Lm_list *, const char *, const char *,
const char *, const char *);
extern void Elf_ver_line_2(Lm_list *, const char *, const char *);
extern void Elf_ver_line_3(Lm_list *, const char *, const char *,
const char *);
extern void Elf_ver_line_4(Lm_list *, const char *);
extern void Elf_ver_line_5(Lm_list *, const char *, const char *);
extern void Elf_ver_need_title(Lm_list *, int);
#ifdef __cplusplus
}
#endif
#endif /* _DEBUG_H */