summaryrefslogtreecommitdiffstats
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* Place hostnames and similar information fully under the prison system.jamie2009-05-291-1/+0
| | | | | | | | | | | | | | | | | The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible. The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed. Approved by: bz (mentor)
* Prefer prototypes to k&r definitions.imp2009-03-091-12/+6
|
* Collect N identical (or near identical) mkdumpheader() implementations intopeter2008-10-011-26/+2
| | | | one, as threatened in the comment. Textdump magic can be passed in.
* Initialize the DDB command list when initializing DDB so that the basicjhb2008-09-253-3/+4
| | | | | | commands are available from 'boot -d'. Suggested by: dfr
* Make ddb command registration dynamic so modules can extendsam2008-09-152-99/+176
| | | | | | | | | | | | | | | | | | | | | | the command set (only so long as the module is present): o add db_command_register and db_command_unregister to add and remove commands, respectively o replace linker sets with SYSINIT's (and SYSUINIT's) that register commands o expose 3 list heads: db_cmd_table, db_show_table, and db_show_all_table for registering top-level commands, show operands, and show all operands, respectively While here also: o sort command lists o add DB_ALIAS, DB_SHOW_ALIAS, and DB_SHOW_ALL_ALIAS to add aliases for existing commands o add "show all trace" as an alias for "show alltrace" o add "show all locks" as an alias for "show alllocks" Submitted by: Guillaume Ballet <gballet@gmail.com> (original version) Reviewed by: jhb MFC after: 1 month
* Add a missing include which was erroneusly left out from the previousattilio2008-08-181-0/+2
| | | | | | commit. Sponsored by: Nokia
* Bufferize the output for DDB printouts.attilio2008-08-181-15/+87
| | | | | | | | | 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
* Commit step 1 of the vimage project, (network stack)bz2008-08-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | virtualization work done by Marko Zec (zec@). This is the first in a series of commits over the course of the next few weeks. Mark all uses of global variables to be virtualized with a V_ prefix. Use macros to map them back to their global names for now, so this is a NOP change only. We hope to have caught at least 85-90% of what is needed so we do not invalidate a lot of outstanding patches again. Obtained from: //depot/projects/vimage-commit2/... Reviewed by: brooks, des, ed, mav, julian, jamie, kris, rwatson, zec, ... (various people I forgot, different versions) md5 (with a bit of help) Sponsored by: NLnet Foundation, The FreeBSD Foundation X-MFC after: never V_Commit_Message_Reviewed_By: more people than the patch
* Fix software single-stepping: we need to check if the instruction is acognet2008-08-021-1/+1
| | | | | | | return instruction as well, or we'll stop single-stepping as soon as we'll return from a function. MFC after: 3 days
* Print out the container lock when showing the thread state in DDB.attilio2008-06-181-0/+3
| | | | Tested by: benjsc
* Rename debug.ddb.capture.bytes sysctl to debug.ddb.capture.bufoff inrwatson2008-04-251-1/+4
| | | | | | | | | order to match the internal variable name. Add a new sysctl debug.ddb.capture.inprogress to export the inprogress variable. MFC after: 3 days
* enable dynamic addition of "show all" commandssam2008-03-253-2/+15
| | | | MFC after: 3 weeks
* Add a /S mode to DDB "ex" command, which interprets and prints therwatson2008-03-071-0/+6
| | | | | | | | | | | | | | | | 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>
* When killing a user process from DDB, check that the requested signal isrwatson2008-03-071-1/+1
| | | | | | | | > 0 rather than >= 0, or we will panic when trying to deliver the signal. MFC after: 3 days PR: 100802 Submitted by: Valerio Daelli <valerio.daelli at gmail.com>
* Reserve two bytes at the end of the DDB input line in db_readline() torwatson2008-03-071-1/+4
| | | | | | | | | | hold the newline and nul terminator. Otherwise, there are cases where garbage may end up in the command history due to a lack of a nul terminator, or input may end up without room for a newline. MFC after: 3 days PR: 119079 Submitted by: Michael Plass <mfp49_freebsd@plass-family.net>
* When redrawing an input line, count backspaces to get to the beginning ofrwatson2008-03-061-1/+1
| | | | | | | | | | | the input field from the current cursor location, rather than the end of the input line, as the cursor may not be at the end of the line. Otherwise, we may overshoot, overwriting a bit of the previous line and failing to fully overwrite the current line. MFC after: 3 days PR: 119079 Submitted by: Michael Plass <mfp49_freebsd@plass-family.net>
* Use dump_write() instead of direct calls to di->dumper() in textdumps.rwatson2008-01-311-3/+3
| | | | | | | Textdumps already do pretty much the same sanity checking, but abstractions and seatbelts are both useful. MFC after: 2 months
* Increase maximum DDB capture buffer size to 5MB.rwatson2008-01-261-1/+1
| | | | | | PR: 119993 MFC after: 2 months Suggested by: Scot Hetzel <swhetzel at gmail dot com>
* Allow DDB_CAPTURE_DEFAULTBUFSIZE and DDB_CAPTURE_MAXBUFSIZE to berwatson2008-01-261-13/+18
| | | | | | | | | | | | overridden at compile-time using kernel options of the same names. Rather than doing a compile-time CTASSERT of buffer sizes being even multiples of block sizes, just adjust them at boottime, as the failure mode is more user-friendly. MFC after: 2 months PR: 119993 Suggested by: Scot Hetzel <swhetzel at gmail dot com>
* Rename DB_ constants in db_capture.c to DDB_ so that when they arerwatson2008-01-261-16/+16
| | | | | | | | exposed as kernel compile options, they have more meaningful names. PR: 119993 MFC after: 2 months Suggested by: Scot Hetzel <swhetzel at gmail dot com>
* Refine textdump comments slightly.rwatson2008-01-101-10/+12
| | | | MFC after: 3 months
* Add textdump(4) facility, which provides an alternative form of kernelrwatson2007-12-264-3/+634
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dump using mechanically generated/extracted debugging output rather than a simple memory dump. Current sources of debugging output are: - DDB output capture buffer, if there is captured output to save - Kernel message buffer - Kernel configuration, if included in kernel - Kernel version string - Panic message Textdumps are stored in swap/dump partitions as with regular dumps, but are laid out as ustar files in order to allow multiple parts to be stored as a stream of sequentially written blocks. Blocks are written out in reverse order, as the size of a textdump isn't known a priori. As with regular dumps, they will be extracted using savecore(8). One new DDB(4) command is added, "textdump", which accepts "set", "unset", and "status" arguments. By default, normal kernel dumps are generated unless "textdump set" is run in order to schedule a textdump. It can be canceled using "textdump unset" to restore generation of a normal kernel dump. Several sysctls exist to configure aspects of textdumps; debug.ddb.textdump.pending can be set to check whether a textdump is pending, or set/unset in order to control whether the next kernel dump will be a textdump from userspace. While textdumps don't have to be generated as a result of a DDB script run automatically as part of a kernel panic, this is a particular useful way to use them, as instead of generating a complete memory dump, a simple transcript of an automated DDB session can be captured using the DDB output capture and textdump facilities. This can be used to generate quite brief kernel bug reports rich in debugging information but not dependent on kernel symbol tables or precisely synchronized source code. Most textdumps I generate are less than 100k including the full message buffer. Using textdumps with an interactive debugging session is also useful, with capture being enabled/disabled in order to record some but not all of the DDB session. MFC after: 3 months
* Remove duplicate $FreeBSD$ that snuck in.rwatson2007-12-261-2/+0
| | | | MFC after: 3 months
* Add a simple scripting facility to DDB(4), allowing the user torwatson2007-12-267-10/+665
| | | | | | | | | | | | | | | | | | | | | | define a set of named scripts. Each script consists of a list of DDB commands separated by ";"s that will be executed verbatim. No higher level language constructs, such as branching, are provided for: scripts are executed by sequentially injecting commands into the DDB input buffer. Four new commands are present in DDB: "run" to run a specific script, "script" to define or print a script, "scripts" to list currently defined scripts, and "unscript" to delete a script, modeled on shell alias commands. Scripts may also be manipulated using sysctls in the debug.ddb.scripting MIB space, although users will prefer to use the soon-to-be-added ddb(8) tool for usability reasons. Scripts with certain names are automatically executed on various DDB events, such as entering the debugger via a panic, a witness error, watchdog, breakpoint, sysctl, serial break, etc, allowing customized handling. MFC after: 3 months
* Add a new DDB(4) facility, output capture. Input and output from DDB may berwatson2007-12-256-0/+329
| | | | | | | | | | | | | 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
* Make the examine command honor db_pager_quit so you can use 'q' or 'x'jhb2007-10-271-1/+1
| | | | | | at the pager prompt to abort an examine command that spans multiple pages. MFC after: 1 week
* Print the stack bounds of the thread.marcel2007-10-161-0/+2
|
* - Move all of the PS_ flags into either p_flag or td_flags.jeff2007-09-171-1/+1
| | | | | | | | | | | | | | - p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or previously the sched_lock. These bugs have existed for some time. - Allow swapout to try each thread in a process individually and then swapin the whole process if any of these fail. This allows us to move most scheduler related swap flags into td_flags. - Keep ki_sflag for backwards compat but change all in source tools to use the new and more correct location of P_INMEM. Reported by: pho Reviewed by: attilio, kib Approved by: re (kensmith)
* Use FOREACH_PROC_IN_SYSTEM instead of using its unrolled form.delphij2007-01-172-4/+4
|
* Threading cleanup.. part 2 of several.julian2006-12-061-5/+0
| | | | | | | | | | | | | | | | | | | | | | Make part of John Birrell's KSE patch permanent.. Specifically, remove: Any reference of the ksegrp structure. This feature was never fully utilised and made things overly complicated. All code in the scheduler that tried to make threaded programs fair to unthreaded programs. Libpthread processes will already do this to some extent and libthr processes already disable it. Also: Since this makes such a big change to the scheduler(s), take the opportunity to rename some structures and elements that had to be moved anyhow. This makes the code a lot more readable. The ULE scheduler compiles again but I have no idea if it works. The 4bsd scheduler still reqires a little cleaning and some functions that now do ALMOST nothing will go away, but I thought I'd do that as a separate commit. Tested by David Xu, and Dan Eischen using libthr and libpthread.
* Fix the output format of MI ddb watches in 'show watch' on 64-bitjhb2006-11-171-0/+8
| | | | platforms.
* Set up the context for the dbbe_trace callback in the ddb. Otherwise,kib2006-11-061-1/+14
| | | | | | trap caused by backtracing would lead to panic. Noted and reviewed by: bde
* On trap while inside ddb, the trap handler calls kdb_reenter(), thatkib2006-11-021-6/+14
| | | | | | | | | | | | longjmp to the default context. As result, "alltrace" command may be prematurely terminated (without error message). This is happens, for instance, when system is low on memory and referenced page in kernel-mode thread stack is swapped out. Protect "alltrace" against termination on trap by setting temporary kdb_jmpbuf context. Submitted by: Peter Holm
* Make KSE a kernel option, turned on by default in all GENERICjb2006-10-261-0/+4
| | | | | | | kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@
* The powerpc and sparc64 MD `reboot' commands should never have existedbde2006-10-101-1/+10
| | | | | | | | | | | | | | | | | since they just duplicated the MI `reset' command. Instead of removing them, make `reboot' an MI alias for `reboot' since this gives a better way of killing the `r' alias for `reset'. Remove the `registers' command that was used to kill the alias. Turn the powerpc and sparc64 MD `halt' command into an MI command. A copy of sparc64/db_interface.c grew in sun4v just after I found the extra reboot commands. It has not been changed, and is now not identical. Duplicated commands come out duplicated in ddb's online help, but cause large problems when used (e.g., on i386's with 2 halt's and an hwatch, typing h doesn' give the expected message about an ambiguous command, but hangs like the halt command or a looping parseri would).
* Fixed loss of whitespace suppression at ends of lines. Whitespacebde2006-10-101-3/+3
| | | | | | | | | | 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.
* Added some aliases:bde2006-10-081-0/+3
| | | | | | | | | | | | | - `b' is now an official alias for `break'. It used to be an unofficial alias, but this was broken by adding the `bt' alias for `trace'. - `t' is now an official alias for `trace'. It used to be an unofficial alias, but this was broken by adding the `thread' command. - `registers' is now an alias for `show registers'. This is a hack to break the unofficial `r' alias for `reset'. `r' really means `registers' in some debuggers, so I sometimes type it accidentally and am annoyed when it resets the system. A short command shouldn't have such a large effect. Now at least `res' must be typed to disambiguate `reset'.
* Fixed formatting of printing of command tables. WIth the default maxbde2006-10-084-6/+6
| | | | | | | | | | | | | | | 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.
* Fix two nits in the ps header that offset each other making them largelyjhb2006-08-011-6/+6
| | | | unnoticable.
* Some cosmetic tweaks:jhb2006-08-011-10/+10
| | | | | | | | | | - Right justify 'pid' label. - Move the uid column to the right 2 columns so that the 3 process id columns (pid, ppid, pgrp) are grouped together. - Expand the uid column to 5 chars. - Don't indent the tid for multithreaded processes. Requested by: bde (1, 2, 4)
* Disable the pager for 'panic' and 'call' to be paranoid.jhb2006-07-191-0/+2
|
* Simplify the pager support in DDB. Allowing different db commands tojhb2006-07-126-59/+47
| | | | | | | | | | | | | | | | 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.
* Never zero-out db_last_symtab. Whan backtraces are donekib2006-06-161-1/+0
| | | | | | | | | in parallel in several threads, one symbol lookup could clear db_last_symtab when another one going to use it as starting point for traversal. Approved by: pjd (mentor) MFC after: 1 month
* Use __LP64__ rather than the PTR64 hack.jhb2006-05-111-14/+3
| | | | Suggested by: ru
* Sort includes.jhb2006-04-271-2/+2
|
* A whitespace fix.jhb2006-04-271-1/+1
| | | | Submitted by: bde
* Drop locking comments. ddb functions should never use locking anyway andjhb2006-04-271-6/+0
| | | | | | | no other ddb functions try to annotate what locking would otherwise be appropriate in comments. Prodded by: bde
* - Overhaul the 'ps' command in ddb to be mostly readable again. :) It isjhb2006-04-251-55/+319
| | | | | | | | | | | | | | | | | | | now back to using fixed-size columns for output and each line of output should fit in 80 columns on both 32-bit and 64-bit architectures. In general the output is close to that of the userland ps(1) with the exception that the 'wmesg' field is mostly similar to the "state" field in top(1) in that it will show either a wmesg, a lock name (prefixed with an *), "CPU xx" (for a running thread), or nothing if none of those three conditions are true. It also respects td_name when listing threads in a multithreaded process. There is a somewhat evilly-defined PTR64 macro I use to make account for the change in the size of the 'wchan' column in the formatted output (wchan is now the only pointer in the ps output and is available so it can be passed to 'show sleepq', 'show turnstile', or 'show lock'). - Add two new commands "show proc [process]" and "show thread [thread]" that show details about the specified process or thread (specified either by pid/tid or pointer), respectively. If an address it not specified, it uses the current kdb thread.
* Add two helper functions: db_lookup_thread() and db_lookup_proc(). Theyjhb2006-04-252-0/+94
| | | | | | | | | | | | | | | | take the addr value passed to a ddb command and attempt to use it to lookup a struct thread * or struct proc *, respectively. Each function first reparses the passed in value as if it was an ID entered in base 10. For threads the ID is treated as a thread ID, for proceses the ID is treated as a PID. If a thread or proc matching the ID is found, it is returned. For db_lookup_thread(), if the check_pid argument is true and it didn't find a thread with a matching thread ID, it will treat the ID as a PID and look for a matching process. If it finds one it returns the first thread in the process. If none of the ID lookups succeeded, then the functions assume that the passed in address is a thread or proc pointer, respectively. This allows one to use tids, pids, or structure pointers interchangeably in ddb functions that want to lookup threads or processes if desired.
* Use LIST_FOREACH().jhb2006-04-211-1/+1
|
OpenPOWER on IntegriCloud