/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* MDB developer support module. This module is loaded automatically when the
* proc target is initialized and the target is mdb itself. In the future, we
* should document these facilities in the answerbook to aid module developers.
*/
#define _MDB
#include <mdb/mdb_modapi.h>
#include <mdb/mdb_frame.h>
#include <mdb/mdb_io_impl.h>
#include <mdb/mdb_target_impl.h>
#include <kmdb/kmdb_wr_impl.h>
static const mdb_t *
get_mdb(void)
{
static mdb_t m;
mdb_warn("failed to read mdb_t state");
return (&m);
}
static int
{
const char sep[] =
"-----------------------------------------------------------------";
if (flags & DCMD_ADDRSPEC) {
mdb_frame_t f;
mdb_cmd_t c;
size_t i;
return (DCMD_ERR);
}
case MDB_TYPE_STRING:
else
mdb_printf(" <str=%a>",
break;
case MDB_TYPE_IMMEDIATE:
mdb_printf(" $[ 0x%llx ]",
break;
case MDB_TYPE_CHAR:
break;
default:
}
}
}
mdb_printf(")\n\tf_list = %-?p\tf_cmds = %p\n",
mdb_printf("\tf_istk = %-?p\tf_ostk = %p\n",
mdb_printf("\tf_wcbs = %-?p\tf_mblks = %p\n",
mdb_printf("\tf_pcmd = %-?p\tf_pcb = %p\n",
mdb_printf("\tf_cp = %-?p\t\tf_flags = 0x%x\n\n",
#if defined(__sparc)
#else
#endif
if (pc != 0)
mdb_inc_indent(8);
mdb_eval("<.$C0");
mdb_dec_indent(8);
} else {
}
return (DCMD_OK);
}
static int
{
return (DCMD_USAGE);
}
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%?s %6s %6s %?s %s\n",
"IOB", "NBYTES", "FLAGS", "IOP", "OPS");
}
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
mdb_tgt_t t;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_ERR);
}
mdb_printf("\tt_active = %-?p\tt_idle = %p\n",
mdb_printf("\tt_xdlist = %-?p\tt_module = %a\n",
mdb_printf("\tt_pshandle = %-?p\tt_data = %p\n",
t.t_pshandle, t.t_data);
mdb_printf("\tt_status = %-?p\tt_matched = %p\n",
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
mdb_printf("\tse_selist = %-?p\tse_velist = %p\n",
mdb_printf("\tse_data = %-?p\tse_refs = %u\n",
mdb_printf("\tse_state = %-?d\tse_errno = %d\n\n",
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
mdb_printf("\tve_list = %-?p\tve_flags = 0x%x\n",
mdb_printf("\tve_data = %-?p\tve_callback = %a\n",
mdb_printf("\tve_args = %-?p\tve_dtor = %a\n\n",
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
char dir;
return (DCMD_USAGE);
return (DCMD_ERR);
}
if (DCMD_HDRSPEC(flags)) {
mdb_printf("%-9s %3s %?s %s\n",
"COMMAND", "ERR", "MODCTL", "NAME");
}
case WNTASK_DMOD_LOAD: {
return (DCMD_ERR);
}
mdb_warn("failed to read path name at %p",
*path = '\0';
}
break;
}
case WNTASK_DMOD_LOAD_ALL:
break;
case WNTASK_DMOD_UNLOAD: {
return (DCMD_ERR);
}
mdb_warn("failed to read module name at %p",
*path = '\0';
}
break;
}
case WNTASK_DMOD_PATH_CHANGE: {
return (DCMD_ERR);
}
for (;;) {
mdb_warn("failed to read path pointer at %p",
break;
}
break;
*path = '\0';
}
path);
first = 0;
}
mdb_printf("\n");
break;
}
default:
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
return (WALK_ERR);
}
return (WALK_NEXT);
}
static int
{
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
return (WALK_NEXT);
}
static int
{
mdb_frame_t f;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
return (WALK_NEXT);
}
static int
{
mdb_tgt_t t;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
mdb_sespec_t s;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
mdb_vespec_t v;
return (WALK_DONE);
return (WALK_ERR);
}
}
static int
{
mdb_sespec_t s;
return (WALK_DONE);
return (WALK_ERR);
}
}
{ NULL }
};
{ "mdb_frame", "iterate over mdb_frame stack",
{ "mdb_iob_stack", "iterate over mdb_iob_stack elements",
{ "mdb_tgt", "iterate over active targets",
{ "mdb_sespec", "iterate over software event specifiers",
{ "mdb_vespec", "iterate over virtual event specifiers",
{ "se_matched", "iterate over matched software event specifiers",
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
int rcount;
mdb_warn("failed to read mdb state structure");
return (NULL);
}
mdb_printf("mdb: WARNING: mdb_ds may not match mdb "
"implementation (mdb_t mismatch)\n");
}
return (&modinfo);
}