/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <mdb/mdb_modapi.h>
#include <dtrace.h>
extern const char *dof_sec_name(uint32_t);
extern const mdb_walker_t kernel_walkers[];
extern const mdb_dcmd_t kernel_dcmds[];
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
}
static const char *
{
uint_t i;
return (NULL);
return ("<unreadable>");
}
for (i = 0; i < dp->dtdo_varlen; i++) {
break;
}
}
return (NULL);
return ("<unreadable>");
}
return (str);
}
static uint_t
{
switch (name[2]) {
case 'l': return (DIFV_SCOPE_LOCAL);
case 't': return (DIFV_SCOPE_THREAD);
case 'g': return (DIFV_SCOPE_GLOBAL);
default: return (-1u);
}
}
static void
{
const char *vname;
}
static void
{
const char *vname;
}
static void
{
const char *vname;
}
static void
{
else
}
}
static void
{
else
}
}
/*ARGSUSED*/
static void
{
}
/*ARGSUSED*/
static void
{
mdb_printf("%-4s DIF_SUBR(%u), %%r%u\t\t! %s",
}
/*ARGSUSED*/
static void
{
mdb_printf("%-4s DIF_TYPE(%u), %%r%u, %%r%u",
}
/*ARGSUSED*/
static void
{
}
static char *
{
switch (t->dtdt_kind) {
case DIF_TYPE_CTF:
break;
case DIF_TYPE_STRING:
break;
default:
}
if (t->dtdt_flags & DIF_TF_BYREF) {
"%s by ref (size %lu)",
} else {
}
return (buf);
}
static int
{
static const struct opent {
const char *op_name;
void (*op_func)(const dtrace_difo_t *,
const char *, dif_instr_t);
} optab[] = {
{ "(illegal opcode)", dis_str },
};
return (DCMD_ERR);
}
opcode = 0; /* force invalid opcode message */
mdb_printf("\n");
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
ulong_t i;
char *str;
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
return (DCMD_ERR);
}
mdb_printf("%<u>DIF Object 0x%p%</u> (refcnt=%d)\n\n",
if (dp->dtdo_varlen != 0) {
mdb_printf("\n%<b>%-16s %-4s %-3s %-3s %-4s %s%</b>\n",
"NAME", "ID", "KND", "SCP", "FLAG", "TYPE");
}
mdb_warn("couldn't read dtdo_vartab");
return (DCMD_ERR);
}
mdb_warn("couldn't read dtdo_strtab");
return (DCMD_ERR);
}
for (i = 0; i < dp->dtdo_varlen; i++) {
dtrace_difv_t *v = &dvp[i];
switch (v->dtdv_kind) {
case DIFV_KIND_ARRAY:
break;
case DIFV_KIND_SCALAR:
break;
default:
"%u", v->dtdv_kind);
}
switch (v->dtdv_scope) {
case DIFV_SCOPE_GLOBAL:
break;
case DIFV_SCOPE_THREAD:
break;
case DIFV_SCOPE_LOCAL:
break;
default:
"%u", v->dtdv_scope);
}
}
if (v->dtdv_flags & DIFV_F_REF)
if (v->dtdv_flags & DIFV_F_MOD)
mdb_printf("%-16s %-4x %-3s %-3s %-4s %s\n",
}
mdb_printf("\n%<b>RETURN%</b>\n%s\n\n",
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
if (!(flags & DCMD_ADDRSPEC))
return (DCMD_USAGE);
}
/*ARGSUSED*/
int
{
dof_hdr_t h;
if (argc != 0)
return (DCMD_USAGE);
if (!(flags & DCMD_ADDRSPEC))
addr = 0; /* assume base of file in file target */
return (DCMD_ERR);
}
mdb_printf("dofh_ident.id_magic = 0x%x, %c, %c, %c\n",
switch (h.dofh_ident[DOF_ID_MODEL]) {
case DOF_MODEL_ILP32:
mdb_printf("dofh_ident.id_model = ILP32\n");
break;
case DOF_MODEL_LP64:
mdb_printf("dofh_ident.id_model = LP64\n");
break;
default:
mdb_printf("dofh_ident.id_model = 0x%x\n",
h.dofh_ident[DOF_ID_MODEL]);
}
switch (h.dofh_ident[DOF_ID_ENCODING]) {
case DOF_ENCODE_LSB:
mdb_printf("dofh_ident.id_encoding = LSB\n");
break;
case DOF_ENCODE_MSB:
mdb_printf("dofh_ident.id_encoding = MSB\n");
break;
default:
mdb_printf("dofh_ident.id_encoding = 0x%x\n",
}
mdb_printf("dofh_ident.id_version = %u\n",
h.dofh_ident[DOF_ID_VERSION]);
mdb_printf("dofh_ident.id_difvers = %u\n",
h.dofh_ident[DOF_ID_DIFVERS]);
mdb_printf("dofh_ident.id_difireg = %u\n",
h.dofh_ident[DOF_ID_DIFIREG]);
mdb_printf("dofh_ident.id_diftreg = %u\n",
h.dofh_ident[DOF_ID_DIFTREG]);
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (WALK_NEXT);
}
/*ARGSUSED*/
int
{
const char *name;
dof_sec_t s;
if (!(flags & DCMD_ADDRSPEC))
mdb_printf("%<u>%?s %-10s %-5s %-5s %-5s %-6s %-5s%</u>\n",
"ADDR", "TYPE", "ALIGN", "FLAGS", "ENTSZ", "OFFSET",
"SIZE");
}
if (!(flags & DCMD_ADDRSPEC)) {
int sec = 0;
if (mdb_walk("dof_sec",
mdb_warn("failed to walk dof_sec");
return (DCMD_ERR);
}
return (DCMD_OK);
}
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_ERR);
}
else
return (DCMD_OK);
}
int
{
return (WALK_ERR);
}
return (WALK_ERR);
}
return (WALK_NEXT);
}
int
{
if (i >= hp->dofh_secnum)
return (WALK_DONE);
}
void
{
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
/*ARGSUSED*/
int
{
return (DCMD_USAGE);
return (DCMD_ERR);
}
return (DCMD_OK);
}
static int
{
char *strtab;
mdb_warn("failed to read string table");
return (1);
}
for (i = 0; i < sz; i++) {
if (strtab[i] == '\0')
mdb_printf("\\0");
else
}
mdb_printf("\n");
return (0);
}
static int
{
char *strtab, *p;
int i, j;
mdb_warn("failed to read DOF provider");
return (-1);
}
mdb_warn("failed to read string table");
return (-1);
}
if (sz != 0) {
mdb_warn("failed to read args");
return (-1);
}
}
!= sz) {
mdb_warn("failed to read offsets");
return (-1);
}
pv.dofpv_prenoffs == 0) {
mdb_warn("failed to read is-enabled offsets");
return (-1);
}
}
mdb_warn("failed to read probes");
return (-1);
}
(void) mdb_inc_indent(2);
(void) mdb_inc_indent(2);
mdb_printf("offs: ");
for (j = 0; j < pb->dofpr_noffs; j++) {
}
mdb_printf("\n");
mdb_printf("enoffs: ");
if (pb->dofpr_nenoffs != 0)
mdb_printf("<error>");
} else {
for (j = 0; j < pb->dofpr_nenoffs; j++) {
}
}
mdb_printf("\n");
}
mdb_printf("nargs:");
for (j = 0; j < pb->dofpr_nargc; j++) {
}
mdb_printf("\n");
mdb_printf("xargs:");
for (j = 0; j < pb->dofpr_xargc; j++) {
}
mdb_printf("\n");
mdb_printf("map: ");
for (j = 0; j < pb->dofpr_xargc; j++) {
}
(void) mdb_dec_indent(2);
mdb_printf("\n}\n");
}
(void) mdb_dec_indent(2);
mdb_printf("}\n");
return (0);
}
static int
{
int i;
mdb_warn("failed to read argument");
return (1);
}
if (i % 20 == 19)
mdb_printf("\n");
}
mdb_printf("\n");
return (0);
}
/*ARGSUSED*/
static int
{
const char *name;
int i;
mdb_warn("failed to read DOF header");
return (DCMD_ERR);
}
for (i = 0; i < dofh.dofh_secnum; i++) {
mdb_warn("failed to read DOF sections");
return (DCMD_ERR);
}
}
for (i = 0; i < dofh.dofh_secnum; i++) {
else
(void) mdb_inc_indent(2);
case DOF_SECT_PROVIDER:
break;
case DOF_SECT_STRTAB:
break;
case DOF_SECT_PRARGS:
break;
}
(void) mdb_dec_indent(2);
mdb_printf("\n");
}
return (DCMD_OK);
}
{ NULL }
};
{ "dof_sec", "walk DOF section header table given header address",
{ NULL }
};
};
const mdb_modinfo_t *
_mdb_init(void)
{
d++; /* count common dcmds */
w++; /* count common walkers */
#ifdef _KERNEL
kd++; /* count kernel dcmds */
kw++; /* count common walkers */
#endif
#ifdef _KERNEL
bcopy(kernel_dcmds, (void *)
bcopy(kernel_walkers, (void *)
#endif
return (&modinfo);
}
void
_mdb_fini(void)
{
uint_t d = 0, w = 0;
d++;
w++;
}