dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / sgs / liblddbg / common / tls.c
blobbd4250ef6c8bbf7ea6bf921a0094d87a53e151de
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <link.h>
28 #include <libc_int.h>
29 #include <rtld.h>
30 #include <strings.h>
31 #include <debug.h>
32 #include "msg.h"
33 #include "_debug.h"
35 #define FLAGSZ CONV_EXPN_FIELD_DEF_PREFIX_SIZE + \
36 MSG_TLS_FLAG_STATIC_SIZE + CONV_EXPN_FIELD_DEF_SEP_SIZE + \
37 CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
39 static void
40 Dbg_tls_modent(Lm_list *lml, TLS_modinfo * tmodent)
43 * MSG_ORIG(MSG_TLS_FLAG_STATIC)
45 static char flagstr[FLAGSZ];
46 static Val_desc vda[] = {
47 { TM_FLG_STATICTLS, MSG_TLS_FLAG_STATIC },
48 { 0, 0 }
50 static CONV_EXPN_FIELD_ARG conv_arg = { flagstr, sizeof (flagstr) };
52 ulong_t flags;
54 if ((flags = tmodent->tm_flags) != 0) {
55 conv_arg.oflags = conv_arg.rflags = flags;
56 (void) conv_expn_field(&conv_arg, vda, 0);
57 } else {
58 flagstr[0] = '\0';
61 dbg_print(lml, MSG_INTL(MSG_TLS_MODENT1),
62 EC_XWORD((uintptr_t)tmodent->tm_tlsblock),
63 EC_XWORD(tmodent->tm_stattlsoffset), EC_XWORD(tmodent->tm_flags),
64 flagstr);
65 dbg_print(lml, MSG_INTL(MSG_TLS_MODENT2),
66 EC_XWORD(tmodent->tm_filesz), EC_XWORD(tmodent->tm_memsz),
67 EC_XWORD(tmodent->tm_modid));
70 void
71 Dbg_tls_static_block(Lm_list *lml, void *list, ulong_t size, ulong_t resv)
73 if (DBG_NOTCLASS(DBG_C_TLS))
74 return;
76 Dbg_util_nl(lml, DBG_NL_STD);
78 if (list) {
79 ulong_t ndx;
80 TLS_modinfo **tlsmodlist;
82 tlsmodlist = (TLS_modinfo **)list;
84 for (ndx = 0; tlsmodlist[ndx]; ndx++) {
85 dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK1), ndx,
86 tlsmodlist[ndx]->tm_modname);
87 Dbg_tls_modent(lml, tlsmodlist[ndx]);
88 Dbg_util_nl(lml, DBG_NL_STD);
91 dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK2), EC_XWORD(size),
92 EC_XWORD(resv));
95 void
96 Dbg_tls_static_resv(Rt_map *lmp, ulong_t size, ulong_t resv)
98 Lm_list *lml = LIST(lmp);
100 if (DBG_NOTCLASS(DBG_C_TLS))
101 return;
103 Dbg_util_nl(lml, DBG_NL_STD);
104 dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK3), TLSMODID(lmp), NAME(lmp),
105 EC_XWORD(size), EC_XWORD(resv));
108 void
109 Dbg_tls_modactivity(Lm_list *lml, void *vtlsmodent, uint_t flag)
111 const char *str;
112 TLS_modinfo *tlsmodent;
114 if (DBG_NOTCLASS(DBG_C_TLS))
115 return;
117 if (flag == TM_FLG_MODADD)
118 str = MSG_INTL(MSG_TLS_ADD);
119 else
120 str = MSG_INTL(MSG_TLS_REMOVE);
122 tlsmodent = (TLS_modinfo *)vtlsmodent;
123 Dbg_util_nl(lml, DBG_NL_STD);
124 dbg_print(lml, MSG_INTL(MSG_TLS_MODACT), str, tlsmodent->tm_modname);
125 Dbg_tls_modent(lml, tlsmodent);