Commit Graph

81 Commits

Author SHA1 Message Date
fvdl 75e45c9dee Check msgbufenabled before referencing msgbufp in panic. Avoids
a NULL ptr reference if there is an early panic (i.e. before
initmsgbuf() was called).
2001-07-10 20:40:56 +00:00
lukem d84d2c6c85 add missing #include "opt_kgdb.h" 2001-05-30 15:24:23 +00:00
simonb 6a2acde042 Save the start and end positions in the message buffer of the formatted
panic string.

Suggested by Jason Thorpe eons ago.
2001-05-06 13:23:42 +00:00
kleink 50d738a0f0 Add %j, %t and %z modifiers. 2001-04-30 21:29:45 +00:00
tsutsui d507b847c6 Declare constty extern. 2001-03-09 13:35:50 +00:00
tv 5b0a45ec9b Strip %b and DDB formats out of kprintf, as they are no longer supported. 2000-08-09 10:22:31 +00:00
jdolecek 1ec07d7439 change tablefull() to accept one more parameter - optional hint
use that to inform about way to raise current limit when we reach maximum
number of processes, descriptors or vnodes

XXX hopefully I catched all users of tablefull()
2000-07-04 15:33:28 +00:00
sommerfeld e964d558a7 Fix assorted bugs around shutdown/reboot/panic time.
- add a new global variable, doing_shutdown, which is nonzero if
vfs_shutdown() or panic() have been called.
- in panic, set RB_NOSYNC if doing_shutdown is already set on entry
so we don't reenter vfs_shutdown if we panic'ed there.
 - in vfs_shutdown, don't use proc0's process for sys_sync unless
curproc is NULL.
 - in lockmgr, attribute successful locks to proc0 if doing_shutdown
&& curproc==NULL, and  panic if we can't get the lock right away; avoids the
spurious lockmgr DIAGNOSTIC panic from the ddb reboot command.
 - in subr_pool, deal with curproc==NULL in the doing_shutdown case.
 - in mfs_strategy, bitbucket writes if doing_shutdown, so we don't
wedge waiting for the mfs process.
 - in ltsleep, treat ((curproc == NULL) && doing_shutdown) like the
panicstr case.

Appears to fix: kern/9239, kern/10187, kern/9367.
May also fix kern/10122.
2000-06-10 18:44:43 +00:00
jhawk 0ff7191f39 Ensure that a fault inside the traceback printing code
(i.e. db_stack_trace_print()) does not cause an infinite loop of
faults.
2000-05-29 23:10:03 +00:00
jhawk 1fe6e4844f If db_onpanic is unset and DDB is compiled in, panic() now calls
db_stack_trace_print(__builtin_frame_address(0),...), to printf() the
stack trace to the message bufffer and console. Idea from SunOS/Solaris.
Useful when dumping fails.
2000-05-26 20:25:57 +00:00
jhawk d30834ad42 Support ddb-specific nonstandard printf formats %r and %z in kprintf(),
even when not called with (flags&TODDB != 0), such that ddb print routines
can use them when printing elsewhere, such as to the message buffer.
2000-05-25 21:32:41 +00:00
pk 716a862d08 Lock internals have changed, and we depend on those in here. 2000-05-02 09:29:39 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
simonb 6043a575b2 Remove declaration of db_radix - <ddb/db_output.h> has one.
Also remove <sys/conf.h> - don't need it here.
2000-03-29 03:05:18 +00:00
ws 7da71e5f9e Make IPKDB working again.
Add support for i386 debugging and pci-based ne2000 boards.
2000-03-22 20:58:25 +00:00
thorpej b58f7c1079 Remove unused global `consintr'. Rob Black, kern/3841. 2000-01-26 07:50:33 +00:00
sommerfeld 8933230897 bitmask_snprintf: avoid returning too soon if we're using the
new-style format.
1999-12-13 01:29:03 +00:00
thorpej 0038e42900 Implement vlog() (varargs version of log()). 1999-08-27 01:14:15 +00:00
thorpej 0b1b32b6ff Make sure the kprintf_slock is initialized, and use the low-level atomic
locking primitive directly to lock it, since those will never attempt
to call printf() to display debugging information (and thus deadlock
on recursion into the kprintf_slock).
1999-07-27 21:50:37 +00:00
thorpej 94962b67c7 Fix some printf format problems on Alpha. 1999-02-12 00:46:11 +00:00
explorer c3167035de no need to set tailp twice. 1999-02-10 18:03:05 +00:00
explorer 47bc7c51b7 rewrite usage of tailp slightly, to convince gcc that it really isn't used
initialized.
1999-02-06 11:57:35 +00:00
msaitoh de35d7228d fix compiler warning 1999-02-03 01:16:20 +00:00
msaitoh a01e3cd255 Implement [v]snprintf() 1999-01-28 00:05:49 +00:00
drochner 846db6691a make console_debugger() a macro - no need to waste a stackframe 1999-01-26 17:05:41 +00:00
jonathan 3ac3cbcfb8 Add options DDB_FROMCONSOLE and sysctl ddb.fromconsole, analagous to
DDB_ONPANIC. Lets user ignore breaks but enter DDB on panic.  Intended
for machines where debug on panic is useful, but DDB entry is not,
(public-access console, or terminal-servers which send spurious breaks)

Add new ddb hook, console_debugger(), which decides whether or not to
ignore console ddb requests. Console drivers should be updated to call
console_debugger(), not Debugger(), in response to serial-console
break or ddb keyboard sequence.
1998-10-29 21:22:32 +00:00
thorpej d46253f21c Implement vsprintf(). 1998-09-29 21:03:02 +00:00
thorpej 73aefe65bc If MULTIPROCESSOR, add a spin lock around the kernel printf (in the
appropriate places).  This makes debugging messages work a LOT better
on my multiprocessor Alpha.
1998-09-29 01:49:43 +00:00
pk 818fef1cd7 Nuke spurious pointer incrementation. 1998-09-12 13:12:14 +00:00
mrg 69f13c5156 minor KNF nit 1998-08-31 02:47:00 +00:00
pk 9e744b8155 Merge Chris Torek's new `%b' bit-field format into bitmask_snprintf(). 1998-08-23 22:42:32 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
jonathan 466e784ee1 defopt DDB. 1998-07-04 22:18:13 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
ross 3877611a5c Put it back the way it was. 1997-11-17 00:59:56 +00:00
ross 42046e9698 A new kprintf was imported on 10/24, and it will cause a kernel panic
whenever the %: format is used on NetBSD/Alpha. Disable %: for __alpha__.
Note: the "correct" (but untested on other architectures) fix is to
change the wrong: kprintf(cp, oflags, tp, NULL, va_arg(ap, va_list));
    to the right: kprintf(cp, oflags, tp, NULL, ap);
1997-11-15 09:27:33 +00:00
chuck 94fa91f862 import chris torek's vfprintf() from libc [renamed to kprintf and all
floating point stuff removed].

the new kprintf replaces the 3 different (and buggy) versions of
printf that were in the kernel before (kprintf, sprintf, and db_printf),
thus reducing duplicated code by 2/3's.   this fixes (or adds) several
printf formats.  examples:
 %#x   - previously only supported by db_printf [not printf/sprintf]
 %8.8s - printf would print "000chuck" for "chuck" before
 %5p   - printf would print "0x    1" for value 1 before

XXX: new kprintf still supports several non-standard '%' formats that
are supposed to eventually be removed:
  %: - passes an additional format string and argument list recursively
  %b - used to decode error registers
  %r - int, but print in radix "db_radix" [DDB only]
  %z - 'signed hex' [DDB only]
  %n - unsigned int, but print in radix "db_radix" [DDB only]

note that DDB's "%n" conflicts with standard "%n" which takes the
number of characters written so far and stores it into the integer
indicated by the "int *" pointer arg.  yuck!

while here, add comments for each function explaining what it is
supposed to do.
1997-10-24 18:14:25 +00:00
leo d4713d24c2 Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
1997-09-19 13:52:37 +00:00
thorpej 6043eb7d80 Avoid running off the end of the format string if the caller botched
the format modifer.  Reported by and suggested fix from Daniel G. Pouzzner
in PR #2633.  Final fix is slightly different now that we support the %q
modifier.  This fix also includes the equivalent fix for sprintf().
1997-06-26 05:17:45 +00:00
thorpej e14025e742 If KGDB is defined, pull in <sys/kgdb.h> for prototypes. 1997-06-26 00:43:10 +00:00
drochner a52a25467d Implement quad_t (%qx, %qd, %qo) printf formats.
Closes pr kern/3747.
1997-06-16 15:02:27 +00:00
thorpej 5ca650f210 XXX Kludge for PowerPC; needs a kernel vfprintf(). 1997-04-17 00:06:28 +00:00
gwr 37b247edde Renames: /dumpconf/cpu_dumpconf/, /boot/cpu_reboot/ 1997-03-26 22:42:13 +00:00
thorpej 1dc6efd7e6 Only call Debugger() on panic if "db_onpanic" is set. 1997-01-09 05:38:22 +00:00
thorpej 156e926117 Implement bitmask_snprintf(), which takes a value and a string
representing the names of those bits, prints them into a buffer
provided by the caller, and returns a pointer to that buffer.
Functionality is identical to that of the (non-standard) `%b' printf()
format, which will be deprecated.

Rename the non-exported function ksprintn() to ksnprintn(), and change
it to use a buffer provided by the caller, rather than at static
buffer.
1996-11-13 06:06:05 +00:00
gwr f5927ca260 Minor nit in my change regarding const and non-ansi code... 1996-10-27 21:50:33 +00:00
gwr 2ada6af51b Oops, part of that last commit was not meant to go in.
The definitions of va_alist, va_dcl belong elsewhere.
1996-10-27 20:50:00 +00:00
gwr a0d9bd5bb2 The hack-ish tricks to make the ANSI-style va_start macro work in
non-ANSI mode were not quite complete.  This makes non-ANSI work.
Perhaps it would be better to eliminate this hack altogether...
1996-10-27 20:30:52 +00:00
cgd ca829ca73c don't assign non-const pointers from const pointers; make the appropriate
pointers 'const'.  (-Wcast-qual)
1996-10-25 22:01:44 +00:00
ws 31bdb14ed5 Rename recently checked in KGDB to IPKDB to resolve conflicts with older KGDB 1996-10-16 19:32:08 +00:00