/*
* 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <mdb/mdb_modapi.h>
struct modctl_walk_data {
};
static int
{
sizeof (struct modctl_walk_data), UM_SLEEP);
return (WALK_NEXT);
}
static int
{
int status;
return (WALK_DONE);
return (WALK_ERR);
}
wsp->walk_cbdata);
return (status);
}
static void
{
}
/*ARGSUSED*/
static int
{
*bp++ = 'b';
*bp++ = 'w';
*bp++ = 'p';
if (mcp->mod_loaded)
*bp++ = 'l';
if (mcp->mod_installed)
*bp++ = 'i';
*bp = '\0';
mdb_printf("%?p %?p %6s 0x%02x %3d %s\n",
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
mdb_printf("%<u>%?s %?s %6s %4s %3s %s%</u>\n",
"MODCTL", "MODULE", "BITS", "FLAGS", "REF", "FILE");
}
if (flags & DCMD_ADDRSPEC) {
}
return (DCMD_ERR);
return (DCMD_OK);
}
static void
{
mdb_printf("\nELF Header\n");
mdb_printf(" ei_magic: { 0x%02x, %c, %c, %c }\n",
mdb_printf(" ei_class: %-18u ei_data: %-16u\n",
mdb_printf(" e_machine: %-18hu e_version: %-16u\n",
mdb_printf(" e_entry: 0x%16lx e_ehsize: %8hu e_shstrndx: %hu\n",
mdb_printf(" e_shoff: 0x%16lx e_shentsize: %8hu e_shnum: %hu\n",
mdb_printf(" e_phoff: 0x%16lx e_phentsize: %8hu e_phnum: %hu\n",
}
static void
{
{ NULL, 0, 0 }
};
{ NULL, 0, 0 }
};
mdb_printf("\nSection Header[%d]:\n", i);
mdb_printf(" sh_addr: 0x%-16lx sh_flags: [ %#lb ]\n",
mdb_printf(" sh_size: 0x%-16lx sh_type: [ %#lb ]\n",
mdb_printf(" sh_offset: 0x%-16lx sh_entsize: 0x%lx\n",
mdb_printf(" sh_link: 0x%-16lx sh_info: 0x%lx\n",
}
/*ARGSUSED*/
static int
{
int i;
if (!(flags & DCMD_ADDRSPEC)) {
mdb_warn("expected address of struct modctl before ::\n");
return (DCMD_USAGE);
}
if (argc != 0)
return (DCMD_USAGE);
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
info[0] = '\0';
}
}
mdb_printf("%3d %?p %8lx %3d %s (%s)\n",
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
if (argc != 0)
return (DCMD_USAGE);
mdb_printf("%<u>%3s %?s %8s %3s %s%</u>\n",
"ID", "LOADADDR", "SIZE", "REV", "MODULE NAME");
}
if (flags & DCMD_ADDRSPEC) {
}
return (DCMD_ERR);
return (DCMD_OK);
}
/*ARGSUSED*/
static int
{
return (WALK_NEXT); /* module is not loaded */
mdb_warn("failed to read module at %p for modctl %p\n",
return (WALK_NEXT);
}
return (WALK_NEXT);
}
/*ARGSUSED*/
static int
{
return (DCMD_USAGE);
return (DCMD_ERR);
return (DCMD_OK);
}
{ NULL }
};
{ "modctl", "list of modctl structures",
{ NULL }
};
const mdb_modinfo_t *
_mdb_init(void)
{
mdb_warn("failed to lookup 'modules'");
return (NULL);
}
return (&krtld_modinfo);
}