diff options
| author | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2010-02-22 09:19:31 -0700 |
|---|---|---|
| committer | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2010-02-22 09:19:31 -0700 |
| commit | 69112edd987c28fa551d4f8d9362a84a45365f17 (patch) | |
| tree | 26319d6d073c90c67126a3b5f0d86a55c8952ced /usr/src/cmd/sgs/liblddbg | |
| parent | bb664d7ba7a656b21763d44dfc2da581c11444af (diff) | |
| download | illumos-joyent-69112edd987c28fa551d4f8d9362a84a45365f17.tar.gz | |
6916788 ld version 2 mapfile syntax
PSARC/2009/688 Human readable and extensible ld mapfile syntax
Diffstat (limited to 'usr/src/cmd/sgs/liblddbg')
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/cap.c | 67 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/debug.c | 41 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/entry.c | 41 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/liblddbg.msg | 128 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/llib-llddbg | 88 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/map.c | 216 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/mapfile-vers | 46 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/sections.c | 22 | ||||
| -rw-r--r-- | usr/src/cmd/sgs/liblddbg/common/segments.c | 70 |
9 files changed, 495 insertions, 224 deletions
diff --git a/usr/src/cmd/sgs/liblddbg/common/cap.c b/usr/src/cmd/sgs/liblddbg/common/cap.c index 7f9b0f451a..bcc1898b5d 100644 --- a/usr/src/cmd/sgs/liblddbg/common/cap.c +++ b/usr/src/cmd/sgs/liblddbg/common/cap.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -64,36 +64,48 @@ Dbg_cap_val_hw1(Lm_list *lml, Xword val, Half mach) Dbg_util_nl(lml, DBG_NL_FRC); } -static const Msg captype[] = { - MSG_STR_INITIAL, /* MSG_INTL(MSG_STR_INITIAL) */ - MSG_STR_IGNORE, /* MSG_INTL(MSG_STR_IGNORE) */ - MSG_STR_OLD, /* MSG_INTL(MSG_STR_OLD) */ - MSG_STR_NEW, /* MSG_INTL(MSG_STR_NEW) */ - MSG_STR_RESOLVED /* MSG_INTL(MSG_STR_RESOLVED) */ -}; - void -Dbg_cap_mapfile(Lm_list *lml, Xword tag, Xword val, Half mach) +Dbg_cap_entry(Lm_list *lml, dbg_state_t dbg_state, Xword tag, Xword val, + Half mach) { - if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_CAP)) + Conv_inv_buf_t inv_buf; + Conv_cap_val_buf_t cap_val_buf; + + if (DBG_NOTCLASS(DBG_C_CAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_CAP)); - Dbg_cap_sec_entry(lml, DBG_CAP_INITIAL, tag, val, mach); + dbg_print(lml, MSG_INTL(MSG_CAP_ENTRY), Dbg_state_str(dbg_state), + conv_cap_tag(tag, 0, &inv_buf), conv_cap_val(tag, val, mach, + &cap_val_buf)); } +/* + * This version takes a pointer to a CapMask, and will report the exclusion + * bits if they exist. + */ void -Dbg_cap_sec_entry(Lm_list *lml, uint_t type, Xword tag, Xword val, Half mach) +Dbg_cap_entry2(Lm_list *lml, dbg_state_t dbg_state, Xword tag, CapMask *cmp, + Half mach) { Conv_inv_buf_t inv_buf; - Conv_cap_val_buf_t cap_val_buf; + Conv_cap_val_buf_t cap_val_buf1, cap_val_buf2; if (DBG_NOTCLASS(DBG_C_CAP)) return; - dbg_print(lml, MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]), - conv_cap_tag(tag, 0, &inv_buf), conv_cap_val(tag, val, mach, - &cap_val_buf)); + /* If there is no exclusion mask, use the simpler format */ + if (cmp->cm_exclude == 0) { + dbg_print(lml, MSG_INTL(MSG_CAP_ENTRY), + Dbg_state_str(dbg_state), conv_cap_tag(tag, 0, &inv_buf), + conv_cap_val(tag, cmp->cm_value, mach, &cap_val_buf1)); + return; + } + + + dbg_print(lml, MSG_INTL(MSG_CAP_ENTRY_EXC), Dbg_state_str(dbg_state), + conv_cap_tag(tag, 0, &inv_buf), + conv_cap_val(tag, cmp->cm_value, mach, &cap_val_buf1), + conv_cap_val(tag, cmp->cm_exclude, mach, &cap_val_buf2)); } void @@ -107,6 +119,25 @@ Dbg_cap_sec_title(Lm_list *lml, const char *name) } void +Dbg_cap_out_title(Lm_list *lml) +{ + if (DBG_NOTCLASS(DBG_C_CAP)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_CAP_OUT_TITLE)); +} + +void +Dbg_cap_mapfile_title(Lm_list *lml, Lineno lineno) +{ + if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_CAP)) + return; + + dbg_print(lml, MSG_INTL(MSG_MAP_CAP), EC_LINENO(lineno)); +} + +void Elf_cap_title(Lm_list *lml) { dbg_print(lml, MSG_INTL(MSG_CAP_ELF_TITLE)); diff --git a/usr/src/cmd/sgs/liblddbg/common/debug.c b/usr/src/cmd/sgs/liblddbg/common/debug.c index d870cf353d..fcf17a41bb 100644 --- a/usr/src/cmd/sgs/liblddbg/common/debug.c +++ b/usr/src/cmd/sgs/liblddbg/common/debug.c @@ -134,7 +134,7 @@ process_options(const char *name, Boolean set, Dbg_desc *dbp, void Dbg_help(void) { - Dbg_util_nl(0, DBG_NL_FRC); + Dbg_util_nl(0, DBG_NL_STD); dbg_print(0, MSG_INTL(MSG_USE_R1_A)); dbg_print(0, MSG_INTL(MSG_USE_R1_B)); dbg_print(0, MSG_INTL(MSG_USE_R1_C)); @@ -282,6 +282,17 @@ Dbg_help(void) } /* + * Provide a debugging message showing the version of the linker package + */ +void +Dbg_version(void) +{ + Dbg_util_nl(0, DBG_NL_STD); + dbg_print(0, MSG_ORIG(MSG_STR_LDVER), link_ver_string); + Dbg_util_nl(0, DBG_NL_STD); +} + +/* * Messaging support - funnel everything through dgettext() as this provides * the real binding to libc. */ @@ -535,3 +546,31 @@ dbg_print(Lm_list *lml, const char *format, ...) (void) printf(MSG_ORIG(MSG_STR_NL)); va_end(ap); } + +/* + * Return an internationalized state transition string. These are used by + * various debugging output. + */ +const char * +Dbg_state_str(dbg_state_t type) +{ + static const Msg state[DBG_STATE_NUM] = { + MSG_STR_ADD, /* MSG_INTL(MSG_STR_ADD) */ + MSG_STR_CURRENT, /* MSG_INTL(MSG_STR_CURRENT) */ + MSG_STR_EXCLUDE, /* MSG_INTL(MSG_STR_EXCLUDE) */ + MSG_STR_IGNORE, /* MSG_INTL(MSG_STR_IGNORE) */ + MSG_STR_MOD_BEFORE, /* MSG_INTL(MSG_STR_MOD_BEFORE) */ + MSG_STR_MOD_AFTER, /* MSG_INTL(MSG_STR_MOD_AFTER) */ + MSG_STR_NEW, /* MSG_INTL(MSG_STR_NEW) */ + MSG_STR_NEW_IMPLICIT, /* MSG_INTL(MSG_STR_NEW_IMPLICIT) */ + MSG_STR_OUT, /* MSG_INTL(MSG_STR_OUT) */ + MSG_STR_RESET, /* MSG_INTL(MSG_STR_RESET) */ + MSG_STR_RESOLVED, /* MSG_INTL(MSG_STR_RESOLVED) */ + }; +#if DBG_STATE_NUM != (DBG_STATE_RESOLVED + 1) +#error DBG_SEG_NUM has changed. Update segtype[] +#endif + + assert(type < DBG_STATE_NUM); + return (MSG_INTL(state[type])); +} diff --git a/usr/src/cmd/sgs/liblddbg/common/entry.c b/usr/src/cmd/sgs/liblddbg/common/entry.c index 763fe569ee..280d096e7a 100644 --- a/usr/src/cmd/sgs/liblddbg/common/entry.c +++ b/usr/src/cmd/sgs/liblddbg/common/entry.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -34,27 +34,39 @@ void Dbg_ent_entry(Lm_list *lml, uchar_t osabi, Half mach, Ent_desc *enp) { - Conv_inv_buf_t inv_buf; - Conv_sec_flags_buf_t sec_flags_buf; + union { + Conv_inv_buf_t inv; + Conv_sec_flags_buf_t sec_flags; + Conv_ent_flags_buf_t ent_flags; + Conv_ent_files_flags_buf_t ent_files_flags; + } buf; Aliste idx; - char *cp; + Ent_desc_file *edfp; - dbg_print(lml, MSG_ORIG(MSG_ECR_NAME), - (enp->ec_name ? enp->ec_name : MSG_INTL(MSG_STR_NULL)), - conv_sec_flags(osabi, mach, enp->ec_attrmask, 0, &sec_flags_buf)); + if (enp->ec_name != NULL) + dbg_print(lml, MSG_ORIG(MSG_ECR_NAME), enp->ec_name); + + dbg_print(lml, MSG_ORIG(MSG_ECR_FLAGS), + conv_ent_flags(enp->ec_flags, &buf.ent_flags)); + + dbg_print(lml, MSG_ORIG(MSG_ECR_IS_NAME), + (enp->ec_is_name ? enp->ec_is_name : MSG_INTL(MSG_STR_NULL)), + conv_sec_flags(osabi, mach, enp->ec_attrmask, 0, &buf.sec_flags)); dbg_print(lml, MSG_ORIG(MSG_ECR_SEGMENT), (enp->ec_segment->sg_name ? enp->ec_segment->sg_name : MSG_INTL(MSG_STR_NULL)), - conv_sec_flags(osabi, mach, enp->ec_attrbits, 0, &sec_flags_buf)); + conv_sec_flags(osabi, mach, enp->ec_attrbits, 0, &buf.sec_flags)); dbg_print(lml, MSG_ORIG(MSG_ECR_NDX), EC_WORD(enp->ec_ordndx), - conv_sec_type(osabi, mach, enp->ec_type, 0, &inv_buf)); + conv_sec_type(osabi, mach, enp->ec_type, 0, &buf.inv)); if (enp->ec_files) { dbg_print(lml, MSG_ORIG(MSG_ECR_FILES)); - for (APLIST_TRAVERSE(enp->ec_files, idx, cp)) - dbg_print(lml, MSG_ORIG(MSG_ECR_FILE), cp); + for (ALIST_TRAVERSE(enp->ec_files, idx, edfp)) + dbg_print(lml, MSG_ORIG(MSG_ECR_FILE), + conv_ent_files_flags(edfp->edf_flags, 0, + &buf.ent_files_flags), edfp->edf_name); } } @@ -62,7 +74,7 @@ Dbg_ent_entry(Lm_list *lml, uchar_t osabi, Half mach, Ent_desc *enp) * Print out all `entrance descriptor' entries. */ void -Dbg_ent_print(Lm_list *lml, uchar_t osabi, Half mach, Alist *alp, Boolean dmode) +Dbg_ent_print(Lm_list *lml, uchar_t osabi, Half mach, APlist *alp) { Ent_desc *enp; Aliste ndx; @@ -71,10 +83,9 @@ Dbg_ent_print(Lm_list *lml, uchar_t osabi, Half mach, Alist *alp, Boolean dmode) return; Dbg_util_nl(lml, DBG_NL_STD); - dbg_print(lml, MSG_INTL(MSG_ECR_TITLE), - (dmode ? MSG_INTL(MSG_ECR_DYNAMIC) : MSG_INTL(MSG_ECR_STATIC))); + dbg_print(lml, MSG_INTL(MSG_ECR_TITLE)); - for (ALIST_TRAVERSE(alp, ndx, enp)) { + for (APLIST_TRAVERSE(alp, ndx, enp)) { dbg_print(lml, MSG_INTL(MSG_ECR_DESC), EC_WORD(ndx)); Dbg_ent_entry(lml, osabi, mach, enp); } diff --git a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg index 31b15f134b..8cdb1a822b 100644 --- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg +++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg @@ -496,7 +496,7 @@ # args input arguments # entry entrance criteria descriptors # got GOT symbol information -# map map file processing +# map mapfile processing # sections input sections # segments output segments and address/offset processing; # detail flag shows associated sections @@ -518,7 +518,7 @@ @ MSG_USE_R9_C " got GOT symbol information" # TRANSLATION_NOTE -- do not translate the first token "map". -@ MSG_USE_R9_D " map map file processing" +@ MSG_USE_R9_D " map mapfile processing" # TRANSLATION_NOTE -- do not translate the first token "sections". @ MSG_USE_R9_E " sections input sections" @@ -567,20 +567,20 @@ # Bindings messages # NOTE: these are used by appcert(1) and lari(1), use care when changing. -@ MSG_BND_BASIC "binding file=%s to file=%s: symbol `%s'" +@ MSG_BND_BASIC "binding file=%s to file=%s: symbol '%s'" @ MSG_BND_PLT "binding file=%s (%#llx:%#llx) at plt[%lld]:%s to \ - file=%s (%#llx:%#llx): symbol `%s'%s" + file=%s (%#llx:%#llx): symbol '%s'%s" @ MSG_BND_DLSYM "binding file=%s (dlsym) to file=%s \ - (%#llx:%#llx): symbol `%s'%s" + (%#llx:%#llx): symbol '%s'%s" @ MSG_BND_DEFAULT "binding file=%s (%#llx:%#llx) to file=%s \ - (%#llx:%#llx): symbol `%s'%s" -@ MSG_BND_WEAK_1 "binding file=%s to 0x0 (undefined weak): symbol `%s'" + (%#llx:%#llx): symbol '%s'%s" +@ MSG_BND_WEAK_1 "binding file=%s to 0x0 (undefined weak): symbol '%s'" @ MSG_BND_WEAK_2 "binding file=%s (%#llx:%#llx) to 0x0 \ - (undefined weak): symbol `%s'" + (undefined weak): symbol '%s'" # NOTE: the rejected message is used by lari(1), use care when changing. This # message is formatted to conform to the pattern used by the MSG_BINFO messages. -@ MSG_BND_REJECT "binding file=%s to file=%s: symbol `%s' \ +@ MSG_BND_REJECT "binding file=%s to file=%s: symbol '%s' \ (rejected: %s)" @ MSG_BNDREJ_DIRECT "attempt to directly bind to a NODIRECT definition" @ MSG_BNDREJ_GROUP "attempt to bind within a group to a NODIRECT \ @@ -589,8 +589,8 @@ following default search model" @ MSG_BND_PLTPAD_TO " pltpad: %#llx: file=%s bound to file=%s: \ - symbol `%s'" -@ MSG_BND_PLTPAD_FROM " pltpad: %#llx: bound from file=%s: symbol `%s'" + symbol '%s'" +@ MSG_BND_PLTPAD_FROM " pltpad: %#llx: bound from file=%s: symbol '%s'" @ MSG_BND_PSUM_SPARCV9 "Summary of PLT types bound: 21d=%d, 24d=%d, u32=%d, \ u44=%d, full=%d, far=%d, Total=%d" @@ -618,16 +618,14 @@ offset=0x%llx; symbol=%s; transitioned to: %s" @ MSG_REL_DISCARDED "relocation against discarded section=%s from file=%s; \ relocation type=%s offset=0x%llx; relocation discarded" -@ MSG_REL_COPY "copy data from file=%s to file=%s: symbol `%s'%s" +@ MSG_REL_COPY "copy data from file=%s to file=%s: symbol '%s'%s" @ MSG_REL_SLOPPYCOMDAT "the following relocation references a discarded \ section; relocation redirected to section %s in \ file %s" # Entrance criteria messages -@ MSG_ECR_TITLE "%s Entrance Descriptor List (available)" -@ MSG_ECR_DYNAMIC "Dynamic" -@ MSG_ECR_STATIC "Static" +@ MSG_ECR_TITLE "Segment Entrance Criteria Descriptor List" @ MSG_ECR_DESC "entrance descriptor[%u]" @@ -776,31 +774,36 @@ # Mapfile messages -@ MSG_MAP_MAPFILE "map file=%s" - -@ MSG_MAP_SEG_DECL_1 "segment declaration (=), segment added:" -@ MSG_MAP_SEG_DECL_2 "segment declaration (=), segment updated:" -@ MSG_MAP_SEG_DECL_3 "implicit segment declaration (:), segment added:" -@ MSG_MAP_SEG_DECL_4 "implicit segment declaration (@), segment added:" -@ MSG_MAP_SEG_DECL_5 "size-symbol declaration (@), segment updated:" - -@ MSG_MAP_CAP "hardware/software declaration (=), capabilities added:" - -@ MSG_MAP_MAP_DIR "mapping directive (:), entrance criteria added:" - -@ MSG_MAP_SEC_ORDER "map section ordering, segment: %s section: \ - %s index: %d" - -@ MSG_MAP_SYM_SCOPE "symbol scope definition ({})" -@ MSG_MAP_SYM_SIZE "size-symbol declaration (@), symbol=%s; %s" +@ MSG_MAP_MAPFILE "mapfile=%s; version=%d (%s)" +@ MSG_MAP_SEG "segment directive; line=%llu; %s" +@ MSG_MAP_SEG_ORDER "segment order directive; line=%llu; list_cnt=%lld; %s" +@ MSG_MAP_CAP "capability directive; line=%llu" +@ MSG_MAP_EC "entrance criteria; line=%llu; added" +@ MSG_MAP_OS_ORDER "output section ordering; line=%llu; segment=%s \ + section=%s; index=%d" +@ MSG_MAP_HDR_NOALLOC "header noalloc directive; line=%llu; first loadable \ + segment will not contain ELF and program headers" + +@ MSG_MAP_SYM_SCOPE "symbol scope definition" +@ MSG_MAP_SYM_SIZE "size-symbol directive; line=%llu; segment=%s; \ + symbol=%s; %s" @ MSG_MAP_SYM_VER_1 "%s, %s; symbol=%s (%s)" @ MSG_MAP_SYM_VER_2 "%s; symbol=%s (%s)" -@ MSG_MAP_CNT_DEF "library control definition (-), %s; needed" +@ MSG_MAP_DV "depend versions directive; line=%llu, object=%s" +@ MSG_MAP_DV_ENTRY "%12.12s %s; line=%llu" + +@ MSG_MAP_SORT_TITLE "mapfile additions: segment sorting required" +@ MSG_MAP_SORT_TITLE_O "before:" +@ MSG_MAP_SORT_TITLE_S "after:" +@ MSG_MAP_POST_TITLE "mapfile post processing" +@ MSG_MAP_ENT_ORD_TITLE "set entrance criteria input section sort keys \ + (ec_ordndx); segment=%s" -@ MSG_MAP_SORT_TITLE "map file additions: segment sorting required (vaddr):" -@ MSG_MAP_SORT_ORIG " original=%s" -@ MSG_MAP_SORT_FINAL " sorted=%s" +@ MSG_MAP_ID_ADD "%s: %lld: enter conditional expression id: %s" +@ MSG_MAP_ID_CLEAR "%s: %lld: delete conditional expression id: %s" +@ MSG_MAP_PASS "%s: %lld: input enabled by %s" +@ MSG_MAP_NOPASS "%s: %lld: input disabled by %s" # Move messages @@ -841,7 +844,7 @@ # Section messages -@ MSG_SEC_BACKING "map file symbol definitions: create backing storage:" +@ MSG_SEC_BACKING "mapfile symbol definitions: create backing storage:" @ MSG_SEC_INPUT "section=%s; input from file=%s" @ MSG_SEC_INPUT_GEN "section=%s" @@ -903,8 +906,8 @@ # Segment messages -@ MSG_SEG_DESC_INUSE "Segment Descriptor List (in use)" -@ MSG_SEG_DESC_AVAIL "Segment Descriptor List (available)" +@ MSG_SEG_DESC_INUSE "Program Header / Segment Descriptor List (in use)" +@ MSG_SEG_DESC_AVAIL "Program Header / Segment Descriptor List (available)" # Support messages @@ -969,7 +972,7 @@ @ MSG_SYM_LAZY_RESCAN "rescanning for lazy dependencies for symbol: %s" -@ MSG_SYM_DUPSORTADDR "section %s: symbol `%s' and symbol `%s' have the \ +@ MSG_SYM_DUPSORTADDR "section %s: symbol '%s' and symbol '%s' have the \ same address: %#llx" @ MSG_SYM_IGNGNUVER "symbol=%s; hash index=%d; version=%d; skipping \ @@ -1062,16 +1065,24 @@ @ MSG_STR_IGNORE "ignored" @ MSG_STR_ENTERED "entered" -@ MSG_STR_INITIAL "initialized" +@ MSG_STR_EXCLUDE "exclude" +@ MSG_STR_RESET "reset" @ MSG_STR_IN " in" @ MSG_STR_OUT "out" @ MSG_STR_ACT "act" +@ MSG_STR_CURRENT "current" +@ MSG_STR_ADD "add" @ MSG_STR_OLD "old" @ MSG_STR_NEW "new" +@ MSG_STR_NEW_IMPLICIT "new (implicit)" @ MSG_STR_RESOLVED "resolved" -@ MSG_STR_ADD "adding" +@ MSG_STR_ADDING "adding" @ MSG_STR_UP_1 "updating" @ MSG_STR_UP_2 "updated" +@ MSG_STR_ALLOW "allow" +@ MSG_STR_REQUIRE "require" +@ MSG_STR_MOD_BEFORE "modify (before)" +@ MSG_STR_MOD_AFTER "modify (after)" @ MSG_STR_UNKNOWN "<unknown>" @ MSG_STR_ORPHAN "<orphan>" @@ -1115,8 +1126,10 @@ @ MSG_CAP_VAL_HW1 "hardware capabilities - %s" -@ MSG_CAP_SEC_TITLE "hardware/software capabilities; input file=%s" -@ MSG_CAP_SEC_ENTRY "%12.12s %-15.15s %s" +@ MSG_CAP_SEC_TITLE "capabilities; input file=%s" +@ MSG_CAP_OUT_TITLE "output capabilities" +@ MSG_CAP_ENTRY "%12.12s %-15.15s %s" +@ MSG_CAP_ENTRY_EXC "%12.12s %-15.15s %s, exclude %s" @ MSG_CAP_HW_CANDIDATE "obj=%s; hardware capabilities candidate" @@ -1478,11 +1491,18 @@ # Entrance criteria messages -@ MSG_ECR_NAME " ec_name: %-8s ec_attrmask: %s" +@ MSG_ECR_NAME " ec_name: %s" +@ MSG_ECR_FLAGS " ec_flags: %s" +@ MSG_ECR_IS_NAME " ec_is_name: %-8s ec_attrmask: %s" @ MSG_ECR_SEGMENT " ec_segment: %-8s ec_attrbits: %s" -@ MSG_ECR_NDX " ec_ndx: %-8d ec_type: %s" +@ MSG_ECR_NDX " ec_ordndx: %-8d ec_type: %s" @ MSG_ECR_FILES " ec_files:" -@ MSG_ECR_FILE " %s" +@ MSG_ECR_FILE " %-21s %s" + +@ MSG_MAP_SORT_SEG " %s" +@ MSG_MAP_SORT_SEG_NAME " %-20s %s" +@ MSG_MAP_SORT_SEG_V " %-20s %-20s p_vaddr=0x%llx" +@ MSG_MAP_SORT_SEG_O " %-20s %-20s order=%d" # Libs messages @@ -1499,12 +1519,17 @@ # Segment messages -@ MSG_SEG_NAME "segment[%d] sg_name: %s" +@ MSG_SEG_DESC "segment[%d]" +@ MSG_SEG_NAME " sg_name: %s" @ MSG_SEG_LENGTH " sg_length: %#llx" +@ MSG_SEG_ROUND " sg_round: %#llx" +@ MSG_SEG_ALIGN " sg_align: %#llx" @ MSG_SEG_FLAGS " sg_flags: %s" -@ MSG_SEG_SIZESYM " sg_sizesym: %s" -@ MSG_SEG_ORDER " sec_order:" -@ MSG_SEG_SECTION " sec_name: %-8s sec_index: %u" +@ MSG_SEG_SIZESYM_TITLE " sg_sizesym:" +@ MSG_SEG_SIZESYM " %s" +@ MSG_SEG_IS_ORDER_TITLE " sg_is_order:" +@ MSG_SEG_OS_ORDER_TITLE " sg_os_order:" +@ MSG_SEG_LIST_ITEM " %s" # Section messages (used when expanding segment information) @@ -1563,6 +1588,7 @@ @ MSG_CNTL_ENTRY " [0x%llx] %s" @ MSG_STR_NL "\n" +@ MSG_STR_LDVER "Solaris Linkers: %s" @ MSG_FMT_INDEX " [%d]" @ MSG_FMT_ISEC_NAME "[%u]%s" diff --git a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg index e5b44f8664..b515327093 100644 --- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg +++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg @@ -31,6 +31,8 @@ #include <debug.h> int Dbg_setup(dbg_setup_caller_t, const char *, Dbg_desc *, const char **); +void Dbg_help(void); +void Dbg_version(void); const char * Dbg_demangle_name(const char *); @@ -71,16 +73,24 @@ void Dbg64_bind_reject(Rt_map *, Rt_map *, const char *, int); void Dbg32_bind_weak(Rt_map *, Elf32_Addr, Elf32_Addr, const char *); void Dbg64_bind_weak(Rt_map *, Elf64_Addr, Elf64_Addr, const char *); +void Dbg32_cap_entry(Lm_list *, uint_t, Elf32_Word, Elf32_Word, + Elf32_Half); +void Dbg64_cap_entry(Lm_list *, uint_t, Elf64_Xword, Elf64_Xword, + Elf64_Half); +void Dbg32_cap_entry2(Lm_list *, uint_t, Elf32_Word, CapMask *, + Elf32_Half); +void Dbg64_cap_entry2(Lm_list *, uint_t, Elf64_Xword, CapMask *, + Elf64_Half); +void Dbg32_cap_out_title(Lm_list *); +void Dbg64_cap_out_title(Lm_list *); void Dbg32_cap_hw_candidate(Lm_list *, const char *); void Dbg64_cap_hw_candidate(Lm_list *, const char *); void Dbg32_cap_hw_filter(Lm_list *, const char *, Rt_map *); void Dbg64_cap_hw_filter(Lm_list *, const char *, Rt_map *); -void Dbg32_cap_mapfile(Lm_list *, Elf32_Word, Elf32_Word, Elf32_Half); -void Dbg64_cap_mapfile(Lm_list *, Elf64_Xword, Elf64_Xword, Elf64_Half); -void Dbg32_cap_sec_entry(Lm_list *, uint_t, Elf32_Word, Elf32_Word, - Elf32_Half); -void Dbg64_cap_sec_entry(Lm_list *, uint_t, Elf64_Xword, Elf64_Xword, - Elf64_Half); +void Dbg32_cap_mapfile_title(Lm_list *, Lineno); +void Dbg64_cap_mapfile_title(Lm_list *, Lineno); +void Dbg32_cap_out_title(Lm_list *); +void Dbg64_cap_out_title(Lm_list *); void Dbg32_cap_sec_title(Lm_list *, const char *); void Dbg64_cap_sec_title(Lm_list *, const char *); void Dbg32_cap_val_hw1(Lm_list *, Elf32_Word, Elf32_Half); @@ -95,8 +105,8 @@ void Dbg64_cb_iphdr_mapchange(Lm_list *, u_longlong_t, u_longlong_t); void Dbg32_cb_iphdr_unmap_ret(Lm_list *); void Dbg64_cb_iphdr_unmap_ret(Lm_list *); -void Dbg32_ent_print(Lm_list *, uchar_t, Elf32_Half, Alist *, Boolean); -void Dbg64_ent_print(Lm_list *, uchar_t, Elf64_Half, Alist *, Boolean); +void Dbg32_ent_print(Lm_list *, uchar_t, Elf32_Half, APlist *); +void Dbg64_ent_print(Lm_list *, uchar_t, Elf64_Half, APlist *); void Dbg32_file_analyze(Rt_map *); void Dbg64_file_analyze64(Rt_map *); @@ -203,28 +213,40 @@ void Dbg64_libs_yp(Lm_list *, const char *); void Dbg32_libs_ylu(Lm_list *, const char *, const char *, int); void Dbg64_libs_ylu(Lm_list *, const char *, const char *, int); -void Dbg32_map_dash(Lm_list *, const char *); -void Dbg64_map_dash(Lm_list *, const char *); -void Dbg32_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *); -void Dbg64_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *); -void Dbg32_map_parse(Lm_list *, const char *); -void Dbg64_map_parse(Lm_list *, const char *); -void Dbg32_map_pipe(Lm_list *, Sg_desc *, const char *, Elf32_Word); -void Dbg64_map_pipe(Lm_list *, Sg_desc *, const char *, Elf64_Word); -void Dbg32_map_set_atsign(Boolean); -void Dbg64_map_set_atsign(Boolean); -void Dbg32_map_seg(Ofl_desc *, int, Sg_desc *); -void Dbg64_map_seg(Ofl_desc *, int, Sg_desc *); -void Dbg32_map_set_equal(Boolean); -void Dbg64_map_set_equal(Boolean); -void Dbg32_map_size_new(Lm_list *, const char *); -void Dbg64_map_size_new(Lm_list *, const char *); -void Dbg32_map_size_old(Ofl_desc *, Sym_desc *); -void Dbg64_map_size_old(Ofl_desc *, Sym_desc *); -void Dbg32_map_sort(Lm_list *); -void Dbg64_map_sort(Lm_list *); -void Dbg32_map_sort_seg(Lm_list *, Sg_desc *, int); -void Dbg64_map_sort_seg(Lm_list *, Sg_desc *, int); +void Dbg32_map_cexp_id(Lm_list *, Boolean, const char *, ulong_t, + const char *); +void Dbg64_map_cexp_id(Lm_list *, Boolean, const char *, ulong_t, + const char *); +void Dbg32_map_dv(Lm_list *, const char *, Lineno); +void Dbg64_map_dv(Lm_list *, const char *, Lineno); +void Dbg32_map_dv_entry(Lm_list *, Lineno, int, const char *); +void Dbg64_map_dv_entry(Lm_list *, Lineno, int, const char *); +void Dbg32_map_ent(Lm_list *, Ent_desc *, Ofl_desc *, Lineno); +void Dbg64_map_ent(Lm_list *, Ent_desc *, Ofl_desc *, Lineno); +void Dbg32_map_ent_ord_title(Lm_list *, const char *); +void Dbg64_map_ent_ord_title(Lm_list *, const char *); +void Dbg32_map_hdr_noalloc(Lm_list *, Lineno); +void Dbg64_map_hdr_noalloc(Lm_list *, Lineno); +void Dbg32_map_parse(Lm_list *, const char *, int); +void Dbg64_map_parse(Lm_list *, const char *, int); +void Dbg32_map_pass(Lm_list *, Boolean, const char *, ulong_t, const char *); +void Dbg64_map_pass(Lm_list *, Boolean, const char *, ulong_t, const char *); +void Dbg32_map_post_title(Lm_list *); +void Dbg64_map_post_title(Lm_list *); +void Dbg32_map_seg_os_order(Lm_list *, Sg_desc *, const char *, + Elf32_Word, Lineno); +void Dbg64_map_seg_os_order(Lm_list *, Sg_desc *, const char *, + Elf64_Word, Lineno); +void Dbg32_map_seg(Ofl_desc *, uint_t, int, Sg_desc *, Lineno); +void Dbg64_map_seg(Ofl_desc *, uint_t, int, Sg_desc *, Lineno); +void Dbg32_map_size_new(Lm_list *, const char *, const char *, Lineno); +void Dbg64_map_size_new(Lm_list *, const char *, const char *, Lineno); +void Dbg32_map_size_old(Ofl_desc *, Sym_desc *, const char *, Lineno); +void Dbg64_map_size_old(Ofl_desc *, Sym_desc *, const char *, Lineno); +void Dbg32_map_sort_title(Lm_list *, Boolean); +void Dbg64_map_sort_title(Lm_list *, Boolean); +void Dbg32_map_sort_seg(Lm_list *, uchar_t, Elf32_Half, Sg_desc *); +void Dbg64_map_sort_seg(Lm_list *, uchar_t, Elf64_Half, Sg_desc *); void Dbg32_map_symbol(Ofl_desc *, Sym_desc *); void Dbg64_map_symbol(Ofl_desc *, Sym_desc *); void Dbg32_map_version(Lm_list *, const char *, const char *, int); @@ -325,8 +347,10 @@ void Dbg64_sec_redirected(Lm_list *, Is_desc *, const char *); void Dbg32_sec_strtab(Lm_list *, Os_desc *, Str_tbl *); void Dbg64_sec_strtab(Lm_list *, Os_desc *, Str_tbl *); -void Dbg32_seg_desc_entry(Lm_list *, uchar_t, Elf32_Half, int, Sg_desc *); -void Dbg64_seg_desc_entry(Lm_list *, uchar_t, Elf64_Half, int, Sg_desc *); +void Dbg32_seg_desc_entry(Lm_list *, uchar_t, Elf32_Half, int, Sg_desc *, + Boolean); +void Dbg64_seg_desc_entry(Lm_list *, uchar_t, Elf64_Half, int, Sg_desc *, + Boolean); void Dbg32_seg_entry(Ofl_desc *, int, Sg_desc *); void Dbg64_seg_entry(Ofl_desc *, int, Sg_desc *); void Dbg32_seg_list(Lm_list *, uchar_t, Elf32_Half, APlist *); diff --git a/usr/src/cmd/sgs/liblddbg/common/map.c b/usr/src/cmd/sgs/liblddbg/common/map.c index cbff9c6518..7bcc5b8b2d 100644 --- a/usr/src/cmd/sgs/liblddbg/common/map.c +++ b/usr/src/cmd/sgs/liblddbg/common/map.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -28,31 +28,39 @@ #include "_debug.h" #include "libld.h" -static const char - *Dbg_decl = NULL; +/* + * Report change in input enable status caused by evaluating + * $if/$elif control directives. + */ void -Dbg_map_set_atsign(Boolean new) +Dbg_map_pass(Lm_list *lml, Boolean enable, const char *file, + Lineno lineno, const char *directive) { + const char *fmt; + if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (new) - Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_4); - else - Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_5); + fmt = enable ? MSG_INTL(MSG_MAP_PASS) : MSG_INTL(MSG_MAP_NOPASS); + dbg_print(lml, fmt, file, EC_LINENO(lineno), directive); } +/* + * Report entry/removal of boolean identifier from conditional expression + * known values. + */ void -Dbg_map_set_equal(Boolean new) +Dbg_map_cexp_id(Lm_list *lml, Boolean add, const char *file, + Lineno lineno, const char *id) { + const char *fmt; + if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (new) - Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_1); - else - Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_2); + fmt = add ? MSG_INTL(MSG_MAP_ID_ADD) : MSG_INTL(MSG_MAP_ID_CLEAR); + dbg_print(lml, fmt, file, EC_LINENO(lineno), id); } void @@ -78,17 +86,20 @@ Dbg_map_version(Lm_list *lml, const char *version, const char *name, int scope) } void -Dbg_map_size_new(Lm_list *lml, const char *name) +Dbg_map_size_new(Lm_list *lml, const char *symname, const char *segname, + Lineno lineno) { if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), Dbg_demangle_name(name), - MSG_INTL(MSG_STR_ADD)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), EC_LINENO(lineno), segname, + Dbg_demangle_name(symname), MSG_INTL(MSG_STR_ADDING)); } void -Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp) +Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp, const char *segname, + Lineno lineno) { Conv_inv_buf_t inv_buf; Lm_list *lml = ofl->ofl_lml; @@ -96,8 +107,9 @@ Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp) if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), sdp->sd_name, - MSG_INTL(MSG_STR_UP_1)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), EC_LINENO(lineno), segname, + sdp->sd_name, MSG_INTL(MSG_STR_UP_1)); if (DBG_NOTDETAIL()) return; @@ -125,95 +137,195 @@ Dbg_map_symbol(Ofl_desc *ofl, Sym_desc *sdp) conv_def_tag(sdp->sd_ref, &inv_buf)); } +/* + * Object version dependency. In the v1 syntax, this is the 'dash' operator. + * In the v2 syntax, the DEPEND_VERSIONS directive. + */ void -Dbg_map_dash(Lm_list *lml, const char *name) +Dbg_map_dv(Lm_list *lml, const char *obj_name, Lineno lineno) { if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_CNT_DEF), name); + dbg_print(lml, MSG_INTL(MSG_MAP_DV), EC_LINENO(lineno), obj_name); } +/* + * Add a version to an object dependency + */ void -Dbg_map_sort(Lm_list *lml) +Dbg_map_dv_entry(Lm_list *lml, Lineno lineno, int require, const char *version) +{ + const char *attr; + + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + attr = require ? MSG_INTL(MSG_STR_REQUIRE) : MSG_INTL(MSG_STR_ALLOW); + dbg_print(lml, MSG_INTL(MSG_MAP_DV_ENTRY), attr, version, + EC_LINENO(lineno)); +} + +void +Dbg_map_sort_title(Lm_list *lml, Boolean orig) { if (DBG_NOTCLASS(DBG_C_MAP)) return; if (DBG_NOTDETAIL()) return; - Dbg_util_nl(lml, DBG_NL_STD); - dbg_print(lml, MSG_INTL(MSG_MAP_SORT_TITLE)); + if (orig) { + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_SORT_TITLE)); + dbg_print(lml, MSG_INTL(MSG_MAP_SORT_TITLE_O)); + } else { + dbg_print(lml, MSG_INTL(MSG_MAP_SORT_TITLE_S)); + } } void -Dbg_map_sort_seg(Lm_list *lml, Sg_desc *sgp, int orig) +Dbg_map_sort_seg(Lm_list *lml, uchar_t osabi, Half mach, Sg_desc *sgp) { - const char *str; + const char *type_str; + Conv_inv_buf_t inv_buf; if (DBG_NOTCLASS(DBG_C_MAP)) return; if (DBG_NOTDETAIL()) return; - if (sgp->sg_name && *sgp->sg_name) - str = sgp->sg_name; - else - str = MSG_INTL(MSG_STR_NULL); - - if (orig) - dbg_print(lml, MSG_INTL(MSG_MAP_SORT_ORIG), str); - else - dbg_print(lml, MSG_INTL(MSG_MAP_SORT_FINAL), str); + type_str = conv_phdr_type(osabi, mach, sgp->sg_phdr.p_type, + 0, &inv_buf); + + if (sgp->sg_name) { + if (sgp->sg_flags & FLG_SG_P_VADDR) { + dbg_print(lml, MSG_ORIG(MSG_MAP_SORT_SEG_V), + type_str, sgp->sg_name, + EC_ADDR(sgp->sg_phdr.p_vaddr)); + } else if (sgp->sg_flags & FLG_SG_ORDERED) { + /* + * All FLG_SG_ORDERED have adjacent sg_id values + * that start at SGID_TEXT. Subtract out the base + * in order to present the order values based at 0. + */ + dbg_print(lml, MSG_ORIG(MSG_MAP_SORT_SEG_O), + type_str, sgp->sg_name, + EC_WORD(sgp->sg_id - SGID_TEXT)); + } else { + dbg_print(lml, MSG_ORIG(MSG_MAP_SORT_SEG_NAME), + type_str, sgp->sg_name); + } + } else { + dbg_print(lml, MSG_ORIG(MSG_MAP_SORT_SEG), type_str); + } } void -Dbg_map_parse(Lm_list *lml, const char *file) +Dbg_map_parse(Lm_list *lml, const char *file, int version) { + Conv_inv_buf_t inv_buf; + if (DBG_NOTCLASS(DBG_C_MAP)) return; Dbg_util_nl(lml, DBG_NL_STD); - dbg_print(lml, MSG_INTL(MSG_MAP_MAPFILE), file); + dbg_print(lml, MSG_INTL(MSG_MAP_MAPFILE), file, EC_WORD(version), + conv_mapfile_version(version, 0, &inv_buf)); } void -Dbg_map_ent(Lm_list *lml, Boolean new, Ent_desc *enp, Ofl_desc *ofl) +Dbg_map_ent(Lm_list *lml, Ent_desc *enp, Ofl_desc *ofl, Lineno lineno) { if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_MAP_DIR)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_EC), EC_LINENO(lineno)); Dbg_ent_entry(lml, ofl->ofl_dehdr->e_ident[EI_OSABI], ofl->ofl_dehdr->e_machine, enp); - if (new) - Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3); } void -Dbg_map_pipe(Lm_list *lml, Sg_desc *sgp, const char *sec_name, const Word ndx) +Dbg_map_ent_ord_title(Lm_list *lml, const char *segname) { if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(lml, MSG_INTL(MSG_MAP_SEC_ORDER), sgp->sg_name, sec_name, - EC_WORD(ndx)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_ENT_ORD_TITLE), segname); } void -Dbg_map_seg(Ofl_desc *ofl, int ndx, Sg_desc *sgp) +Dbg_map_seg_os_order(Lm_list *lml, Sg_desc *sgp, const char *sec_name, + Word ndx, Lineno lineno) +{ + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + dbg_print(lml, MSG_INTL(MSG_MAP_OS_ORDER), EC_LINENO(lineno), + sgp->sg_name, sec_name, EC_WORD(ndx)); +} + +void +Dbg_map_seg(Ofl_desc *ofl, dbg_state_t dbg_state, int ndx, Sg_desc *sgp, + Lineno lineno) { Lm_list *lml = ofl->ofl_lml; if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (Dbg_decl) { - dbg_print(lml, MSG_ORIG(MSG_FMT_STR), Dbg_decl); - Dbg_seg_desc_entry(ofl->ofl_lml, - ofl->ofl_dehdr->e_ident[EI_OSABI], - ofl->ofl_dehdr->e_machine, ndx, sgp); - Dbg_util_nl(lml, DBG_NL_STD); - Dbg_decl = NULL; + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_SEG), EC_LINENO(lineno), + Dbg_state_str(dbg_state)); + Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_ident[EI_OSABI], + ofl->ofl_dehdr->e_machine, ndx, sgp, FALSE); + Dbg_util_nl(lml, DBG_NL_STD); +} + +void +Dbg_map_seg_order(Ofl_desc *ofl, uchar_t osabi, Half mach, + dbg_state_t dbg_state, Lineno lineno) +{ + Lm_list *lml = ofl->ofl_lml; + Aliste idx; + Sg_desc *sgp; + Conv_inv_buf_t inv_buf; + const char *type_str; + + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_SEG_ORDER), EC_LINENO(lineno), + EC_XWORD(aplist_nitems(ofl->ofl_segs_order)), + Dbg_state_str(dbg_state)); + for (APLIST_TRAVERSE(ofl->ofl_segs_order, idx, sgp)) { + type_str = conv_phdr_type(osabi, mach, sgp->sg_phdr.p_type, + 0, &inv_buf); + dbg_print(lml, MSG_ORIG(MSG_MAP_SORT_SEG_NAME), type_str, + sgp->sg_name); } + Dbg_util_nl(lml, DBG_NL_STD); +} + +void +Dbg_map_post_title(Lm_list *lml) +{ + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_POST_TITLE)); +} + + +void +Dbg_map_hdr_noalloc(Lm_list *lml, Lineno lineno) +{ + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_HDR_NOALLOC), EC_LINENO(lineno)); } diff --git a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers index 3aeb2262ce..aa34aceda0 100644 --- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers +++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers @@ -41,7 +41,7 @@ # MAPFILE HEADER END # -SUNWprivate_4.75 { +SUNWprivate_4.76 { global: dbg_desc = NODIRECT; # interposed - ld.so.1(1) dbg_print = NODIRECT; # interposed - ld(1) and ld.so.1(1) @@ -69,6 +69,8 @@ SUNWprivate_4.75 { Dbg_help; Dbg_setup; + Dbg_state_str; + Dbg_version; Dbg32_bind_global; Dbg64_bind_global; @@ -85,10 +87,14 @@ SUNWprivate_4.75 { Dbg64_cap_hw_candidate; Dbg32_cap_hw_filter; Dbg64_cap_hw_filter; - Dbg32_cap_mapfile; - Dbg64_cap_mapfile; - Dbg32_cap_sec_entry; - Dbg64_cap_sec_entry; + Dbg32_cap_mapfile_title; + Dbg64_cap_mapfile_title; + Dbg32_cap_entry; + Dbg64_cap_entry; + Dbg32_cap_entry2; + Dbg64_cap_entry2; + Dbg32_cap_out_title; + Dbg64_cap_out_title; Dbg32_cap_sec_title; Dbg64_cap_sec_title; Dbg32_cap_val_hw1; @@ -208,28 +214,38 @@ SUNWprivate_4.75 { Dbg32_libs_ylu; Dbg64_libs_ylu; - Dbg32_map_dash; - Dbg64_map_dash; + Dbg32_map_cexp_id; + Dbg64_map_cexp_id; + Dbg32_map_dv; + Dbg64_map_dv; + Dbg32_map_dv_entry; + Dbg64_map_dv_entry; Dbg32_map_ent; Dbg64_map_ent; + Dbg32_map_ent_ord_title; + Dbg64_map_ent_ord_title; + Dbg32_map_hdr_noalloc; + Dbg64_map_hdr_noalloc; Dbg32_map_parse; Dbg64_map_parse; - Dbg32_map_pipe; - Dbg64_map_pipe; - Dbg32_map_set_atsign; - Dbg64_map_set_atsign; + Dbg32_map_pass; + Dbg64_map_pass; + Dbg32_map_post_title; + Dbg64_map_post_title; Dbg32_map_seg; Dbg64_map_seg; - Dbg32_map_set_equal; - Dbg64_map_set_equal; + Dbg32_map_seg_order; + Dbg64_map_seg_order; + Dbg32_map_seg_os_order; + Dbg64_map_seg_os_order; Dbg32_map_size_new; Dbg64_map_size_new; Dbg32_map_size_old; Dbg64_map_size_old; - Dbg32_map_sort; - Dbg64_map_sort; Dbg32_map_sort_seg; Dbg64_map_sort_seg; + Dbg32_map_sort_title; + Dbg64_map_sort_title; Dbg32_map_symbol; Dbg64_map_symbol; Dbg32_map_version; diff --git a/usr/src/cmd/sgs/liblddbg/common/sections.c b/usr/src/cmd/sgs/liblddbg/common/sections.c index 2d802682e0..d883524fbe 100644 --- a/usr/src/cmd/sgs/liblddbg/common/sections.c +++ b/usr/src/cmd/sgs/liblddbg/common/sections.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #include <stdio.h> @@ -231,33 +231,21 @@ Dbg_sec_in(Lm_list *lml, Is_desc *isp) void Dbg_sec_added(Lm_list *lml, Os_desc *osp, Sg_desc *sgp) { - const char *str; - if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; - if (sgp->sg_name && *sgp->sg_name) - str = sgp->sg_name; - else - str = MSG_INTL(MSG_STR_NULL); - - dbg_print(lml, MSG_INTL(MSG_SEC_ADDED), osp->os_name, str); + dbg_print(lml, MSG_INTL(MSG_SEC_ADDED), osp->os_name, + (sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL))); } void Dbg_sec_created(Lm_list *lml, Os_desc *osp, Sg_desc *sgp) { - const char *str; - if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; - if (sgp->sg_name && *sgp->sg_name) - str = sgp->sg_name; - else - str = MSG_INTL(MSG_STR_NULL); - - dbg_print(lml, MSG_INTL(MSG_SEC_CREATED), osp->os_name, str); + dbg_print(lml, MSG_INTL(MSG_SEC_CREATED), osp->os_name, + (sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL))); } void diff --git a/usr/src/cmd/sgs/liblddbg/common/segments.c b/usr/src/cmd/sgs/liblddbg/common/segments.c index 2bbabafed2..32822b3e70 100644 --- a/usr/src/cmd/sgs/liblddbg/common/segments.c +++ b/usr/src/cmd/sgs/liblddbg/common/segments.c @@ -20,10 +20,11 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#include <stdio.h> #include "msg.h" #include "_debug.h" #include "libld.h" @@ -33,39 +34,62 @@ */ void Dbg_seg_desc_entry(Lm_list *lml, uchar_t osabi, Half mach, int ndx, - Sg_desc *sgp) + Sg_desc *sgp, Boolean space_nl) { Conv_seg_flags_buf_t seg_flags_buf; - const char *str; + Aliste idx; + Sym_desc *sdp; - if (sgp->sg_name && *sgp->sg_name) - str = sgp->sg_name; - else - str = MSG_INTL(MSG_STR_NULL); + if (space_nl) + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_ORIG(MSG_SEG_DESC), ndx); + if (sgp->sg_name) + dbg_print(lml, MSG_ORIG(MSG_SEG_NAME), sgp->sg_name); - Dbg_util_nl(lml, DBG_NL_STD); - dbg_print(lml, MSG_ORIG(MSG_SEG_NAME), ndx, str); + dbg_print(lml, MSG_ORIG(MSG_SEG_FLAGS), + conv_seg_flags(sgp->sg_flags, &seg_flags_buf)); Elf_phdr(lml, osabi, mach, &sgp->sg_phdr); - dbg_print(lml, MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length)); - dbg_print(lml, MSG_ORIG(MSG_SEG_FLAGS), - conv_seg_flags(sgp->sg_flags, &seg_flags_buf)); + if (sgp->sg_flags & FLG_SG_P_ALIGN) + dbg_print(lml, MSG_ORIG(MSG_SEG_ALIGN), + EC_ADDR(sgp->sg_align)); + + if (sgp->sg_flags & FLG_SG_LENGTH) + dbg_print(lml, MSG_ORIG(MSG_SEG_LENGTH), + EC_ADDR(sgp->sg_length)); - if (sgp->sg_sizesym && sgp->sg_sizesym->sd_name) - dbg_print(lml, MSG_ORIG(MSG_SEG_SIZESYM), - Dbg_demangle_name(sgp->sg_sizesym->sd_name)); + if (sgp->sg_flags & FLG_SG_ROUND) + dbg_print(lml, MSG_ORIG(MSG_SEG_ROUND), + EC_ADDR(sgp->sg_round)); - if (sgp->sg_secorder) { + if (aplist_nitems(sgp->sg_sizesym) > 0) { + dbg_print(lml, MSG_ORIG(MSG_SEG_SIZESYM_TITLE)); + for (APLIST_TRAVERSE(sgp->sg_sizesym, idx, sdp)) + if (sdp->sd_name) + dbg_print(lml, MSG_ORIG(MSG_SEG_SIZESYM), + Dbg_demangle_name(sdp->sd_name)); + } + if (aplist_nitems(sgp->sg_is_order) > 0) { + Aliste idx; + Ent_desc *enp; + + dbg_print(lml, MSG_ORIG(MSG_SEG_IS_ORDER_TITLE)); + for (APLIST_TRAVERSE(sgp->sg_is_order, idx, enp)) + dbg_print(lml, MSG_ORIG(MSG_SEG_LIST_ITEM), + enp->ec_name); + } + if (alist_nitems(sgp->sg_os_order) > 0) { Aliste idx; Sec_order *scop; - dbg_print(lml, MSG_ORIG(MSG_SEG_ORDER)); - for (APLIST_TRAVERSE(sgp->sg_secorder, idx, scop)) - dbg_print(lml, MSG_ORIG(MSG_SEG_SECTION), - scop->sco_secname, EC_WORD(scop->sco_index)); + dbg_print(lml, MSG_ORIG(MSG_SEG_OS_ORDER_TITLE)); + for (ALIST_TRAVERSE(sgp->sg_os_order, idx, scop)) + dbg_print(lml, MSG_ORIG(MSG_SEG_LIST_ITEM), + scop->sco_secname); } - Dbg_util_nl(lml, DBG_NL_STD); + if (space_nl) + Dbg_util_nl(lml, DBG_NL_STD); } void @@ -85,7 +109,7 @@ Dbg_seg_entry(Ofl_desc *ofl, int ndx, Sg_desc *sgp) return; Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_ident[EI_OSABI], - ofl->ofl_dehdr->e_machine, ndx, sgp); + ofl->ofl_dehdr->e_machine, ndx, sgp, TRUE); } /* @@ -104,7 +128,7 @@ Dbg_seg_list(Lm_list *lml, uchar_t osabi, Half mach, APlist *apl) Dbg_util_nl(lml, DBG_NL_STD); dbg_print(lml, MSG_INTL(MSG_SEG_DESC_AVAIL)); for (APLIST_TRAVERSE(apl, idx, sgp)) - Dbg_seg_desc_entry(lml, osabi, mach, ndx++, sgp); + Dbg_seg_desc_entry(lml, osabi, mach, ndx++, sgp, TRUE); } /* |
