summaryrefslogtreecommitdiffstats
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* MFC r263973;pfg2014-04-074-16/+16
| | | | | | ddb: Minor style cleanups. #define should be followed by tab.
* Small textdump enhancements.alfred2012-11-012-6/+28
| | | | | | | | | | | | | | Allow textdumps to be called explicitly from DDB. If "dump" is called in DDB and textdumps are enabled then abort the dump and tell the user to turn off textdumps. Add options TEXTDUMP_PREFERRED to turn textdumps on by default. Add options TEXTDUMP_VERBOSE to be a bit more verbose while textdumping. Reviewed by: rwatson MFC after: 2 weeks
* Update the ddb and gdb backends for the new 'trace_thread' hook.jhb2012-04-121-1/+15
| | | | | | | | | It is implemented via db_trace_thread() for DDB and not implemented for GDB. This should have been part of r234190. Pointy hat to: jhb Reported by: jkim MFC after: 1 week
* Use strchr() and strrchr().ed2012-01-021-1/+1
| | | | | | | | It seems strchr() and strrchr() are used more often than index() and rindex(). Therefore, simply migrate all kernel code to use it. For the XFS code, remove an empty line to make the code identical to the code in the Linux kernel.
* Use FOREACH_PROC_IN_SYSTEM instead of using its unrolled form.pluknet2011-12-181-1/+1
| | | | Reviewed by: kib
* Add 'findstack' ddb command to search either the thread kernel stackkib2011-12-163-0/+39
| | | | | | | or cached stack containing the specified kernel virtual address. Discussed with: pho MFC after: 1 week
* Show the thread kernel stack base address for 'show threads'.kib2011-12-161-1/+2
| | | | | Discussed with: pho MFC after: 1 week
* Typo.kib2011-12-091-1/+1
| | | | MFC after: 3 days
* Follow up to r225203 refining break-to-debugger run-time configurationrwatson2011-08-271-2/+0
| | | | | | | | | | | | improvements: (1) Implement new model in previously missed at91 UART driver (2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h to opt_kdb.h (spotted by np) (3) Garbage collect now-unused opt_comconsole.h MFC after: 3 weeks Approved by: re (bz)
* Fix making kernel dumps from the debugger by creating a commandmarcel2011-06-071-0/+24
| | | | | | | | | | for it. Do not not expect a developer to call doadump(). Calling doadump does not necessarily work when it's declared static. Nor does it necessarily do what was intended in the context of text dumps. The dump command always creates a core dump. Move printing of error messages from doadump to the dump command, now that we don't have to worry about being called from DDB.
* Trim some additional unnecessary <linker_set.h> includes.jhb2011-04-281-1/+0
| | | | MFC after: 1 week
* - Add the possibility to reuse the already last used timeout when pattingattilio2011-04-271-8/+0
| | | | | | | | | | | | | | | | | | | | | | | the watchdog, via the watchdog(9) interface. For that, the WD_LASTVAL bitwise operation is used. It is mutually exclusive with any explicit timout passing to the watchdogs. The last timeout can be returned via the wdog_kern_last_timeout() KPI. - Add the possibility to pat the watchdogs installed via the watchdog(9) interface from the kernel. In order to do that the new KPI wdog_kern_pat() is offered and it does accept normalized nanoseconds or WD_LASTVAL. - Avoid to pass WD_ACTIVE down in the watchdog handlers. All the control bit processing should over to the upper layer functions and not passed down to the handlers at all. These changes are intended to be used in order to fix up the watchdog tripping in situation when the userland is busted, but protection is still wanted (examples: shutdown syncing / disk dumping). Sponsored by: Sandvine Incorporated Reviewed by: emaste, des, cognet MFC after: 2 weeks
* Extend the DDB command "watchdog" with the ability to specify a timeoutattilio2011-04-051-8/+25
| | | | | | | | | | | | | | | | value. The timeout is expressed in the form T(N) = (2^N * nanoseconds) and can be easilly extracted from the watchdog interface as a WD_TO_* macro. That new functionality is supposed to fix re-entering the kernel from DDB re-enabling the watchdog again (previously disabled) and also offer the possibility to break for deadlocked DDB commands. Please note that retro-compatibility is retained. Sponsored by: Sandvine Incorporated Approved by: des MFC after: 10 days
* Modify kdb_trap() so that it re-calls the dbbe_trap function as long asmdf2011-02-181-3/+9
| | | | | | | | | | | | | | | the debugger back-end has changed. This means that switching from ddb to gdb no longer requires a "step" which can be dangerous on an already-crashed kernel. Also add a capability to get from the gdb back-end back to ddb, by typing ^C in the console window. While here, simplify kdb_sysctl_available() by using sbuf_new_for_sysctl(), and use strlcpy() instead of strncpy() since the strlcpy semantic is desired. MFC after: 1 month
* sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.mdf2011-01-121-1/+1
| | | | Commit the kernel changes.
* One more use for _SIG_VALID.kib2010-07-121-1/+1
| | | | | Submitted by: Garrett Cooper <yanegomi gmail com> MFC after: 1 week
* MFp4 @178364:bz2010-05-243-34/+67
| | | | | | | | | | | | | | | | | | Implement an optional delay to the ddb reset/reboot command. This allows textdumps to be run automatically with unattended reboots after a resonable timeout, while still permitting an administrator to break into debugger if attached to the console at the time of the event for further debugging. Cap the maximum delay at 1 week to avoid highly accidental results, and default to 15s in case of problems parsing the timeout value. Move hex2dec helper function from db_thread.c to db_command.c to make it generally available and prefix it with a "db_" to avoid namespace collisions. Reviewed by: rwatson MFC after: 4 weeks
* There is not a good reason to have a different prototype for db_printf()attilio2010-05-112-3/+5
| | | | | | | | when compared to printf(). Unify it by returning the number of characters displayed for db_printf() as well. MFC after: 7 days
* Move two copies of the same definition to a common include file.julian2010-04-141-6/+0
| | | | MFC after: 3 weeks
* Add a space before printing 'thread pid ...' to match the space beforerpaulo2010-02-121-1/+1
| | | | ']'.
* Replace several instances of 'if (!a & b)' with 'if (!(a &b))' in ordertrasz2010-01-081-2/+2
| | | | to silence newer GCC versions.
* Among signal generation syscalls, only sigqueue(2) is allowed by POSIXkib2009-11-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | to fail due to lack of resources to queue siginfo. Add KSI_SIGQ flag that allows sigqueue_add() to fail while trying to allocate memory for new siginfo. When the flag is not set, behaviour is the same as for KSI_TRAP: if memory cannot be allocated, set bit in sq_kill. KSI_TRAP is kept to preserve KBI. Add SI_KERNEL si_code, to be used in siginfo.si_code when signal is generated by kernel. Deliver siginfo when signal is generated by kill(2) family of syscalls (SI_USER with properly filled si_uid and si_pid), or by kernel (SI_KERNEL, mostly job control or SIGIO). Since KSI_SIGQ flag is not set for the ksi, low memory condition cause old behaviour. Keep psignal(9) KBI intact, but modify it to generate SI_KERNEL si_code. Pgsignal(9) and gsignal(9) now take ksi explicitely. Add pksignal(9) that behaves like psignal but takes ksi, and ddb kill command implemented as pksignal(..., ksi = NULL) to not do allocation while in debugger. While there, remove some register specifiers and use ANSI C prototypes. Reviewed by: davidxu MFC after: 1 month
* Put square backets ([]) around process names for system processes to patchjhb2009-10-011-4/+10
| | | | the behavior of ps(1).
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andrwatson2009-08-011-1/+1
| | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket)
* Build on Jeff Roberson's linker-set based dynamic per-CPU allocatorrwatson2009-07-145-1/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
* 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
OpenPOWER on IntegriCloud