History log of /freebsd-current/sys/ddb/db_examine.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 796df753 30-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

SPDX: Consider code from Carnegie-Mellon University.

Interesting cases, most likely from CMU Mach sources.


# 808cf02c 25-Sep-2016 Bruce Evans <bde@FreeBSD.org>

Determine the operand/address size of %cs in a new function
db_segsize().

Use db_segsize() to set the default operand/address size for
disassembling. Allow overriding this with the "alternate" display
format /I. The API of db_disasm() should be debooleanized to pass a
more general request (amd64 needs overrides to sizes of 16, 32, and
64, but this commit doesn't implement anything for amd64 since much
larger changes are needed to restore the amd64 disassmbler's support
for non-default sizes).

Fix db_print_loc_and_inst() to ask for the normal format and not the
alternate in normal operation.

This is most useful for vm86 mode, but also works for 16-bit protected
mode.

Use db_segsize() to avoid trying to print a garbage stack trace if %cs
is 16 bits. Print something like the stack trace termination message
for a trap boundary instead.

Document that the alternate format is now useful on i386.


# c69cee69 16-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

Add a small set of logical operators to DDB command language.

This are based on Mach3.
Documentation is pending but has been promised.

Submitted by: Dan Partelly
Reviewed by: adrian, jhb (older version)

Differential Revision: https://reviews.freebsd.org/D4230
RelNotes: yes


# 8c6a0d07 06-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

Revert r298938: Change x/a to work similar to gdb.

This badly breaks x/ia: ddb and gdb syntax are quite different and it is
unclear if they can be reconciled.


# dd40d6d5 02-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

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


# e31a60b4 21-Jul-2015 Mark Johnston <markj@FreeBSD.org>

Don't return undefined symbols to a DDB symbol lookup.

Undefined symbols have a value of zero, so it makes no sense to return
such a symbol when performing a lookup by value. This occurs for example
when unwinding the stack after calling a NULL function pointer, and we
confusingly report the faulting function as uart_sab82532_class() on
amd64.

Convert db_print_loc_and_inst() to only attempt disassembly if we managed
to find a symbol corresponding to the IP. Otherwise we may fault and
re-enter the debugger.

Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D2858


# cd508278 21-May-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

ddb: finish converting boolean values.

The replacement started at r283088 was necessarily incomplete without
replacing boolean_t with bool. This also involved cleaning some type
mismatches and ansifying old C function declarations.

Pointed out by: bde
Discussed with: bde, ian, jhb


# 2b490bc7 18-May-2015 Pedro F. Giffuni <pfg@FreeBSD.org>

ddb: stop boolean screaming.

TRUE --> true
FALSE--> false

Hinted by: NetBSD


# a41dd031 12-Oct-2014 Pedro F. Giffuni <pfg@FreeBSD.org>

ddb: ANSI-fy function declarations.

MFC after: 5 days


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 7c7b7f8e 07-Mar-2008 Robert Watson <rwatson@FreeBSD.org>

Add a /S mode to DDB "ex" command, which interprets and prints the
value at the requested address as a symbol. For example, "ex /S
aio_swake" prints the name of the function currently registered in
via aio_swake hook.

The change as committed differs slightly from the patch in the PR,
as I force the size of the retrieved value (and the automatic
address increment) to be sizeof(void *). This seems to provide
the most useful auto-increment behavior, and defaults using the
default size (4), which is not sizeof(void *) on 64-bit platforms.

MFC after: 3 days
PR: 57976
Submitted by: Dan Strick <strick at covad.net>


# 6b76a4c7 27-Oct-2007 John Baldwin <jhb@FreeBSD.org>

Make the examine command honor db_pager_quit so you can use 'q' or 'x'
at the pager prompt to abort an examine command that spans multiple pages.

MFC after: 1 week


# 2481da74 08-Oct-2006 Bruce Evans <bde@FreeBSD.org>

Fixed formatting of printing of command tables. WIth the default max
output width of 79, only 6 columns of width 12 each fit, but 7 columns
were printed.

The fix is to pass the width of the next output to db_end_line() and
not assume there that this width is always 1.

Related unfixed bugs:
- 1 character is wasted for a space after the last column
- suppression of trailing spaces used to limit the misformatting, but
seems to have been lost
- in db_examine(), the width of the next output is not know and is
still assumed to be 1.


# dd3cb568 05-Jan-2005 Warner Losh <imp@FreeBSD.org>

Start each of the license/copyright comments with /*-


# 753960f7 10-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().


# 4578a2e6 25-Oct-2002 Maxime Henrion <mux@FreeBSD.org>

- Rename the DDB specific %z printf format to %y.
- Make DDB use %y instead of %z.
- Teach GCC about %y.
- Implement support for the C99 %z format modifier.

Approved by: re@
Reviewed by: peter
Tested on: i386, sparc64


# 358ad31d 25-Jun-2002 Thomas Moestl <tmm@FreeBSD.org>

Don't assume that pointers are 4 bytes or sizeof(int) in size. This fixes
the indirection operator ('*') and address examination ('x/a') on
big-endian platoforms for which the above is not true, as well as on
little-endian platforms if the cut-off bits are not 0.


# 14e10f99 19-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 1c6989fa 01-Jul-1999 Peter Wemm <peter@FreeBSD.org>

Quiet warnings on Alpha. (db_expr_t is a long on alpha, int on x86)


# 07f6cad7 13-May-1999 Bruce Evans <bde@FreeBSD.org>

Restored used include of <sys/systm.h>. -Wmissing-prototypes doesn't work
for builtin functions.


# 596dfc04 08-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Use not-so-new printf formats %r and/or %z instead of %n and/or %+x.


# b1bf7bc6 08-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Fixed db_printf format errors (except for ones using broken extensions
(nonstandard %n and '+' with %x), and ones not found by -Wformat on
386's (some db_expr_t's are still printed as ints).

I decided not to change the arg type for %n from [unsigned] int to
register_t, since about half of the uses of %n are to print plain
ints and casting to [unsigned] long for %n is no harder than for %x.


# 1bfc653b 05-Jul-1998 Doug Rabson <dfr@FreeBSD.org>

Support 'g' format for printing 8 byte values.


# c111a701 27-Jun-1998 Doug Rabson <dfr@FreeBSD.org>

Use %+11ln for printing in r format to make it work for 64bit registers.


# 897cd717 10-Jun-1998 Doug Rabson <dfr@FreeBSD.org>

Add initial support for the FreeBSD/alpha kernel. This is very much a
work in progress and has never booted a real machine. Initial
development and testing was done using SimOS (see
http://simos.stanford.edu for details). On the SimOS simulator, this
port successfully reaches single-user mode and has been tested with
loads as high as one copy of /bin/ls :-).

Obtained from: partly from NetBSD/alpha


# aebed8b0 08-Jun-1998 Doug Rabson <dfr@FreeBSD.org>

Make DDB work again after I broke it :-(.


# ecbb00a2 07-Jun-1998 Doug Rabson <dfr@FreeBSD.org>

This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.


# b9478d12 01-Apr-1997 Bruce Evans <bde@FreeBSD.org>

Fixed gratuitous ANSIisms.


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# ad9c135e 21-Jan-1996 Bruce Evans <bde@FreeBSD.org>

Fixed the one remaining %r.


# 791d77e0 15-Jan-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Get rid of two and a half printf in the kernel.
Add more features to the one remaining to handle the job:
+ signed quantity.
# alternate format
- left padding
* read width as next arg.
n numeric in (argument specified) default radix.

Fix the DDB debugger to use these.
Use vprintf in debug routine in pcvt.

The warnings from gcc may become more wrong and intolerable because
of this.

Warning: I have not checked the entire source for unsupported or
changed constructs, but generally belive that there are only a few.

Suggested by: bde


# 5ccbc3cc 10-Dec-1995 Bruce Evans <bde@FreeBSD.org>

Reduced and cleaned up #includes.


# efeaf95a 06-Dec-1995 David Greenman <dg@FreeBSD.org>

Untangled the vm.h include file spaghetti.


# f73a856d 29-Nov-1995 Poul-Henning Kamp <phk@FreeBSD.org>

Staticized and '#ifdef notused' stuff we don't use.


# 058284fc 24-Nov-1995 Bruce Evans <bde@FreeBSD.org>

Completed function declarations and/or added prototypes and/or #includes
to get the prototypes.

Changed some `int's to `boolean_t's. boolean_t's are ints so they are
hard to distinguish from ints.

Converted function headers to old-style. ddb is written in K&R1 C
except where we broke it.


# 9b2e5354 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 751b0b8e 22-May-1995 David Greenman <dg@FreeBSD.org>

Print the address associated with an examine. Changed db_maxoff to
something more reasonable (64k). Suggested by Gordon Ross about a
year ago.


# f23b4c91 18-Aug-1994 Garrett Wollman <wollman@FreeBSD.org>

Fix up some sloppy coding practices:

- Delete redundant declarations.
- Add -Wredundant-declarations to Makefile.i386 so they don't come back.
- Delete sloppy COMMON-style declarations of uninitialized data in
header files.
- Add a few prototypes.
- Clean up warnings resulting from the above.

NB: ioconf.c will still generate a redundant-declaration warning, which
is unavoidable unless somebody volunteers to make `config' smarter.


# f540b106 12-Aug-1994 Garrett Wollman <wollman@FreeBSD.org>

Change all #includes to follow the current Berkeley style. Some of these
``changes'' are actually not changes at all, but CVS sometimes has trouble
telling the difference.

This also includes support for second-directory compiles. This is not
quite complete yet, as `config' doesn't yet do the right thing. You can
still make it work trivially, however, by doing the following:

rm /sys/compile
mkdir /usr/obj/sys/compile
ln -s M-. /sys/compile
cd /sys/i386/conf
config MYKERNEL
cd ../../compile/MYKERNEL
ln -s /sys @
rm machine
ln -s @/i386/include machine
make depend
make


# aaf08d94 18-Dec-1993 Garrett Wollman <wollman@FreeBSD.org>

Make everything compile with -Wtraditional. Make it easier to distribute
a binary link-kit. Make all non-optional options (pagers, procfs) standard,
and update LINT to reflect new symtab requirements.

NB: -Wtraditional will henceforth be forgotten. This editing pass was
primarily intended to detect any constructions where the old code might
have been relying on traditional C semantics or syntax. These were all
fixed, and the result of fixing some of them means that -Wall is now a
realistic possibility within a few weeks.


# 381fe1aa 24-Nov-1993 Garrett Wollman <wollman@FreeBSD.org>

Make the LINT kernel compile with -W -Wreturn-type -Wcomment -Werror, and
add same (sans -Werror) to Makefile for future compilations.


# 0edf66ec 16-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, some
minor cleanup. Added $Id$ to files that did not have any version info, etc


# 5b81b6b3 12-Jun-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Initial import, 0.1 + pk 0.2.4-B1