diff options
Diffstat (limited to 'usr/src/cmd')
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_cmds.c | 1 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_ctf.c | 32 | ||||
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_ctf.h | 3 |
3 files changed, 36 insertions, 0 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c index ad6a388b49..cd50cdce17 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c @@ -3205,6 +3205,7 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = { { "typeset", "[+/-t] var ...", "set variable attributes", cmd_typeset }, { "typedef", "[-c model | -d | -l | -r file | -w file ] [type] [name]", "create synthetic types", cmd_typedef, cmd_typedef_help }, + { "typelist", NULL, "list known types", cmd_typelist }, { "unset", "[name ...]", "unset variables", cmd_unset }, { "vars", "[-npt]", "print listing of variables", cmd_vars }, { "version", NULL, "print debugger version string", cmd_version }, diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c index f2854bb6d6..9cc7c6f1a0 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.c @@ -2272,3 +2272,35 @@ mdb_ctf_synthetics_to_file(const char *file) return (err); } + +static int +cmd_typelist_type(mdb_ctf_id_t id, void *arg) +{ + char buf[1024]; + + if (mdb_ctf_type_name(id, buf, sizeof (buf)) != NULL) { + mdb_printf("%s\n", buf); + } + return (0); +} + +static int +cmd_typelist_module(void *data, const mdb_map_t *mp, const char *name) +{ + (void) mdb_ctf_type_iter(name, cmd_typelist_type, data); + return (0); +} + +int +cmd_typelist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) +{ + if ((flags & DCMD_ADDRSPEC) != 0) { + return (DCMD_USAGE); + } + + (void) mdb_tgt_object_iter(mdb.m_target, cmd_typelist_module, NULL); + (void) mdb_ctf_type_iter(MDB_CTF_SYNTHETIC_ITER, cmd_typelist_type, + NULL); + + return (DCMD_OK); +} diff --git a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h index 74bc8e95da..639e7b2bdc 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_ctf.h +++ b/usr/src/cmd/mdb/common/mdb/mdb_ctf.h @@ -35,6 +35,7 @@ #ifdef _MDB #include <sys/machelf.h> +#include <mdb/mdb_modapi.h> #endif /* @@ -159,6 +160,8 @@ extern int mdb_ctf_synthetics_init(void); /* Internal */ extern void mdb_ctf_synthetics_fini(void); /* Internal */ extern int mdb_ctf_synthetics_from_file(const char *); /* Internal */ extern int mdb_ctf_synthetics_to_file(const char *); /* Internal */ +extern int cmd_typelist(uintptr_t, uint_t, int, /* Internal */ + const mdb_arg_t *); #endif |
