summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-03-10 11:51:49 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-03-10 11:51:49 +0000
commit3f9f29b906943320199b9229c24a5fe59dc340d0 (patch)
treea692758a1a376e6cb6c60438390da0c7376c6534 /usr/src/cmd
parent7986d0138f7b2fc2fe4a12dce758b443d9aa448f (diff)
parent343622ca5a82ac99828cc46e04e1f962c09be0e8 (diff)
downloadillumos-joyent-3f9f29b906943320199b9229c24a5fe59dc340d0.tar.gz
[illumos-gate merge]
commit 343622ca5a82ac99828cc46e04e1f962c09be0e8 12346 need libm(3LIB) and libmvec(3LIB) manpages commit ea7201620ceafab72b37e65bea4ec461dd27089d 12355 vnic_unicast_add() can return uninitialised diag value commit c71ad1764a07b4be9b04c56fd0d199c0f547404a 12366 Want mdb typelist command Conflicts: usr/src/man/man3lib/Makefile
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_cmds.c1
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.c32
-rw-r--r--usr/src/cmd/mdb/common/mdb/mdb_ctf.h3
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