History log of /freebsd-current/sys/ddb/db_output.c
Revision Date Author Comments
# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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

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


# 3e5e9939 14-Mar-2021 Ryan Libby <rlibby@FreeBSD.org>

ddb: enable the use of ^C and ^S/^Q

This lets one interrupt DDB's output, which is useful if paging is
disabled and the output device is slow.

This follows a previous implementation in svn r311952 / git
5fddef79998678d256ba30316353393b4d8ebb32 which was reverted because it
broke DDB type-ahead.

Now, try this again, but with a 512-byte type-ahead buffer. While there
is buffer space, control input is handled and non-control input is
buffered. When the buffer is exhausted, the default is to print a
warning and drop further non-control input in order to continue handling
control input. sysctl debug.ddb.prioritize_control_input can be set to
0 to instead preserve all input but lose immediate handling of control
input. This could for example effect pasting of a large script into the
ddb console.

Suggested by: Anton Rang <rang@acm.org>
Reviewed by: markj
Discussed with: imp
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D28676


# b10bc5a1 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

ddb: clean up empty lines in .c and .h files


# 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.


# 3e85b721 16-May-2017 Ed Maste <emaste@FreeBSD.org>

Remove register keyword from sys/ and ANSIfy prototypes

A long long time ago the register keyword told the compiler to store
the corresponding variable in a CPU register, but it is not relevant
for any compiler used in the FreeBSD world today.

ANSIfy related prototypes while here.

Reviewed by: cem, jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D10193


# 4ed3c0e7 30-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: Make use of our rounddown() macro when sys/param.h is available.

No functional change.


# 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.


# d5a62857 18-May-2010 Attilio Rao <attilio@FreeBSD.org>

MFC r207922, r207925, r207929, r208052:
- Change the db_printf return value in order to catch up with printf
- Make witness_list_locks() and witness_display_spinlock() accept
callbacks for printf-like functions in order to queue the output on the
correct channel.


# 3caaaae0 11-May-2010 Attilio Rao <attilio@FreeBSD.org>

There is not a good reason to have a different prototype for db_printf()
when compared to printf().
Unify it by returning the number of characters displayed for db_printf()
as well.

MFC after: 7 days


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

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


# e23851c6 18-Aug-2008 Attilio Rao <attilio@FreeBSD.org>

Add a missing include which was erroneusly left out from the previous
commit.

Sponsored by: Nokia


# 51b93e47 18-Aug-2008 Attilio Rao <attilio@FreeBSD.org>

Bufferize the output for DDB printouts.
In order to CATER this, DDB buffered output can be choosen at compile
time through the option DDB_BUFR_SIZE=nbytes where nbytes choose the size
of the buffer (suggested size is 128 bytes), which should be manually
specified in any interested config file.

Sponsored by: Nokia


# 086fec57 25-Dec-2007 Robert Watson <rwatson@FreeBSD.org>

Add a new DDB(4) facility, output capture. Input and output from DDB may be
captured to a memory buffer for later inspection using sysctl(8), or in the
future, to a textdump.

A new DDB command, "capture", is added, which accepts arguments "on", "off",
"reset", and "status".

A new DDB sysctl tree, debug.ddb.capture, is added, which can be used to
resize the capture buffer and extract buffer contents.

MFC after: 3 months


# c7eeb59d 10-Oct-2006 Bruce Evans <bde@FreeBSD.org>

Fixed loss of whitespace suppression at ends of lines. Whitespace
suppression is only needed at ends of lines, but rev.1.32 forced it
off precisely there.

The --More-- prompt is now cleared by explicitly forcing out the
whitespace in "\r \r". It might be better to use the line
editor's clearing functions, but these are currently static and not
much different.


# 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.


# 19e9205a 12-Jul-2006 John Baldwin <jhb@FreeBSD.org>

Simplify the pager support in DDB. Allowing different db commands to
install custom pager functions didn't actually happen in practice (they
all just used the simple pager and passed in a local quit pointer). So,
just hardcode the simple pager as the only pager and make it set a global
db_pager_quit flag that db commands can check when the user hits 'q' (or a
suitable variant) at the pager prompt. Also, now that it's easy to do so,
enable paging by default for all ddb commands. Any command that wishes to
honor the quit flag can do so by checking db_pager_quit. Note that the
pager can also be effectively disabled by setting $lines to 0.

Other fixes:
- 'show idt' on i386 and pc98 now actually checks the quit flag and
terminates early.
- 'show intr' now actually checks the quit flag and terminates early.


# da927f93 02-Oct-2005 Olivier Houchard <cognet@FreeBSD.org>

- Call db_setup_paging() for traceall.
- Make it so one can't call db_setup_paging() if it has already been called
before. traceall needs this, or else the db_setup_paging() call from
db_trace_thread() will reset the printed line number, and override its
argument.
This is not perfect for traceall, because even if one presses 'q' while in
the middle of printing a backtrace it will finish printing the backtrace
before exiting, as db_trace_thread() won't be notified it should stop, but
it is hard to do better without reworking the pager interface a lot more.


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

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


# d39d4a6e 01-Nov-2004 John Baldwin <jhb@FreeBSD.org>

- Change the ddb paging "support" to use a variable (db_lines_per_page) to
control the number of lines per page rather than a constant. The variable
can be examined and changed in ddb as '$lines'. Setting the variable to
0 will effectively turn off paging.
- Change db_putchar() to force out pending whitespace before outputting
newlines and carriage returns so that one can rub out content on the
current line via '\r \r' type strings.
- Change the simple pager to rub out the --More-- prompt explicitly when
the routine exits.
- Add some aliases to the simple pager to make it more compatible with
more(1): 'e' and 'j' do a single line. 'd' does half a page, and
'f' does a full page.

MFC after: 1 month
Inspired by: kris


# 37224cd3 10-Jul-2004 Marcel Moolenaar <marcel@FreeBSD.org>

Mega update for the KDB framework: turn DDB into a KDB backend.
Most of the changes are a direct result of adding thread awareness.
Typically, DDB_REGS is gone. All registers are taken from the
trapframe and backtraces use the PCB based contexts. DDB_REGS was
defined to be a trapframe on all platforms anyway.
Thread awareness introduces the following new commands:
thread X switch to thread X (where X is the TID),
show threads list all threads.

The backtrace code has been made more flexible so that one can
create backtraces for any thread by giving the thread ID as an
argument to trace.

With this change, ia64 has support for breakpoints.


# 5de6c5b5 27-Jan-2004 Nate Lawson <njl@FreeBSD.org>

If not in the debugger or if the user requests it with the
debug.ddb_use_printf sysctl, output kernel debugger data to both the
console and kernel message buffer via printf. This fixes the case where
backtrace() went directly to the console and should help debugging greatly.
Thanks to Ian Dowse for the work, minor edits or any bugs are by myself.

Submitted by: iedowse


# 1e16f609 31-Jul-2003 John Baldwin <jhb@FreeBSD.org>

Add a one-shot callout facility to db_printf() that executes the registered
callout when a specified number of lines have been output. This can be
used to implement pagers for ddb commands that output a lot of text. A
simple paging function is included that automatically rearms itself when
fired.

Reviewed by: bde, julian


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

Use __FBSDID().


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

Remove __P.


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

$Id$ -> $FreeBSD$


# ce9edcf5 09-Aug-1999 Poul-Henning Kamp <phk@FreeBSD.org>

Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.


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

Fixed bogus type of valuep in struct db_variable. It was `int *' and
became `long *' for alpha, but should always have been `db_expr_t *'.
Fixed variable types to match.


# 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.


# c7c34a24 14-Sep-1996 Bruce Evans <bde@FreeBSD.org>

Attached vm ddb commands `show map', `show vmochk', `show object',
`show vmopag', `show page' and `show pageq'. Moved all vm ddb stuff
to the ends of the vm source files.

Changed printf() to db_printf(), `indent' to db_indent, and iprintf()
to db_iprintf() in ddb commands. Moved db_indent and db_iprintf()
from vm to ddb.

vm_page.c:
Don't use __pure. Staticized.

db_output.c:
Reduced page width from 80 to 79 to inhibit double spacing for long
lines (there are still some problems if words are printed across
column 79).


# 6ddbf1e2 07-May-1996 Gary Palmer <gpalmer@FreeBSD.org>

Clean up various compiler warnings. Most (if not all) were benign

Reviewed by: bde


# d7c0e66f 23-Jan-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Remove some now unused printfoids.


# 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.


# d2984da1 30-Oct-1994 Bruce Evans <bde@FreeBSD.org>

Print "(null)" instead of crashing for null strings. Null names are
often generated for stack traces. Now inspection of unmapped addresses
no longer panics the system.


# 169cd910 26-Sep-1994 Poul-Henning Kamp <phk@FreeBSD.org>

Makes gcc silent in sys/ddb.


# 8a129cae 27-Aug-1994 David Greenman <dg@FreeBSD.org>

1) Changed ddb into a option rather than a pseudo-device (use options DDB
in your kernel config now).
2) Added ps ddb function from 1.1.5. Cleaned it up a bit and moved into its
own file.
3) Added \r handing in db_printf.
4) Added missing memory usage stats to statclock().
5) Added dummy function to pseudo_set so it will be emitted if there
are no other pseudo declarations.


# 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


# 572de915 09-Sep-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Moved db_end_line after db_printf to eliminate forward reference and
shut up the compiler about prototype mismatch.


# 26931201 27-Jul-1993 David Greenman <dg@FreeBSD.org>

* Applied fixes from Bruce Evans to fix COW bugs, >1MB kernel loading,
profiling, and various protection checks that cause security holes
and system crashes.
* Changed min/max/bcmp/ffs/strlen to be static inline functions
- included from cpufunc.h in via systm.h. This change
improves performance in many parts of the kernel - up to 5% in the
networking layer alone. Note that this requires systm.h to be included
in any file that uses these functions otherwise it won't be able to
find them during the load.
* Fixed incorrect call to splx() in if_is.c
* Fixed bogus variable assignment to splx() in if_ed.c


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

Initial import, 0.1 + pk 0.2.4-B1