summaryrefslogtreecommitdiffstats
path: root/sys/ddb
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-02 19:32:06 +0000
committerpfg <pfg@FreeBSD.org>2016-05-02 19:32:06 +0000
commit3b54164db1bc7ae84882e04f8411f1982a4c5d70 (patch)
tree0a3e4d459850c2e35025879f43653091b667ff50 /sys/ddb
parentf80f60242ea5862a16144f9d376bb460551aebc0 (diff)
downloadFreeBSD-src-3b54164db1bc7ae84882e04f8411f1982a4c5d70.zip
FreeBSD-src-3b54164db1bc7ae84882e04f8411f1982a4c5d70.tar.gz
Enhance the ddb examine (x) command.
* Change x/a to work similar to gdb. The content of the memory is treated as an address, printed symbolically and the address is advanced. This way you can x/a <stack_address> and then just hit return a bunch of times to locate useful data on the stack. * Add x/p. The content of the memory is treated as an address and printed as hex. This is based on the similar commit from DragonFlyBSD without the cosmetic changes. Relnotes: yes Obtained from: DragonflyBSD (Matthew Dillon) Reference: 0624d20e86affcd708609cbf9014207537537a72
Diffstat (limited to 'sys/ddb')
-rw-r--r--sys/ddb/db_examine.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/sys/ddb/db_examine.c b/sys/ddb/db_examine.c
index a41fcb5..3eff396 100644
--- a/sys/ddb/db_examine.c
+++ b/sys/ddb/db_examine.c
@@ -89,15 +89,6 @@ db_examine(db_addr_t addr, char *fmt, int count)
case 'g':
size = 8;
break;
- case 'a': /* address */
- size = sizeof(void *);
- /* always forces a new line */
- if (db_print_position() != 0)
- db_printf("\n");
- db_prev = addr;
- db_printsym(addr, DB_STGY_ANY);
- db_printf(":\t");
- break;
default:
if (db_print_position() == 0) {
/* Print the address. */
@@ -108,6 +99,18 @@ db_examine(db_addr_t addr, char *fmt, int count)
width = size * 4;
switch (c) {
+ case 'a': /* address */
+ size = sizeof(void *);
+ value = db_get_value(addr, size, TRUE);
+ addr += size;
+ db_printsym(value, DB_STGY_ANY);
+ break;
+ case 'p':
+ size = sizeof(void *);
+ value = db_get_value(addr, size, TRUE);
+ addr += size;
+ db_printf("%p", (void *)value);
+ break;
case 'r': /* signed, current radix */
value = db_get_value(addr, size, true);
addr += size;
@@ -173,7 +176,7 @@ db_examine(db_addr_t addr, char *fmt, int count)
default:
break;
}
- if (db_print_position() != 0)
+ if (db_print_position() != 0 || c == 'a' || c == 'p')
db_end_line(1);
break;
}
OpenPOWER on IntegriCloud