debug.c revision cce0e03bb2d07f0fe27cabb93acae9c23655859f
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libintl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <alist.h>
#include <debug.h>
#include <_debug.h>
#include <msg.h>
/*
* Define a debug descriptor. Note, although this provides the default
* definition to which most users bind, ld.so.1 must provide its own definition,
* and thus interposition is expected. This item should be defined NODIRECT.
*/
int _Dbg_cnt = 0;
/*
* Debugging initialization and processing. The dbg_options[] array defines
* a set of option strings that can be specified using the -D flag or from an
* environment variable. For each option, a class is enabled in the d_class
* bit mask, or an extra flag is enabled in the d_extra bit mask.
*/
DBG_options _Dbg_options[] = {
#ifdef DEMANGLE
#endif
};
/*
* Tokens may also define identifiers for diagnostics. Presently, only ld.so.1
* uses these strings to identify, or isolate its output to selected link-map
* lists. See ld.so.1:dbg_print().
*/
const char *_Dbg_strs[] = {
};
/*
* Provide a debugging usage message
*/
void
{
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
Dbg_util_nl(0, DBG_NL_FRC);
#ifdef DEMANGLE
#endif
Dbg_util_nl(0, DBG_NL_FRC);
}
/*
* Messaging support - funnel everything through dgettext() as this provides
* the real binding to libc.
*/
const char *
{
}
/*
* Validate and enable the appropriate debugging classes.
*/
{
/* strtok_r() operations. */
char *lasts;
return (S_ERROR);
/*
* The token should be of the form "-Dtok,tok,tok,...". Separate the
* pieces and build up the appropriate mask, unrecognized options are
* flagged.
*/
do {
const char *str;
int ndx = 0;
if (name[0] == '!') {
name++;
} else
/*
* First, determine if the token represents a class or
* extra.
*/
continue;
} else {
}
break;
}
continue;
/*
* Second, determine if the token represents a known
* diagnostic identifier. Note, newlm identifiers are
* typically followed by a numeric id, for example
* newlm1, newlm2 ... Thus we only compare the
* initial text of the string.
*/
char *tup;
continue;
/*
* Translate lmid identifier to uppercase.
*/
}
/*
* Save this lmid. The whole token buffer has
* been reallocated, so these names will remain
* once this routine returns.
*/
AL_CNT_DEBUG) == 0)
return (S_ERROR);
break;
}
}
/*
* If the debug help option was specified dump a usage message. If
* this is the only debug class, return an indication that the user
* should exit.
*/
Dbg_usage();
return (0);
}
return (1);
}
/*
* Define our own printing routine. This provides a basic fallback, as ld(1)
* and ld.so.1(1) provide their own routines that augment their diagnostic
* output, and direct the output to stderr. This item should be defined
* NODIRECT.
*/
/* PRINTFLIKE2 */
void
{
#if defined(lint)
/*
* The lml argument is only meaningful for diagnostics sent to ld.so.1.
* Supress the lint error by making a dummy assignment.
*/
lml = 0;
#endif
}