xref: /titanic_44/usr/src/cmd/sgs/liblddbg/common/support.c (revision 749f21d359d8fbd020c974a1a5227316221bfc9c)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	Copyright (c) 1998-2001 by Sun Microsystems, Inc.
24  *	All rights reserved.
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(const char *define, int flag)
33 {
34 	const char	*str;
35 
36 	if (DBG_NOTCLASS(DBG_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(MSG_ORIG(MSG_STR_EMPTY));
47 	dbg_print(MSG_INTL(MSG_SUP_REQ), define, str);
48 }
49 
50 void
51 Dbg_support_load(const char *obj, const char *func)
52 {
53 	if (DBG_NOTCLASS(DBG_SUPPORT))
54 		return;
55 
56 	dbg_print(MSG_INTL(MSG_SUP_ROUTINE), obj, func);
57 }
58 
59 void
60 Dbg_support_action(const char *obj, const char *func, Support_ndx ndx,
61     const char *name)
62 {
63 	const char	*str;
64 
65 	if (DBG_NOTCLASS(DBG_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_FILE)
73 		str = MSG_INTL(MSG_SUP_INFILE);
74 	else if (ndx == LDS_INP_SECTION)
75 		str = MSG_INTL(MSG_SUP_INSEC);
76 	else if (ndx == LDS_SECTION)
77 		str = MSG_INTL(MSG_SUP_SEC);
78 
79 	if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) ||
80 	    (ndx == LDS_INPUT_DONE))
81 		dbg_print(MSG_INTL(MSG_SUP_CALLING_1), func, obj);
82 	else
83 		dbg_print(MSG_INTL(MSG_SUP_CALLING_2), func, obj, str, name);
84 }
85