summaryrefslogtreecommitdiffstats
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* sys/ddb: spelling fixes in comments.pfg2016-04-291-1/+1
| | | | No functional change.
* ddb: Make use of our roundup() macro when available.pfg2016-04-261-1/+1
|
* Indentation issues.pfg2016-04-201-2/+1
| | | | | | Contract some lines leftover from r298310. Mea culpa.
* kernel: use our nitems() macro when it is available through param.h.pfg2016-04-191-1/+1
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* ddb: for pointers replace 0 with NULL.pfg2016-04-152-5/+5
| | | | | | Mostly cosmetical, no functional change. Found with devel/coccinelle.
* Avoid NULL pointer dereference, for a process which is not (yet) akib2016-04-151-1/+2
| | | | | | | member of a process group, e.g. during the system bootstrap. Submitted by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> MFC after: 1 week
* Add td_swinvoltick to track last involuntary context switchcem2016-03-251-0/+12
| | | | | | | Expose in DDB via "show thread." Reviewed by: markj Sponsored by: EMC / Isilon Storage Division
* Add helper to catch single step debug event and distinguish it from bkptzbb2015-11-271-7/+17
| | | | | | | | | | | | | | | Some architectures (including ARMv6/v7) do not have separate single step events and cannot see difference between breakpoint and single step. Add db_pc_is_singlestep() to avoid skipping instruction we stepped on to trigger debug event. This commit does not change the existing functionality but adds possibility to implement custom db_pc_is_singlestep(). Reviewed by: imp Submitted by: Zbigniew Bodek <zbb@semihalf.com> Obtained from: Semihalf Sponsored by: Juniper Networks Inc. Differential Revision: https://reviews.freebsd.org/D4036
* Make kstack_pages a tunable on arm, x86, and powepc. On i386, thekib2015-08-101-1/+1
| | | | | | | | | | | | | | | | | | | initial thread stack is not adjusted by the tunable, the stack is allocated too early to get access to the kernel environment. See TD0_KSTACK_PAGES for the thread0 stack sizing on i386. The tunable was tested on x86 only. From the visual inspection, it seems that it might work on arm and powerpc. The arm USPACE_SVC_STACK_TOP and powerpc USPACE macros seems to be already incorrect for the threads with non-default kstack size. I only changed the macros to use variable instead of constant, since I cannot test. On arm64, mips and sparc64, some static data structures are sized by KSTACK_PAGES, so the tunable is disabled. Sponsored by: The FreeBSD Foundation MFC after: 2 week
* Various changes to the registers displayed in DDB for x86.jhb2015-07-221-1/+2
| | | | | | | | | | | | | | | | - Fix segment registers to only display the low 16 bits. - Remove unused handlers and entries for the debug registers. - Display xcr0 (if valid) in 'show sysregs'. - Add '0x' prefix to MSR values to match other values in 'show sysregs'. - MFamd64: Display various MSRs in 'show sysregs'. - Add a 'show dbregs' to display the value of debug registers. - Dynamically size the column width for register values to properly align columns on 64-bit platforms. - Display %gs for i386 in 'show registers'. Differential Revision: https://reviews.freebsd.org/D2784 Reviewed by: kib, markj MFC after: 2 weeks
* Don't return undefined symbols to a DDB symbol lookup.markj2015-07-212-3/+7
| | | | | | | | | | | | | | | | Undefined symbols have a value of zero, so it makes no sense to return such a symbol when performing a lookup by value. This occurs for example when unwinding the stack after calling a NULL function pointer, and we confusingly report the faulting function as uart_sab82532_class() on amd64. Convert db_print_loc_and_inst() to only attempt disassembly if we managed to find a symbol corresponding to the IP. Otherwise we may fault and re-enter the debugger. Reviewed by: jhb Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D2858
* Fix KSTACK_PAGES issue when the default value was changed in KERNCONFzbb2015-07-162-0/+4
| | | | | | | | | | | | | | | | | | If KSTACK_PAGES was changed to anything alse than the default, the value from param.h was taken instead in some places and the value from KENRCONF in some others. This resulted in inconsistency which caused corruption in SMP envorinment. Ensure all places where KSTACK_PAGES are used the opt_kstack_pages.h is included. The file opt_kstack_pages.h could not be included in param.h because was breaking the toolchain compilation. Reviewed by: kib Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3094
* Correct the function name in catch-all error handling case.bz2015-06-171-1/+1
| | | | MFC after: 1 week
* ddb: de-registerpfg2015-05-235-18/+16
|
* ddb: Use NULL for pointerspfg2015-05-221-49/+49
| | | | Hinted by: DragonflyBSD
* ddb: finish converting boolean values.pfg2015-05-2120-117/+104
| | | | | | | | | The replacement started at r283088 was necessarily incomplete without replacing boolean_t with bool. This also involved cleaning some type mismatches and ansifying old C function declarations. Pointed out by: bde Discussed with: bde, ian, jhb
* ddb: stop boolean screaming.pfg2015-05-1812-101/+101
| | | | | | | TRUE --> true FALSE--> false Hinted by: NetBSD
* ddb: ANSI-fy function declarations.pfg2014-10-1211-227/+89
| | | | MFC after: 5 days
* ddb: space/tab fixes.pfg2014-10-1111-19/+19
| | | | | | No functional change. MFC after: 3 days
* ddb: allow specifying the exact address of the symtab and strtabroyger2014-09-252-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the FreeBSD kernel is loaded from Xen the symtab and strtab are not loaded the same way as the native boot loader. This patch adds three new global variables to ddb that can be used to specify the exact position and size of those tables, so they can be directly used as parameters to db_add_symbol_table. A new helper is introduced, so callers that used to set ksym_start and ksym_end can use this helper to set the new variables. It also adds support for loading them from the Xen PVH port, that was previously missing those tables. Sponsored by: Citrix Systems R&D Reviewed by: kib ddb/db_main.c: - Add three new global variables: ksymtab, kstrtab, ksymtab_size that can be used to specify the position and size of the symtab and strtab. - Use those new variables in db_init in order to call db_add_symbol_table. - Move the logic in db_init to db_fetch_symtab in order to set ksymtab, kstrtab, ksymtab_size from ksym_start and ksym_end. ddb/ddb.h: - Add prototype for db_fetch_ksymtab. - Declate the extern variables ksymtab, kstrtab and ksymtab_size. x86/xen/pv.c: - Add support for finding the symtab and strtab when booted as a Xen PVH guest. Since Xen loads the symtab and strtab as NetBSD expects to find them we have to adapt and use the same method. amd64/amd64/machdep.c: arm/arm/machdep.c: i386/i386/machdep.c: mips/mips/machdep.c: pc98/pc98/machdep.c: powerpc/aim/machdep.c: powerpc/booke/machdep.c: sparc64/sparc64/machdep.c: - Use the newly introduced db_fetch_ksymtab in order to set ksymtab, kstrtab and ksymtab_size.
* ins is only set and unused, but only when we're not doing softwareimp2014-08-141-4/+4
| | | | | single stepping. Only set it when we're doing that by bending style(9) rules a little to avoid even worse #ifdef soup.
* handle longer commands so that lines don't overflow... people who addedjmg2014-06-021-2/+2
| | | | commands forgot to check this...
* ddb: Minor style cleanups.pfg2014-03-314-16/+16
| | | | | | #define should be followed by tab. MFC after: 1 week
* 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.
OpenPOWER on IntegriCloud