xref: /titanic_41/usr/src/cmd/sgs/liblddbg/common/support.c (revision fcf3ce441efd61da9bb2884968af01cb7c1452cc)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27 
28 #include	"msg.h"
29 #include	"_debug.h"
30 
31 void
32 Dbg_support_req(Lm_list *lml, const char *define, int flag)
33 {
34 	const char	*str;
35 
36 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
37 		return;
38 
39 	if (flag == DBG_SUP_ENVIRON)
40 		str = MSG_INTL(MSG_SUP_REQ_ENV);
41 	else if (flag == DBG_SUP_CMDLINE)
42 		str = MSG_INTL(MSG_SUP_REQ_CMD);
43 	else
44 		str = MSG_INTL(MSG_SUP_REQ_DEF);
45 
46 	dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY));
47 	dbg_print(lml, MSG_INTL(MSG_SUP_REQ), define, str);
48 }
49 
50 void
51 Dbg_support_load(Lm_list *lml, const char *obj, const char *func)
52 {
53 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
54 		return;
55 
56 	dbg_print(lml, MSG_INTL(MSG_SUP_ROUTINE), obj, func);
57 }
58 
59 void
60 Dbg_support_action(Lm_list *lml, const char *obj, const char *func,
61     Support_ndx ndx, const char *name)
62 {
63 	const char	*str;
64 
65 	if (DBG_NOTCLASS(DBG_C_SUPPORT))
66 		return;
67 	if (DBG_NOTDETAIL())
68 		return;
69 
70 	if (ndx == LDS_START)
71 		str = MSG_INTL(MSG_SUP_OUTFILE);
72 	else if ((ndx == LDS_OPEN) || (ndx == LDS_FILE))
73 		str = MSG_INTL(MSG_SUP_INFILE);
74 	else if (ndx == LDS_INSEC)
75 		str = MSG_INTL(MSG_SUP_INSEC);
76 	else if (ndx == LDS_SEC)
77 		str = MSG_INTL(MSG_SUP_SEC);
78 
79 	if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) ||
80 	    (ndx == LDS_INPUT_DONE))
81 		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_1), func, obj);
82 	else
83 		dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_2), func, obj,
84 		    str, name);
85 }
86