6679349 Add new option -b to mdb's dis command
authorss161897
Thu, 27 Mar 2008 14:00:51 -0700
changeset 6302 57b4a030f7ec
parent 6301 ef002c386e3f
child 6303 14262dfe7e71
6679349 Add new option -b to mdb's dis command
usr/src/cmd/mdb/common/mdb/mdb_cmds.c
--- a/usr/src/cmd/mdb/common/mdb/mdb_cmds.c	Thu Mar 27 11:27:33 2008 -0700
+++ b/usr/src/cmd/mdb/common/mdb/mdb_cmds.c	Thu Mar 27 14:00:51 2008 -0700
@@ -2,9 +2,8 @@
  * 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.
+ * 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
  * or http://www.opensolaris.org/os/licensing.
@@ -19,8 +18,9 @@
  *
  * CDDL HEADER END
  */
+
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1888,6 +1888,7 @@
 	uint_t opt_f = FALSE;		/* File-mode off by default */
 	uint_t opt_w = FALSE;		/* Window mode off by default */
 	uint_t opt_a = FALSE;		/* Raw-address mode off by default */
+	uint_t opt_b = FALSE;		/* Address & symbols off by default */
 	uintptr_t n = -1UL;		/* Length of window in instructions */
 	uintptr_t eaddr = 0;		/* Ending address; 0 if limited by n */
 
@@ -1895,6 +1896,7 @@
 	    'f', MDB_OPT_SETBITS, TRUE, &opt_f,
 	    'w', MDB_OPT_SETBITS, TRUE, &opt_w,
 	    'a', MDB_OPT_SETBITS, TRUE, &opt_a,
+	    'b', MDB_OPT_SETBITS, TRUE, &opt_b,
 	    'n', MDB_OPT_UINTPTR, &n, NULL);
 
 	/*
@@ -1971,6 +1973,9 @@
 				return (DCMD_ERR);
 			if (opt_a)
 				mdb_printf("%-#32p%8T%s\n", addr, buf);
+			else if (opt_b)
+				mdb_printf("%-#10p%-#32a%8T%s\n",
+				    addr, addr, buf);
 			else
 				mdb_printf("%-#32a%8T%s\n", addr, buf);
 			addr = naddr;
@@ -1992,6 +1997,9 @@
 				return (DCMD_ERR);
 			if (opt_a)
 				mdb_printf("%-#32p%8T%s\n", oaddr, buf);
+			else if (opt_b)
+				mdb_printf("%-#10p%-#32a%8T%s\n",
+				    oaddr, oaddr, buf);
 			else
 				mdb_printf("%-#32a%8T%s\n", oaddr, buf);
 		}
@@ -2004,6 +2012,8 @@
 		mdb_flush();
 		if (opt_a)
 			mdb_printf("%-#32p%8T%s%", addr, buf);
+		else if (opt_b)
+			mdb_printf("%-#10p%-#32a%8T%s", addr, addr, buf);
 		else
 			mdb_printf("%-#32a%8T%s%", addr, buf);
 		mdb_printf("%</b>\n");
@@ -2015,6 +2025,9 @@
 				return (DCMD_ERR);
 			if (opt_a)
 				mdb_printf("%-#32p%8T%s\n", addr, buf);
+			else if (opt_b)
+				mdb_printf("%-#10p%-#32a%8T%s\n",
+				    addr, addr, buf);
 			else
 				mdb_printf("%-#32a%8T%s\n", addr, buf);
 		}
@@ -2853,7 +2866,7 @@
 	    "specified addresses or symbols", cmd_bp, bp_help },
 	{ "dcmds", NULL, "list available debugger commands", cmd_dcmds },
 	{ "delete", "?[id|all]", "delete traced software events", cmd_delete },
-	{ "dis", "?[-afw] [-n cnt] [addr]", "disassemble near addr", cmd_dis },
+	{ "dis", "?[-abfw] [-n cnt] [addr]", "disassemble near addr", cmd_dis },
 	{ "disasms", NULL, "list available disassemblers", cmd_disasms },
 	{ "dismode", "[mode]", "get/set disassembly mode", cmd_dismode },
 	{ "dmods", "[-l] [mod]", "list loaded debugger modules", cmd_dmods },