/* * 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 * or http://www.opensolaris.org/os/licensing. * 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 */ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* LINTLIBRARY */ /* PROTOLIB1 */ #include #include #include <_machelf.h> #include #include #include /* * Generic miscellaneous interfaces */ uchar_t conv_check_native(char **, char **); const char *conv_lddstub(int); int conv_sys_eclass(void); /* * Generic core formatting and iteration functionality */ conv_iter_ret_t _conv_iter_ds(conv_iter_osabi_t, Half, const conv_ds_t **, conv_iter_cb_t, void *, const char *); conv_iter_ret_t _conv_iter_ds_msg(const conv_ds_msg_t *, conv_iter_cb_t, void *, const char *); conv_iter_ret_t _conv_iter_msgarr(Conv_elfvalue_t, const Msg *, size_t, conv_iter_cb_t, void *, const char *); conv_iter_ret_t _conv_iter_vd(const Val_desc *, conv_iter_cb_t, void *, const char *); conv_iter_ret_t _conv_iter_vd2(conv_iter_osabi_t, Half, const Val_desc2 *, conv_iter_cb_t, void *, const char *); int conv_iter_strtol_init(const char *, conv_strtol_uvalue_t *); conv_iter_ret_t conv_iter_strtol(const char *, Conv_elfvalue_t, void *); const char *_conv_map2str(Conv_inv_buf_t *, Conv_elfvalue_t, Conv_fmt_flags_t, size_t, const Msg *, const char *); const char *_conv_map_ds(uchar_t, Half, Conv_elfvalue_t, const conv_ds_t **, Conv_fmt_flags_t, Conv_inv_buf_t *, const char *); const char *_conv_map_vd2str(Conv_inv_buf_t *, Conv_elfvalue_t, Conv_fmt_flags_t, const Val_desc *, const char *); const char *_conv_map_vd22str(Conv_inv_buf_t *, uchar_t, Half, Conv_elfvalue_t, Conv_fmt_flags_t, const Val_desc2 *, const char *); /* * Generic formatting interfaces. */ const char *conv_bnd_obj(uint_t, Conv_bnd_obj_buf_t *); const char *conv_bnd_type(uint_t, Conv_bnd_type_buf_t *); const char *conv_config_feat(int, Conv_config_feat_buf_t *); const char *conv_config_obj(ushort_t, Conv_config_obj_buf_t *); const char *conv_config_upm(const char *, const char *, const char *, size_t); const char *conv_cnote_auxv_af(Word, Conv_fmt_flags_t, Conv_cnote_auxv_af_buf_t *); const char *conv_cnote_auxv_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_cc_content(Lword, Conv_fmt_flags_t, Conv_cnote_cc_content_buf_t *); const char *conv_cnote_errno(int, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_fault(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_fltset(uint32_t *, int, Conv_fmt_flags_t, Conv_cnote_fltset_buf_t *); const char *conv_cnote_old_pr_flags(int, Conv_fmt_flags_t, Conv_cnote_old_pr_flags_buf_t *); const char *conv_cnote_pr_dmodel(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_pr_flags(int, Conv_fmt_flags_t, Conv_cnote_pr_flags_buf_t *); const char *conv_cnote_proc_flag(int, Conv_fmt_flags_t, Conv_cnote_proc_flag_buf_t *); const char *conv_cnote_pr_regname(Half, int, Conv_fmt_flags_t, Conv_inv_buf_t *inv_buf); const char *conv_cnote_pr_stype(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_pr_what(short, short, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_pr_why(short, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_priv(int, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_psetid(int, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_sa_flags(int, Conv_fmt_flags_t, Conv_cnote_sa_flags_buf_t *); const char *conv_cnote_signal(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_si_code(Half, int, int, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_sigset(uint32_t *, int, Conv_fmt_flags_t, Conv_cnote_sigset_buf_t *); const char *conv_cnote_ss_flags(int, Conv_fmt_flags_t, Conv_cnote_ss_flags_buf_t *); const char *conv_cnote_syscall(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_cnote_sysset(uint32_t *, int, Conv_fmt_flags_t, Conv_cnote_sysset_buf_t *); const char *conv_cnote_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_def_tag(Symref, Conv_inv_buf_t *); const char *conv_demangle_name(const char *); const char *conv_dl_flag(int, Conv_fmt_flags_t, Conv_dl_flag_buf_t *); const char *conv_dl_mode(int, int, Conv_dl_mode_buf_t *); const char *conv_dwarf_cfa(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_dwarf_ehe(uint_t, Conv_dwarf_ehe_buf_t *); const char *conv_dwarf_regname(Half, Word, Conv_fmt_flags_t, int *, Conv_inv_buf_t *); const char *conv_ehdr_abivers(uchar_t, Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_class(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_data(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_flags(Half, Word, Conv_fmt_flags_t, Conv_ehdr_flags_buf_t *); const char *conv_ehdr_mach(Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_osabi(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_type(uchar_t, Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_ehdr_vers(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_elfdata_type(Elf_Type, Conv_inv_buf_t *); const char *conv_grphdl_flags(uint_t, Conv_grphdl_flags_buf_t *); const char *conv_grpdesc_flags(uint_t, Conv_grpdesc_flags_buf_t *); Isa_desc *conv_isalist(void); const char *conv_phdr_flags(uchar_t, Word, Conv_fmt_flags_t, Conv_phdr_flags_buf_t *); const char *conv_phdr_type(uchar_t, Half, Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_reject_desc(Rej_desc *, Conv_reject_desc_buf_t *, Half mach); const char *conv_reloc_type(Half, Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_reloc_type_static(Half, Word, Conv_fmt_flags_t); const char *conv_reloc_386_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_reloc_amd64_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_reloc_SPARC_type(Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_sec_type(uchar_t, Half, Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_seg_flags(Half, Conv_seg_flags_buf_t *); void conv_str_to_c_literal(const char *buf, size_t n, Conv_str_to_c_literal_func_t *cb_func, void *uvalue); const char *conv_sym_info_bind(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_sym_info_type(Half, uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_sym_shndx(uchar_t, Half, Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_sym_other(uchar_t, Conv_inv_buf_t *); const char *conv_sym_other_vis(uchar_t, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_syminfo_boundto(Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv_syminfo_flags(Half, Conv_fmt_flags_t, Conv_syminfo_flags_buf_t *); Uts_desc *conv_uts(void); const char *conv_ver_flags(Half, Conv_fmt_flags_t, Conv_ver_flags_buf_t *); const char *conv_ver_index(Versym, int, Conv_inv_buf_t *); /* * Generic iteration interfaces. */ conv_iter_ret_t conv_iter_cap_tags(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_cap_val_hw1(Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_cap_val_sf1(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_dyn_feature1(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_dyn_flag(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_dyn_flag1(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_dyn_posflag1(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_dyn_tag(conv_iter_osabi_t, Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_abivers(conv_iter_osabi_t, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_class(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_data(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_eident(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_flags(Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_mach(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_osabi(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_type(conv_iter_osabi_t, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_ehdr_vers(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_phdr_flags(conv_iter_osabi_t, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_phdr_type(conv_iter_osabi_t, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sec_flags(conv_iter_osabi_t, Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sec_symtab(conv_iter_osabi_t, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sec_type(conv_iter_osabi_t, Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sym_info_bind(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sym_other_vis(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sym_shndx(conv_iter_osabi_t, Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_sym_info_type(Half, Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_syminfo_boundto(Conv_fmt_flags_t, conv_iter_cb_t, void *); conv_iter_ret_t conv_iter_syminfo_flags(Conv_fmt_flags_t, conv_iter_cb_t, void *); /* * ELFCLASS-specific core formatting functionality */ int _conv_expn_field(CONV_EXPN_FIELD_ARG *, const Val_desc *, Conv_fmt_flags_t, const char *); int _conv_expn_field2(CONV_EXPN_FIELD_ARG *, uchar_t, Half, const Val_desc2 *, Conv_fmt_flags_t, const char *); const char *conv_invalid_val(Conv_inv_buf_t *, Xword, Conv_fmt_flags_t); /* * Define all class specific routines. */ const char *conv32_cap_tag(Elf32_Word, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv64_cap_tag(Elf64_Xword, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv32_cap_val(Elf32_Word, Elf32_Word, Half, Conv_cap_val_buf_t *); const char *conv64_cap_val(Elf64_Xword, Elf64_Xword, Half, Conv_cap_val_buf_t *); const char *conv32_cap_val_hw1(Elf32_Word, Half, Conv_fmt_flags_t, Conv_cap_val_hw1_buf_t *); const char *conv64_cap_val_hw1(Elf64_Xword, Half, Conv_fmt_flags_t, Conv_cap_val_hw1_buf_t *); const char *conv32_cap_val_sf1(Elf32_Word, Half, Conv_fmt_flags_t, Conv_cap_val_sf1_buf_t *); const char *conv64_cap_val_sf1(Elf64_Xword, Half, Conv_fmt_flags_t, Conv_cap_val_sf1_buf_t *); const char *conv32_dyn_flag1(Elf32_Word, Conv_fmt_flags_t, Conv_dyn_flag1_buf_t *); const char *conv64_dyn_flag1(Elf64_Xword, Conv_fmt_flags_t, Conv_dyn_flag1_buf_t *); const char *conv32_dyn_flag(Elf32_Word, int, Conv_dyn_flag_buf_t *); const char *conv64_dyn_flag(Elf64_Xword, int, Conv_dyn_flag_buf_t *); const char *conv32_dyn_posflag1(Elf32_Word, int, Conv_dyn_posflag1_buf_t *); const char *conv64_dyn_posflag1(Elf64_Xword, int, Conv_dyn_posflag1_buf_t *); const char *conv32_dyn_tag(Elf32_Word, uchar_t, Elf32_Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv64_dyn_tag(Elf64_Xword, uchar_t, Elf64_Half, Conv_fmt_flags_t, Conv_inv_buf_t *); const char *conv32_dyn_feature1(Elf32_Word, int, Conv_dyn_feature1_buf_t *); const char *conv64_dyn_feature1(Elf64_Xword, int, Conv_dyn_feature1_buf_t *); const char *conv32_sec_flags(uchar_t, Half, Elf32_Word, Conv_fmt_flags_t, Conv_sec_flags_buf_t *); const char *conv64_sec_flags(uchar_t, Half, Elf64_Xword, Conv_fmt_flags_t, Conv_sec_flags_buf_t *); const char *conv32_sec_linkinfo(Elf32_Word, Elf32_Word, Conv_inv_buf_t *); const char *conv64_sec_linkinfo(Elf64_Word, Elf64_Xword, Conv_inv_buf_t *); const char *conv32_sym_value(Elf32_Half, uchar_t, Elf32_Addr, Conv_inv_buf_t *); const char *conv64_sym_value(Elf64_Half, uchar_t, Elf64_Addr, Conv_inv_buf_t *); const char *conv32_sym_SPARC_value(Elf32_Addr, int, Conv_inv_buf_t *); const char *conv64_sym_SPARC_value(Elf64_Addr, int, Conv_inv_buf_t *);