Commit Graph

540 Commits

Author SHA1 Message Date
christos 6aaa2a926a include stddef.h for offsetof 2011-12-31 22:42:25 +00:00
christos 42c420856f - fix offsetof usage, and redundant defines
- kill pointer casts to 0
2011-12-31 20:41:58 +00:00
christos b799360e83 If we are DIAGNOSTIC don't try to go further if we failed to take the
lock, because we are going to trigger a KASSERT. Also hold the lock
longer and take the proc lock for kpsignal(). Maybe we should add
mutex_steal() and mutex_return() for the debugger? Lock correction
suggestion from jmcneill.
2011-12-03 16:25:49 +00:00
christos d5b7cb3520 deal with the proc_lock mutex. 2011-12-02 23:57:58 +00:00
mrg c09a267949 set panicstr to "reboot forced via kernel debugger" when rebooting
from ddb, similar to how sync from ddb works.

this avoids various asserts and other issues during ddb reboot.
2011-11-13 03:21:51 +00:00
jym 0f329bf765 Like ddb(4) "ps/l", use '>' sign to indicate running LWPs for the /w
modifier.
2011-10-23 13:30:20 +00:00
uebayasi 3abce800c0 Define SYMTAB_SPACE in opt_ksyms.h, not opt_ddbparam.h. Ensure
that ddb(4) code is independent of SYMTAB_SPACE value.
2011-07-28 13:42:16 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
rmind e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
christos 4d927829db re-instate db_kill_proc 2011-05-31 03:40:22 +00:00
joerg a2bf8e5d19 Introduce DDB_EXPR_FMT and replace the logic around DB_EXPR_T_IS_QUAD. 2011-05-26 15:34:12 +00:00
mrg 8169e46991 move and rename the uvm history code out of uvm_stat to "kernhist".
rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories.  this is mostly just
  allocating something in a bitmap, and is only for viewing multiple
  histories in a merged form.


tested on amd64 and sparc64.
2011-05-17 04:18:05 +00:00
nakayama 20cb9e7fb5 Fix GENERIC_SUN4U build. 2011-04-12 17:46:38 +00:00
mrg a057421714 include <sys/cpu.h> when using cpu specific info. fixes building
these as part of sparc64 crash(8).
2011-04-12 08:42:12 +00:00
mrg 56326562d4 avoid compiling dead code into crash. 2011-04-11 04:26:18 +00:00
mrg 07a98cd33f obsolete DB_AOUT_SYMBOLS. however, we need to leave most of the code
in db_sym.[ch] as it is used by the elf version of crash(8).

i will be cleaning up the db_sym.c code in a follow up commit to avoid
having dead code compiled.
2011-04-11 04:22:30 +00:00
christos 2a672d40b3 Add:
usage: show proc [/a] [/p] address|pid
        /a == argument is an address of any lwp
	/p == argument is a pid [default]
From: Vladimir Kirillov proger at wilab dot org dot ua
2011-04-10 20:59:22 +00:00
hannken 4e993c9545 When looking for the next element of cpu_queue compare the pointer to the
address of the head, not to the head itself.  Not sure if the cast of the
arg to db_value_name() is right, but works on i386 and compiles on sparc64.

Stack traces from ddb work again on i386.
2011-02-20 10:24:45 +00:00
matt dfed083ad4 Since curlwp and curproc must always be non-NULL, remove the == NULL branches. 2011-02-09 18:24:44 +00:00
rmind 7146b2f61d Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete.  Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
2011-01-14 02:06:22 +00:00
drochner a1f59518fb fix extern/static inconsistency 2010-09-13 08:42:04 +00:00
enami 5de383f454 Define db_hist_put() only when DDB_HISTORY_SIZE != 0 so that
build successes on ports like hpcarm.
2010-08-31 07:48:23 +00:00
enami a8a2c06f4b Fix indent in prevous commit. 2010-08-31 07:12:55 +00:00
tls 4e9aaafe62 Don't overflow DDB command history. Coyote Point changelist description:
DDB is flakey.  The command history wanders past the bounds.  Way
past.  When it hits some boolean that indicates a.out format symbol
tables are to be used, and here is the pointer to the function, the
call thru the NULL function pointer renders the debug session entirely
unsatisfactory, outcome wise.
2010-08-30 19:23:25 +00:00
tron 370c0f3c62 Include "ctype.h" in the central place which deals with building the
kernel debugger as a userland program.
2010-02-02 09:04:14 +00:00
tron 4fe91a715f Include "ctype.h" if we are not building a kernel to fix the build
of crash(8).
2010-02-01 09:56:58 +00:00
phx cc35ab39e9 New modifiers for the "write" command: /BHL. They act like /bhl but do not
read the old value from memory before writing.
2010-01-31 21:52:23 +00:00
rmind 1069745866 Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys/user.h inclusions. 2009-12-17 01:25:10 +00:00
bsh 1c34311d57 quick fix for crash(8) build failure caused by my previous commit (rev
1.20).

The problem was reported Ty Sarna and Geoff Wing.  Thanks.

XXX: I made #if too messy. split db_access.c into two files for
db_{get,put}_values and db_read_{int,ptr}?
2009-09-28 05:53:37 +00:00
bsh 35bc16c502 kgdb still needs db_{get,put}_value in ddb/db_access.c when SOFTWARE_SSTEP is defined in db_machdep.h. 2009-09-27 18:24:23 +00:00
rmind 6227d22ed0 Add #ifdef MQUEUE for db_show_mqueue_cmd().
XXX: Wrong.  DDB should be dynamic, modular, etc.
2009-07-19 02:37:33 +00:00
mrg 06dd613f03 extend 'show event' to take /i /t and /m modifiers, to select interrupt,
trap or misc event types.  you can mix them with /f as well, to show all
including zero events for traps and misc, "show event/ftm"
2009-06-05 04:31:47 +00:00
ad d991fcb3b6 More changes to improve kern_descrip.c.
- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
  It was only being used to synchronize close, and in any case we needed
  to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
  that we can eliminate the membar_consumer() call in fd_getfile().  This is
  mostly syntactic sugar; the main functional change is that fd_nfiles now
  lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.
2009-05-24 21:41:25 +00:00
ad 9f19801f75 add boilerplate missed in initial commit 2009-04-10 22:29:30 +00:00
reinoud 49f0ea0bd0 KGDB does no longer refers to ddb/db_access. Fixes compilation problems of KGDB
kernels.
2009-03-31 15:50:45 +00:00
ad 912b4160fd Make 'show event', 'dmesg' work with crash(8).
XXX dmesg fails exactly the same way as /sbin/dmesg.
2009-03-21 13:06:39 +00:00
dsl 454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl 02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
martin 7d53797861 Switch the default value (if no options DDB_ONPANIC is defined) for
ddb.onpanic to 1, change it back to 0 in sysctl.conf and make sure
postinstall installs this setting.
This avoids us trying to dump while booting from install CD, but keeps
the default the same once we are far enough through /etc/rc.d. Failing
earlier is unlikely to be recovered by an automatic reboot.
OK: core.
2009-03-11 23:22:57 +00:00
nakayama 3a99fdb328 Avoid "warning: cast from pointer to integer of different size"
on 32-bit sparc64 kernels.
2009-03-11 13:29:44 +00:00
mrg d2ea53a056 include <stdbool.h> if not _KERNEL, and don't include kauth.h if _KERNEL.
now crash builds on i386.
2009-03-09 06:07:05 +00:00
mrg e4d97b1066 include <sys/user.h> 2009-03-08 11:41:47 +00:00
mrg 4540375faf include ddb headers *after* sys/types.h or sys/param.h. 2009-03-08 11:40:00 +00:00
ad cd6b1c8f08 Make ddb compile and work in userspace. Mostly this is comprised of three
types of changes:

- Add a few new methods to replace stuff like p_find(), CPU_INFO_FOREACH.

- Use db_read_bytes() instead of accessing kernel structures directly,
  and similar changes.

- Add ifdef _KERNEL where the above hasn't been done, and an XXX comment.
2009-03-07 22:02:16 +00:00
haad 87b8a8844f Do not set last_count to zero after every db_command function call it is
static variable. This should fix PR 40712.
2009-03-01 12:13:12 +00:00
yamt f68e4571e5 - fix vmem unittest. rename VMEM_DEBUG so that it won't be abused again.
- reimplement vmem sanity checks with less code duplication.
- reimplement ddb vmem-related commands in a more consistent ways.
  remove automatic whatis.
2009-02-18 13:31:59 +00:00
ad 563a207d33 Default 'show all procs' to /l. People tend to type 'ps' without modifiers
when providing information about deadlocks. Without the thread info it's
not very useful.
2009-02-04 20:17:58 +00:00
ad 6e89a762d6 Default DDB_ONPANIC to zero. The end product is ultimately for the
consumption of users external to the project, users who are unlikely to
be kernel hackers with the motivation to debug crashes. In this situation
rebooting and creating a crash dump is more appropriate than interrupting
normal service for an unbounded amount of time, while also leaving the
machine at cryptic db> prompt.
2009-01-30 21:30:56 +00:00
haad 128703a537 Fix my bug introduced in rev 1.98 of db_command.c where command prefix
not ambiguous in one table was choosed even if it was ambiguous in another
table in same list. Also apply more KNF rules.

Patch was supplied by uwe@.
2009-01-05 22:19:40 +00:00
cegger 10de0e2b14 ddb: new 'show vmem' and 'show all vmems' commands.
Useful to inspect vmem(9) structures.
2008-12-07 00:51:15 +00:00
martin 719a906ef5 As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
2008-11-30 18:21:31 +00:00
nakayama 4cb83f9c6e Make DDB shows right register values on 32-bit sparc64 kernels.
- define db_expr_t as int64_t.
- %gsr is 32-bit, so use db_sparc_intop.
- sync arguments with function prototype.
- ansify.
2008-11-25 15:41:11 +00:00
ad 31afc5b6d8 Add some basic DDB stuff for modules. 2008-11-25 15:14:07 +00:00
pooka 010ce4930e more <sys/buf.h> police 2008-11-16 19:34:29 +00:00
ad 13de59a192 ifdef AIO 2008-11-14 23:37:50 +00:00
ad 9b83143a6a +ifdef AIO
XXX ddb needs a way to register commands at runtime!
2008-11-14 23:37:30 +00:00
christos bc44c7d780 don't hold locks in ddb (call ksyms_getval_unlocked()), pointed out by ad. 2008-10-24 13:55:42 +00:00
rmind 97561001a3 Replace more intptr_t to uintptr_t when casting VA. 2008-10-03 14:52:11 +00:00
rmind 03fe669395 - Fix message queue permissions problems.
- Rake into account umask when creating mqueue.
- Restore DDB command, which was accidentally lost (hi martin).
- Misc.
2008-09-29 10:27:53 +00:00
skrll 3ceaf8f8e4 Make "show uvmhist" available to all arches (not just sparc*) in ddb. 2008-08-08 17:09:28 +00:00
blymn a7db4edf3b Take care not to dereference NULL datapointer from fd table
Make output more readable and label what lock we are examining.
2008-07-14 10:15:11 +00:00
blymn 380be0c111 Fix indents. 2008-07-10 13:28:23 +00:00
blymn 8a19e9911c Add a show files command that prints the vnodes associated with a
given struct proc and, if LOCKDEBUG is built in, the lock status of
the uvmobject.
2008-07-10 12:42:24 +00:00
blymn 8070795214 Whitespace clean up. 2008-07-10 12:38:28 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
uwe aece9113ff Fix CS_MACH definition. 0x10 is spelled 0x10, not 0x16. 2008-03-27 01:15:15 +00:00
uwe cff5aa6f0d Fix help string for "w" - it is "write" not "watch". 2008-02-21 02:07:45 +00:00
martin d5ed42ea19 When doing a reboot from ddb, set panicstr, so that later LOCKDEBUG checks
show the same mercy as with a real panic.
2008-02-02 18:16:42 +00:00
perry b6a2ef7569 Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
2007-12-25 18:33:32 +00:00
yamt 0c38201391 add ddb "whatis" command. inspired from solaris ::whatis dcmd. 2007-12-13 02:45:09 +00:00
ad 8838af190c ps/w: display LWP info. 2007-12-02 19:35:33 +00:00
martin e6116bac33 Add a missing "else". Should finally fix PR kern/37110. 2007-11-14 12:05:42 +00:00
martin bb436049fc Pacify some gcc uninitialized warnings at -O3 2007-10-22 00:36:28 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
uwe 85dcbb2bb9 db_cmd_search: When we compare names we'd better stop at the nul byte.
Don't flip-flop between found and ambiguous.  (hi, martin!)
2007-10-14 00:37:56 +00:00
martin 28da38cbee Fix command name matching, avoid jumps to null function pointers and
some minor cosmetics.
2007-10-12 09:53:07 +00:00
martin cd2cd2dd63 Do another setjmp right before entering the command loop, we do not want
to execute the on-enter commands again on errors.
2007-10-08 15:06:26 +00:00
martin 9b58206ecf Some cleanup:
- When registering command tables, make sure the builtin commands are
   already registered
 - Make the command table entry structure private
 - Do not bother to store the number of commands in a table, we can quickly
   calc that if needed.
2007-10-02 08:47:26 +00:00
martin cadfc6aaa0 No need to db_init_commands() early any more - it will happen on first
entry to ddb.
2007-10-01 22:05:15 +00:00
martin 463076317b Special case the initialization of builtin command tables to avoid using
malloc. Fixes PR kern/37042.
Allow "mach" commands registered by LKMs even if there is no builtin
mach command for the arch.
2007-10-01 22:01:38 +00:00
martin 34bb6e19fd Minor clenaup - db_cmd_loop_done is a bool nowadays, so use true/false
instead of 0/1.
Also make db_init_commands() non-static.
2007-09-23 23:55:54 +00:00
martin 99423a9d7c Simplify the "tables are already setup" test.
Print a message on unknown commands (as we used to do before) and get rid
of the now unused macro previously used for that.
2007-09-23 19:51:20 +00:00
martin ad21af77ef Fix build for archs w/o DB_MACHINE_COMMANDS.
Patch from KIYOHARA Takashi.
2007-09-23 18:59:23 +00:00
martin 534e445285 Add missing argument - fixes compilation if KGDB is defined. 2007-09-23 10:26:06 +00:00
martin d9a407bba2 Add a new option DDB_VERBOSE_HELP that adds online help to ddb.
From Adam Hamsik.
Minor modifications by me, all bugs are probably mine.
2007-09-22 18:40:20 +00:00
rmind 2cecf9bbe9 Implementation of POSIX message queues.
Reviewed by: <ad>, <tech-kern>
2007-09-07 18:56:02 +00:00
dsl 5afdebabb4 include cdefs.h before opt_xxx.h 2007-07-19 21:54:51 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
yamt f03010953f merge yamt-idlelwp branch. asked by core@. some ports still needs work.
from doc/BRANCHES:

	idle lwp, and some changes depending on it.

	1. separate context switching and thread scheduling.
	   (cf. gmcgarry_ctxsw)
	2. implement idle lwp.
	3. clean up related MD/MI interfaces.
	4. make scheduler(s) modular.
2007-05-17 14:51:11 +00:00
rmind 67d703cf25 Import of POSIX Asynchronous I/O.
Seems to be quite stable. Some work still left to do.

Please note, that syscalls are not yet MP-safe, because
of the file and vnode subsystems.

Reviewed by: <tech-kern>, <ad>
2007-04-30 14:44:28 +00:00
thorpej 4f3d5a9cc0 TRUE -> true, FALSE -> false 2007-02-22 06:34:42 +00:00
matt 93feeb1203 Fix lossage from boolean_t -> bool and updated x86 bus_dma. 2007-02-22 04:38:02 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
uwe 40ada7179f ANSIfy db_error. 2006-09-05 21:56:44 +00:00
uwe 7c918c612d Mark db_error __attribute__((__noreturn__)). 2006-09-05 21:52:11 +00:00
christos f9f4c63527 fix incomplete initializer. 2006-08-30 00:00:15 +00:00
elad 874fef3711 integrate kauth. 2006-05-14 21:19:33 +00:00
he 34b3f04168 Move declaration up ahead of active code in the function, so that
this can be built again with gcc 2.95.3, as used by vax.
2006-05-14 14:00:17 +00:00
christos 103d2f520c XXX: GCC uninitialized. 2006-05-14 05:30:31 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
christos 0830ad8bf0 Coverity CID 1094: Protect against NULL deref. 2006-04-14 22:06:41 +00:00
he f2b7814ebc Now that BKPT_SET takes two arguments, supply the second argument. 2006-04-02 00:57:30 +00:00
bjh21 ed2f09f139 Add a "show all pages" command to DDB which prints one line per physical
page in the system.  Useful for getting some idea where all your memory's
gone, at least on a sufficiently small system.
2006-02-19 18:52:29 +00:00
yamt e8a3b3eb83 add ddb "sh mbuf" command. 2006-01-24 13:02:57 +00:00
uwe adcd5c2d11 db_show_sched_qs: fix pointer cast lint considers troublesome. 2006-01-22 01:08:50 +00:00
uwe 19707b27a5 Add /l to show all procs usage. 2006-01-22 00:50:51 +00:00
uwe 91321511a9 This is not IOCCC. Replace " >"[cp == p] with conditional expression.
Makes lint happy.  Probably generates better code too (does on sh3).
2006-01-22 00:47:50 +00:00
uwe 0df816cb4b Add CONSTCOND to DB_EXPR_T_IS_QUAD. 2006-01-21 01:11:43 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
he 1067be953e After addition of "show all pools", we now need <sys/pool.h> here.
Fixes build problem for mac68k.
2005-12-03 22:47:25 +00:00
yamt a004e1d63c add "show all pools" command for ddb. 2005-12-01 13:21:05 +00:00
thorpej 3a29afcd5e Move DDB files to files.ddb
XXX couple of kgdb references -- clean up later
2005-11-27 22:44:35 +00:00
yamt 3afdabd868 make DDB_COMMANDONENTER sysctl. (ddb.commandonenter)
suggested by Christos Zoulas.
2005-11-27 13:05:28 +00:00
yamt ac41acf302 add a new option DDB_COMMANDONENTER.
which can be useful for eg. broken console input.
2005-11-26 12:16:44 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
drochner 7005d4ef81 make the argument of db_write_bytes const (sorry for the signature change) 2005-06-01 15:57:23 +00:00
drochner 4d205d8853 more constification fallout 2005-06-01 12:25:27 +00:00
jhawk a74233676c minor updates: vax port kludge is in trace, not kill. spelling.
no 0t output in ps.
2005-05-30 05:58:52 +00:00
christos 02e608f6b8 Add lots of const. 2005-05-29 21:31:05 +00:00
yamt 8ca4d66b5e move decl of db_machine_command_table from db_interface.h to db_command.c
to avoid an array of incomplete type.  found by gcc4.
2005-04-29 10:40:16 +00:00
christos 23b9ddb316 remove stray error(1) comment. 2005-03-28 01:05:13 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +00:00
cube 9367bbf87b The way I handled /dev/ksyms requests vs. kernel requests was completely
broken.  Inside the kernel, we always have to use the real values of the
st_name fields, and only do the math when the request comes from userland.

No need for ksyms_getval_from{kernel,userland} hack anymore.  However, a
different version will be asked for pull-up in -2{,-0}, one that doesn't
break the API, that is.

Fixes PR#29133 from Jens Kessmeier.
2005-02-15 21:09:57 +00:00
chs bb5a198f3d reduce db_maxoff from 256MB to 1MB, that should be plenty. 2005-01-16 23:38:47 +00:00
reinoud 22f1132820 Implement ddb setting that allows all ddb output to be teed into the
kernel message buffer/log. Its off by default and can be switched on in the
kernel configuration on build time, be set as a variable in ddb and be set
using sysctl.

This adds the sysctl value
	ddb.tee_msgbuf = 0
by default.

The functionality is especially added and aimed for developers who are not
blessed with a serial console and wish to keep all their ddb output in the
log. Specifying /l as a modifier to some selected commands will also put
the output in the log but not all commands provide one nor has the same
meaning for all commands.

This feature could in the future also be implemented as an ddb command but
that could lead to more bloat allthough maybe easier for non developpers to
use when mailing their backtraces from kernel crashes.
2004-09-29 23:54:11 +00:00
reinoud 8faf51b906 Note that point 32 (ddb output to msgbuf) is Work In Progress and is about
to be committed after more testing and cleanup/review.
2004-09-28 23:02:58 +00:00
reinoud ce5f43b0de Add an item to help developers without serial consoles. 2004-09-28 19:54:27 +00:00
nathanw 0ac1c38100 Make ddb's "show sched_qs" aware of big-endian sched_qs arrangements. 2004-07-27 02:15:07 +00:00
atatat d37080bc2f Sysctl descriptions under ddb subtree 2004-05-25 04:31:48 +00:00
atatat 1ee5d694aa That's not supposed to be there. Sorry. 2004-04-27 04:03:28 +00:00
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
dbj 6a88e9174b add "show mount" ddb command 2003-11-18 18:26:18 +00:00
cube d3730f1c68 o Fix a bug in ksyms that changed the real meaning of st_name entries for
symbols, and made it impossible for the kernel to use that value, and
  correctly find symbols from LKMs.
o Allow LKM users to use DDB to debug the entry function of a LKM by
  loading the symbol table with the temporary name /lkmtemp/ before calling
  it, and then renaming it once we know the module name.

Approved by ragge@.
2003-11-17 10:16:18 +00:00
scw c55851c88b Fix format string warnings for platforms where
sizeof(db_addr_t) > sizeof(long). e.g. ILP32 on sh5.
2003-11-09 20:52:18 +00:00
christos fe659fa011 fix uninitialized variable 2003-10-25 08:48:11 +00:00
chs d2266994e2 add "b" as a synonym for "break", since someone added "bt"
and made "b" an ambiguous prefix.
2003-10-10 15:21:24 +00:00
scw 5efdd1f9f3 Tweak the previous change to ensure symbol addresses are correctly
sign-extended on cpus with 64-bit registers.
2003-10-05 11:17:47 +00:00
thorpej c7a178e4a9 Add a "show sched_qs" command to dump the run queues. Format is:
1	pid.lid (p_comm)
	pid.lid (p_comm)
 ...

If a queue has procs, but no sched_whichqs bit, it shows:
!1	pid.lid (p_comm)
2003-09-20 03:02:03 +00:00
uwe ca90f34170 Widen FLAGS column for ps/l so that all defined l_flag flags fit. 2003-09-07 14:14:36 +00:00
ragge 65e8bb870b long -> unsigned long, so that correct pointer is sent in function call. 2003-09-03 10:45:10 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
simonb c9bc6f3a9a Allow the dmesg command to show the last N bytes of the kernel message
buffer.
2003-07-02 07:05:29 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
briggs 819d74ccf1 Somehow overlooked in earlier commits: prototype db_kgdb_cmd(). 2003-05-22 20:17:11 +00:00
scw 66cf68c402 On some platforms, sizeof(db_expr_t) > sizeof(long), so add a method
to select the right format string (at compile time) when displaying
variables of type db_expr_t.

This fixes a problem where ddb(4) would only display the low 32-bits
of registers for an ILP32 kernel on SH5, even though registers
(and db_expr_t) are always 64-bits wide.
2003-05-17 09:58:03 +00:00
scw 273f50f75f Don't assume sizeof(db_expr_t) == sizeof(long).
Ditto for sizeof(db_addr_t), although I don't think this
one is currently an issue.
2003-05-17 09:48:05 +00:00
kristerw 96059deea7 Add a cast to make this build with -D__AUDIT__. 2003-05-17 00:28:44 +00:00
itojun f9121aada7 switch to use strlcpy() from libkern. 2003-05-16 16:28:30 +00:00
itojun d4074ff0ab use strlcpy [change prototype of db_symstr to pass size_t; noone seem to use it] 2003-05-16 15:02:08 +00:00
atatat b5329c1d85 (1) Don't print the message buffer (via ddb's dmesg command) if the
message buffer has not yet been set up, mimicking code from the top of
the sysctl routine for retrieving the message buffer.

(2) Add a /l modifier to the trace command.  This makes it print the
backtrace using printf() instead of db_printf(), which has the nice
side-effect of also putting it into the message buffer.  A kernel with
ddb in it but disabled (ie, ddb.onpanic set to zero) will print a
backtrace (which ends up in the message buffer) before dumping (or
not, depending on the value of kern.dump_on_panic) and rebooting, but
if ddb is not disabled, the backtrace is not printed, and there's no
way to get it to display a backtrace such that you can retrieve it
after the dump.  The backtrace printed by gdb is sometimes a little
different.

(3) Documentation for the above.
2003-05-15 13:18:18 +00:00
jdolecek d17c485917 make couple ksym functions' arguments const 2003-05-11 08:23:22 +00:00
scw 8c5c893bf7 Add a BKPT_ADDR() macro which gives MD code a chance to munge a
breakpoint address before it's used. Currently a no-op on all but sh5.

This is useful on sh5, for example, to mask off the instruction
type encoding in the bottom two address bits, and makes it possible
to do "db> break $rXX" instead of manually munging the address.
2003-04-29 17:06:03 +00:00
ragge 797b42a988 By accident db_symstr() was removed, which Håvard pointed out.
Readded now.
2003-04-28 15:55:45 +00:00
briggs e2391a87b6 Add a rudimentary 'trap to kgdb' command if KGDB is defined. This allows
systems with only one serial port for console, etc., to have at least some
basic access to remote-kgdb-over-serial, even if it is a bit awkward.
2003-04-28 02:49:54 +00:00
ragge cddfd23e42 Mobe the SYMTAB_SPACE stuff to ksyms_init, so that it can be used without
DDB compiled-in.
2003-04-25 20:30:57 +00:00
ragge e675595289 db_sym_numargs() disappeared by mistake, restore it. 2003-04-24 21:18:34 +00:00
ragge 4ee3d47c73 Teach DDB to use ksyms instead of it's own symbol table management.
Note: For a.out kernels (beware!) DDB will still use the old stuff.
2003-04-24 20:00:48 +00:00
jdolecek 054da0dc1b make parameter 'name' for db_del_symbol_table() const 2003-04-16 09:00:29 +00:00
enami 0f4835d18b Don't specify string width in the low level function like db_num_to_str.
The pretty printing should be done much higher level, and anyway the
value 10 doesn't make sense.
2003-03-02 13:39:40 +00:00
jmc 1ed82b5b2c Add a synonym for trace - 'bt' and document it 2003-02-13 23:50:33 +00:00
thorpej 1b84adbe5f New callout implementation. This is based on callwheel implementation
done by Artur Grabowski and Thomas Nordin for OpenBSD, which is more
efficient in several ways than the callwheel implementation that it is
replacing.  It has been adapted to our pre-existing callout API, and
also provides the slightly more efficient (and much more intuitive)
API (adapted to the callout_*() naming scheme) that the OpenBSD version
provides.

Among other things, this shaves a bunch of cycles off rescheduling-in-
the-future a callout which is already scheduled, which the common case
for TCP timers (notably REXMT and KEEP).

The API has been simplified a bit, as well.  The (very confusing to
a good many people) "ACTIVE" state for callouts has gone away.  There
is now only "PENDING" (scheduled to fire in the future) and "EXPIRED"
(has fired, and the function called).

Kernel version bump not done; we'll ride the 1.6N bump that happened
with the malloc(9) change.
2003-02-04 01:21:03 +00:00
pk 58005dc9d3 Zombie procs have no lwps. 2003-01-23 12:41:33 +00:00
simonb bbd9776970 Remove variable that is only assigned too but not referenced. 2003-01-20 07:20:01 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +00:00
yamt 64f7cc2afc make stack trace on i386 work again.
(signed vs unsigned)
2002-11-13 05:59:28 +00:00
thorpej 1f8b8e3411 Avoid a GCC 3.3 strict alias warning. 2002-11-10 03:24:51 +00:00
thorpej aaf0f03bd6 Fix signed/unsigned comparison warnings. 2002-11-10 03:22:28 +00:00
thorpej 50d19d9171 Fix signed/unsigned comparison warnings. 2002-11-10 03:12:17 +00:00
itohy 94b2e6e61d Dump DDB_* and SYMTAB_SPACE options to opt_ddbparam.h rather than opt_ddb.h.
These options are used in limited files but #include "opt_ddb.h" are
everywhere, and changing them caused almost full recompilation.
2002-11-04 06:24:38 +00:00
perry 6858187df6 /*CONTCOND*/ while (0)'ed macros 2002-11-02 07:20:42 +00:00
scw f7982b5823 Another item on the TODO list:
Add support for cpus where sizeof(register_t) is not necessarily
	the same as sizeof(void *). This is the case on SH5 using the
	ILP32 ABI. On this cpu db_expr_t is, necessarily, 64-bits.
	Unfortunately, in ILP32 mode, ddb will only display the low 32-bits
	of any expression, including registers...
2002-08-26 11:35:22 +00:00
scw a82718b34d Casting from a pointer, to a db_expr_t, has to go via an intptr_t.
(db_expr_t == int64_t on sh5, for example).
2002-08-26 11:34:27 +00:00
drochner 49c4cfb2c5 provide a db_vprintf() which is exactly what the name suggests 2002-06-05 17:53:52 +00:00
matt 98b5a4329f Add db_recover 2002-05-13 20:17:20 +00:00
simonb 14ac06f0bd Add a "show event" ddb command to show the event counters. 2002-02-15 11:18:26 +00:00
simonb 4eaa4d66a8 ANSIfy, KNF.
Make some variables and functions static when not used outside of a module.
Make variables in headers extern.
Delete the unused db_find_watchpoint() function.
2002-02-15 07:33:48 +00:00
jhawk 73c2346377 Add db_symstr(), a parallel interface to db_printsym() that
writes to a string rather than outputs to the supplied printer.
This is convenient for disassemblers that are structured to
build a long string and print it later.

Perhaps db_printsym() should be changed to use this interface...
2002-01-05 20:09:52 +00:00
jhawk 605db0bb09 ddb(9) 2002-01-05 01:48:10 +00:00
jhawk a21d1ea7ac Convenience variables (workXX) don't work, so don't document them. 2001-12-31 00:35:21 +00:00
lukem 99bccc3cab - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
	KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
	DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for  options KGDB_DEVNAME="\"com\""
- use correct quotes for  options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
2001-11-20 08:43:19 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem 1ac69d9cb3 add RCSIDs 2001-11-12 22:54:03 +00:00
thorpej 47514a31be Remove unneeded declarations of the db_machine_init() function. The
ARM ports are the only ones that actually have one, and it is about
to change.
2001-11-09 06:52:23 +00:00
christos e415081a60 PR/14498: Wesley Chen: Identify loaded modules vs. kernel, because we don't
load the elf header with them.
2001-11-08 15:01:35 +00:00
christos 500d44e36c PR/14498: Wesley Chen: Print a return after enumerating the matching symbols. 2001-11-08 15:00:17 +00:00
bjh21 cabab13edd When setting watchpoints, call pmap_update() for each watchpoint, rather
than at the end, since they may be in different pmaps.  This avoids a null
pointer dereference that was causing panics when resuming from DDB on arm26.
2001-10-13 15:17:38 +00:00
chs 3fb05f05f8 use a for loop instead of goto. 2001-09-15 18:20:53 +00:00
thorpej 16c229ea7c Optimization suggested by Bill Sommerfeld: Keep a hint as to the
"earliest" firing callout in a bucket.  This allows us to skip
the scan up the bucket if no callouts are due in the bucket.

A cheap O(1) hint update is done at callout insertion (if new callout
is earlier than hint) and removal (is bucket empty).  A thorough
refresh of the hint is done when the bucket is traversed.

This doesn't matter much on machines with small values of hz
(e.g. i386), but on systems with large values of hz (e.g. Alpha),
it has a definite positive effect.

Also, keep the callwheel stats in evcnts, so that you can view them
with "vmstat -e".
2001-09-11 04:32:19 +00:00
chris 0e7661f023 Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
2001-09-10 21:19:08 +00:00
thorpej fae2a1befd Add `show malloc' to dump the internal state of the MALLOC_DEBUG code. 2001-08-17 01:00:10 +00:00
bjh21 286faf2070 Extra sanity checking on ELF headers: Make sure the bootloader actually
loaded (or claims to have loaded) everything we need.
2001-07-31 22:31:47 +00:00
bjh21 34c3239d32 Don't depend on the bootloader's having loaded the .shstrtab section
in order to load the symbol table.  Instead of using the sections
called ".symtab" and ".strtab", use the first SYMTAB section (the
ELF spec says there should currently only be one) and the STRTAB
section that's linked to it.  I believe this is more robust, and it
certainly makes life easier for the bootloader.
2001-07-31 19:14:18 +00:00
atatat 124ae5b65c Add an easy way to dump the message buffer from ddb. 2001-07-31 04:28:16 +00:00