summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruwe <uwe@openbsd.org>2017-08-14 19:57:05 +0000
committeruwe <uwe@openbsd.org>2017-08-14 19:57:05 +0000
commit2b6c37f3c0864cbed5bdd22c1ce5b9cc5b1ee9d3 (patch)
tree5608d4b84ec0db45ccb932ea3ea582052cc098c8
parentLoad CTF debug symbols before mountroot (diff)
downloadwireguard-openbsd-2b6c37f3c0864cbed5bdd22c1ce5b9cc5b1ee9d3.tar.xz
wireguard-openbsd-2b6c37f3c0864cbed5bdd22c1ce5b9cc5b1ee9d3.zip
Restore "print" in ddb; add "pp[rint]" for pretty-printing
Changing the "print" command to use db_ctf_pprint_cmd() broke all documented uses and "examine" does not allow printing variables, or individual registers. For now it is better to leave the "print" command intact, and in sync with the ddb(4) man page, but we still want "pp[rint]" to replace the "print" command when it works better. ok mpi@
-rw-r--r--share/man/man4/ddb.418
-rw-r--r--sys/ddb/db_command.c7
-rw-r--r--sys/ddb/db_ctf.c4
3 files changed, 21 insertions, 8 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
index 9fd3a592595..9f873f25f54 100644
--- a/share/man/man4/ddb.4
+++ b/share/man/man4/ddb.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ddb.4,v 1.87 2017/05/01 06:39:25 mpi Exp $
+.\" $OpenBSD: ddb.4,v 1.88 2017/08/14 19:57:05 uwe Exp $
.\" $NetBSD: ddb.4,v 1.5 1994/11/30 16:22:09 jtc Exp $
.\"
.\" Mach Operating System
@@ -25,7 +25,7 @@
.\" any improvements or extensions that they make and grant Carnegie Mellon
.\" the rights to redistribute these changes.
.\"
-.Dd $Mdocdate: May 1 2017 $
+.Dd $Mdocdate: August 14 2017 $
.Dt DDB 4
.Os
.Sh NAME
@@ -276,7 +276,7 @@ is set to the
plus the size of the data examined.
.\" --------------------
.It Xo
-.Ic print
+.Ic p Ns Op Ic rint
.Op Cm /axzodurc
.Op Ar addr Op Ar addr ...
.Xc
@@ -306,6 +306,17 @@ eax = xxxxxx
ecx = yyyyyy
.Ed
.\" --------------------
+.It Xo
+.Ic pp Ns Op Ic rint
+.Op Ar addr
+.Xc
+Pretty-print
+.Ar addr
+using CTF debug symbols included in the kernel binary image.
+The CTF section is normally added by running
+.Xr ctfstrip 1
+as part of building a new kernel.
+.\" --------------------
.\" .It Xo Ic w Ns Op Cm /bhl
.\" .Op Ar addr
.\" .Ar expr Op expr ...
@@ -1220,6 +1231,7 @@ It may be followed by a ':' and modifiers as described above.
.El
.Sh SEE ALSO
.Xr gdb 1 ,
+.Xr ctfstrip 1 ,
.Xr nm 1 ,
.Xr witness 4 ,
.Xr sysctl.conf 5 ,
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index bccdf1d5a8d..9d38c2a2dca 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.74 2017/08/11 20:50:15 mpi Exp $ */
+/* $OpenBSD: db_command.c,v 1.75 2017/08/14 19:57:05 uwe Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -617,8 +617,9 @@ struct db_command db_command_table[] = {
/* this must be the first entry, if it exists */
{ "machine", NULL, 0, NULL},
#endif
- { "print", db_ctf_pprint_cmd, CS_OWN, NULL },
- { "p", db_ctf_pprint_cmd, CS_OWN, NULL },
+ { "print", db_print_cmd, 0, NULL },
+ { "p", db_print_cmd, 0, NULL },
+ { "pprint", db_ctf_pprint_cmd, CS_OWN, NULL },
{ "examine", db_examine_cmd, CS_SET_DOT, NULL },
{ "x", db_examine_cmd, CS_SET_DOT, NULL },
{ "search", db_search_cmd, CS_OWN|CS_SET_DOT, NULL },
diff --git a/sys/ddb/db_ctf.c b/sys/ddb/db_ctf.c
index afdc4bfa82c..6e1d9fd8fc2 100644
--- a/sys/ddb/db_ctf.c
+++ b/sys/ddb/db_ctf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_ctf.c,v 1.14 2017/08/11 20:47:21 mpi Exp $ */
+/* $OpenBSD: db_ctf.c,v 1.15 2017/08/14 19:57:05 uwe Exp $ */
/*
* Copyright (c) 2016-2017 Martin Pieuchot
@@ -502,7 +502,7 @@ exit:
}
/*
- * print <symbol name>
+ * pprint <symbol name>
*/
void
db_ctf_pprint_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)