xref: /titanic_52/usr/src/cmd/sgs/liblddbg/common/support.c (revision 0f1702c5201310f0529cd5abb77652e5e9b241b6)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include	"msg.h"
28 #include	"_debug.h"
29 
30 void
31 Dbg_support_req(Lm_list *lml, const char *define, int flag)
32 {
33 	const char	*str;
34 
35 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
36 		return;
37 
38 	switch (flag) {
39 	case DBG_SUP_ENVIRON:
40 		str = MSG_INTL(MSG_SUP_REQ_ENV);
41 		break;
42 	case DBG_SUP_CMDLINE:
43 		str = MSG_INTL(MSG_SUP_REQ_CMD);
44 		break;
45 	default:
46 		str = MSG_ORIG(MSG_STR_EMPTY);
47 		break;
48 	}
49 
50 	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
51 	dbg_print(lml, MSG_INTL(MSG_SUP_REQ), define, str);
52 }
53 
54 void
55 Dbg_support_load(Lm_list *lml, const char *obj, const char *func)
56 {
57 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
58 		return;
59 
60 	dbg_print(lml, MSG_INTL(MSG_SUP_ROUTINE), obj, func);
61 }
62 
63 void
64 Dbg_support_vnone(Lm_list *lml, const char *obj)
65 {
66 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
67 		return;
68 
69 	dbg_print(lml, MSG_INTL(MSG_SUP_VNONE), obj);
70 }
71 
72 void
73 Dbg_support_action(Lm_list *lml, const char *obj, const char *func,
74     Support_ndx ndx, const char *name)
75 {
76 	const char	*str;
77 
78 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
79 		return;
80 	if (DBG_NOTDETAIL())
81 		return;
82 
83 	if (ndx == LDS_START)
84 		str = MSG_INTL(MSG_SUP_OUTFILE);
85 	else if ((ndx == LDS_OPEN) || (ndx == LDS_FILE))
86 		str = MSG_INTL(MSG_SUP_INFILE);
87 	else if (ndx == LDS_INSEC)
88 		str = MSG_INTL(MSG_SUP_INSEC);
89 	else if (ndx == LDS_SEC)
90 		str = MSG_INTL(MSG_SUP_SEC);
91 
92 	if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) ||
93 	    (ndx == LDS_INPUT_DONE))
94 		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_1), func, obj);
95 	else
96 		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_2), func, obj,
97 		    str, name);
98 }
99