diff options
| author | Jason King <jason.king@joyent.com> | 2019-01-20 02:22:39 +0000 |
|---|---|---|
| committer | Jason King <jason.king@joyent.com> | 2019-08-06 16:48:24 +0000 |
| commit | 6ae988a66abd6e53f1d2a0029e7022e49aeb23ea (patch) | |
| tree | 24efb32f1488a195a394db2a396aab3ae4c28144 | |
| parent | 258d6b4c4d7a365e9fa0e220778c556aeb8dc45d (diff) | |
| download | illumos-joyent-6ae988a66abd6e53f1d2a0029e7022e49aeb23ea.tar.gz | |
OS-7903 Document mdb(1) ::dis flags
Reviewed by: John Levon <john.levon@joyent.com>
Approved by: John Levon <john.levon@joyent.com>
| -rw-r--r-- | usr/src/cmd/mdb/common/mdb/mdb_cmds.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c index 878728251c..ad6a388b49 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c @@ -26,7 +26,7 @@ /* * Copyright (c) 2012 by Delphix. All rights reserved. - * Copyright (c) 2019 Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2013 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * Copyright (c) 2015, 2017 by Delphix. All rights reserved. * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. @@ -2165,6 +2165,46 @@ cmd_dis(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) return (DCMD_OK); } +static void +dis_help(void) +{ + static const char dis_desc[] = +"Disassembles instructions starting at the final argument or the current\n" +"value of dot. If the address is the start of a function, the entire\n" +"function is disassembled, or else a window of instructions before and after\n" +"the disassembled address are displayed.\n" +"\n"; + + static const char dis_opts[] = +" -a Print instruction addresses as numeric values instead of \n" +" symbolic values.\n" +" -b Print instruction addresses as both numeric and symbolic " +"values.\n" +" -f Read instructions from the target's object file instead of the \n" +" target's virtual address space.\n" +" -n instr Display 'instr' instructions before and after the given " +"address.\n" +" -w Force window behavior, even at the start of a function.\n" +"\n"; + + static const char dis_examples[] = +" ::dis\n" +" clock::dis\n" +" ::dis gethrtime\n" +" set_freemem+0x16::dis -n 4\n" +"\n"; + + mdb_printf("%s", dis_desc); + (void) mdb_dec_indent(2); + mdb_printf("%<b>OPTIONS%</b>\n"); + (void) mdb_inc_indent(2); + mdb_printf("%s", dis_opts); + (void) mdb_dec_indent(2); + mdb_printf("%<b>EXAMPLES%</b>\n"); + (void) mdb_inc_indent(2); + (void) mdb_printf("%s", dis_examples); +} + /*ARGSUSED*/ static int walk_step(uintptr_t addr, const void *data, void *private) @@ -3105,7 +3145,8 @@ const mdb_dcmd_t mdb_dcmd_builtins[] = { { "dcmds", "[[-n] pattern]", "list available debugger commands", cmd_dcmds, cmd_dcmds_help }, { "delete", "?[id|all]", "delete traced software events", cmd_delete }, - { "dis", "?[-abfw] [-n cnt] [addr]", "disassemble near addr", cmd_dis }, + { "dis", "?[-abfw] [-n cnt] [addr]", "disassemble near addr", cmd_dis, + dis_help }, { "disasms", NULL, "list available disassemblers", cmd_disasms }, { "dismode", "[mode]", "get/set disassembly mode", cmd_dismode }, { "dmods", "[-l] [mod]", "list loaded debugger modules", cmd_dmods }, |
