summaryrefslogtreecommitdiff
path: root/sys/ddb
AgeCommit message (Collapse)Author
2024-05-13remove prototypes with no matching functionJonathan Gray
ok mpi@
2024-02-23ddb(4): db_read_bytes/db_write_bytes: change dst/src parameter to void*Scott Soule Cheloha
Almost all db_read_bytes() callers cast the destination buffer argument to char*, which suggests the API's prototype is incompatible with how the API is actually used. Change db_read_bytes() and db_write_bytes() to take a void* as the destination/source buffer parameter so callers don't need to cast the argument. With input from bluhm@. Bugs caught by Clemens Gossnitzer (ASCII approximation of name). Thread: https://marc.info/?l=openbsd-tech&m=170740813021636&w=2 ok bluhm@
2024-02-22Improve db_ctf_pprint(), implement handlers for arrays and enums.Claudio Jeker
Use db_get_value() to access addr to ensure that alignment errors don't cause exceptions. DDB on 32bit archs does normally not handle 64bit values so to print 64bit ints a bit of gymnastics is needed. OK mpi@
2024-02-03Remove Softdep.Bob Beck
Softdep has been a no-op for some time now, this removes it to get it out of the way. Flensing mostly done in Talinn, with some help from krw@ ok deraadt@
2023-09-19Improve the output of ddb "show proc" commandClaudio Jeker
Include missing fields -- like the sleep channel and message -- and show both the PID and TID of the proc. Also add '/t' as an argument that can be used to specify a proc by TID instead of by address. OK mpi@
2023-07-02all platforms, kernel: remove __HAVE_CLOCKINTR symbolScott Soule Cheloha
Every platform made the clockintr switch at least six months ago. The __HAVE_CLOCKINTR symbol is now redundant. Remove it. Prompted by claudio@. Link: https://marc.info/?l=openbsd-tech&m=168826181015032&w=2 "makes sense" mlarkin@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2022-11-05clockintr(9): initial commitScott Soule Cheloha
clockintr(9) is a machine-independent clock interrupt scheduler. It emulates most of what the machine-dependent clock interrupt code is doing on every platform. Every CPU has a work schedule based on the system uptime clock. For now, every CPU has a hardclock(9) and a statclock(). If schedhz is set, every CPU has a schedclock(), too. This commit only contains the MI pieces. All code is conditionally compiled with __HAVE_CLOCKINTR. This commit changes no behavior yet. At a high level, clockintr(9) is configured and used as follows: 1. During boot, the primary CPU calls clockintr_init(9). Global state is initialized. 2. Primary CPU calls clockintr_cpu_init(9). Local, per-CPU state is initialized. An "intrclock" struct may be installed, too. 3. Secondary CPUs call clockintr_cpu_init(9) to initialize their local state. 4. All CPUs repeatedly call clockintr_dispatch(9) from the MD clock interrupt handler. The CPUs complete work and rearm their local interrupt clock, if any, during the dispatch. 5. Repeat step (4) until the system shuts down, suspends, or hibernates. 6. During resume, the primary CPU calls inittodr(9) and advances the system uptime. 7. Go to step (2). This time around, clockintr_cpu_init(9) also advances the work schedule on the calling CPU to skip events that expired during suspend. This prevents a "thundering herd" of useless work during the first clock interrupt. In the long term, we need an MI clock interrupt scheduler in order to (1) provide control over the clock interrupt to MI subsystems like timeout(9) and dt(4) to improve their accuracy, (2) provide drivers like acpicpu(4) a means for slowing or stopping the clock interrupt on idle CPUs to conserve power, and (3) reduce the amount of duplicated code in the MD clock interrupt code. Before we can do any of that, though, we need to switch every platform over to using clockintr(9) and do some cleanup. Prompted by "the vmm(4) time bug," among other problems, and a discussion at a2k19 on the subject. Lots of design input from kettenis@. Early versions reviewed by kettenis@ and mlarkin@. Platform-specific help and testing from kettenis@, gkoehler@, mlarkin@, miod@, aoyama@, visa@, and dv@. Babysitting and spiritual guidance from mlarkin@ and kettenis@. Link: https://marc.info/?l=openbsd-tech&m=166697497302283&w=2 ok kettenis@ mlarkin@
2022-08-14db_ctf_decompress: use size_t not off_t for length parameterTodd C. Miller
The only caller of db_ctf_decompress() passes a size_t for the length. This eliminates sign comparison warnings without using casts. OK jca@ tb@
2022-08-11Revert uLong -> z_off_t change in the kernelTheo Buehler
The kernel source assumes the original zlib ABI. There is no reason to stick to this local change. Pull in a fix matching ctfdump.c -r1.26. This is hopefully the last change necessary to undo a painful hack that was committed 19 years ago without ok. Someone owes me a lot of beer... ok millert
2022-07-29Replace the swap extent(9) usage by a blist data structure.Sebastien Marie
It makes uvm_swap_free() faster: extents have a cost of O(n*n) which doesn't really scale with gigabytes of swap. Based on initial work from mpi@ The blist implementation comes from DragonFlyBSD. The diff adds also a ddb(4) 'show swap' command to show the blist and help debugging, and fix some off-by-one in size printed during hibernate. ok mpi@
2022-07-28In the kernel exist functions to print routes, but they were notAlexander Bluhm
accessible from ddb. Implement "show all routes" to print routing tables, and "show route 0xfffffd807e9b0000" for a single route entry. Note that the rtable id is not part of a route entry, so it makes no sense to print it there. OK deraadt@
2022-07-12Add db_rint(), an MI interface to db_enter() copied from kdbrint() in vax codeJeremie Courreges-Anglas
If ddb.console is set and your serial console driver uses it, db_rint(), lets you enter ddb(4) by typing the ESC D escape sequence. This is useful for drivers like sfuart(4) where the hardware doesn't have a true BREAK mechanism. Suggested by miod@, ok kettenis@ miod@
2022-04-14ddb: constify command tablesChristian Weisgerber
ok jca@
2022-04-12ddb: simplify machine command handlingChristian Weisgerber
Define a consistently named db_machine_command_table[] across all archs that implement the MD "machine" command, and hook this into the main command table instead of patching it at runtime. ok mpi@ jca@
2021-11-16To debug IPsec and tdb refcounting it is useful to have "show tdb"Alexander Bluhm
and "show all tdbs" in ddb. tested by Hrvoje Popovski; OK mvs@
2021-10-27extend checks of ensuring there's valid CTF data before attempting to use it.Jasper Lievisse Adriaanse
2021-10-24use NULL not 0 for pointer values in kernJonathan Gray
ok semarie@
2021-09-03add kprobes provider for dtJasper Lievisse Adriaanse
this allows us to dynamically trace function boundaries with btrace by patching prologues and epilogues with a breakpoint upon which the handler records the data, sends it back to userland for btrace to consume. currently it's hidden behind DDBPROF, and there is still a lot to cleanup and improve, but basic scripts that observe return codes from a probed function work. from Tom Rollet, with various changes by me feedback and ok mpi@
2021-07-09fix scentence in db_printsym commentJasper Lievisse Adriaanse
2021-06-10Prevent interleaved stack traces in ddb from multiple CPUs. CheckAlexander Bluhm
atomically which CPU is currently tracing. OK cheloha@
2021-06-02kernel: introduce per-CPU panic(9) message bufferscheloha
Add a 512-byte buffer (ci_panicbuf) to each cpu_info struct on each platform for use by panic(9). The first panic on a given CPU writes its message to this buffer. Subsequent panics on a given CPU print the panic message to the console but do not modify the buffer. This aids debugging in two cases: - If 2+ CPUs panic simultaneously there is no risk of garbled messages in the panic buffer. - If a CPU panics and then the operator causes a second panic while using ddb(4), the operator can still recall the first failure on a particular CPU. Misc. changes to support this bigger change: - Set panicstr atomically to identify the first CPU to reach panic(). - Tweak db_show_panic_cmd() to print all panic messages across all CPUs. Prefix the first panic with an asterisk ('*'). - Prefer db_printf() to printf() during a panic if we have it. Apparently it disturbs less global state. - On amd64, tweak fault() to write the local panic buffer. This needs more work. Prompted by bluhm@ and deraadt@. Mostly written by deraadt@. Discussed with bluhm@, deraadt@ and kettenis@. Borne from a discussion on tech@ about making panic(9) more MP-safe: https://marc.info/?l=openbsd-tech&m=162086462316143&w=2 ok kettenis@, visa@, bluhm@, deraadt@
2021-03-12spellingJonathan Gray
2021-02-09ddb: when a new wsdisplay console attaches, resize ddb cols/rows to itJoshua Stein
ok visa
2021-01-09Finish converting ddb_sysctl to sysctl_int_boundedgnezdo
I missed the verbose pattern that it used for error checking the first time around. OK millert@
2020-12-10Convert ddb_sysctl to sysctl_bounded_arrgnezdo
ok gkoehler@
2020-10-26add a top-level "reboot" command, for people who keep forgetting "boot reboot"Theo de Raadt
ok kn
2020-10-15sick of the CMU, let's make this KNFTheo de Raadt
2020-05-26Stop requiring that .strtab has long alignment.gkoehler
When ddb loads symbols, the .strtab contains char strings and doesn't need long alignment. Our bootloader provides long alignment, but I started loading symbols on powerpc64 without our bootloader. ok mpi@ guenther@ kettenis@
2020-01-20Separate the stack trace saving interface from ddb. The saving does notVisa Hankala
require the debugger on most architectures, and the separation makes the code easier to use from other subsystems. The function definitions are still conditional to DDB. However, that should not matter for now. OK deraadt@, mpi@
2020-01-09If the kernel panics due to SMEP or SMAP, print correct stack traceAlexander Bluhm
and pass information to ddb. This helps to debug kernel NULL pointer function calls. input guenther@; OK kettenis@
2019-11-12Default to 0 arguments if no symbol has been found in the CTF section.Martin Pieuchot
Symbols not present in the CTF data are generally assembly routines which have either no argument or do not follow the ABI that the various MD stack unwinders understand. This makes ddb(4) trace simpler to understand. ok jasper@
2019-11-07db_addr_t -> vaddr_tMartin Pieuchot
ok deraadt@
2019-11-07FALSE -> 0, missed in previous.Martin Pieuchot
Spotted by deraadt@
2019-11-06Substitute boolean_t/TRUE/FALSE by int/1/0.Martin Pieuchot
ok dlg@, jasper@, anton@
2019-07-20Get rid of `ddb_is_active' instead use `db_active'.Martin Pieuchot
From Christian Ludwig <christian_ludwig at genua dot de> ok visa@
2019-04-02Fix ddb not to write its history to out of the region. When theYASUOKA Masahiko
inputted line just ends at sizeof(db_history), ddb started writing the histories to out of the region. diff from IIJ. ok deraadt anton
2019-04-01remove prototype from earlier version of reboot code. spotted by antonTed Unangst
2019-04-01fast track ddb> reboot command to skip anything which might panic again.Ted Unangst
ok deraadt
2019-02-15zap trailing empty lineanton
2019-02-15The underlying storage for builtin ddb variables are of type int butanton
referenced to using a pointer to long. When writing to such a variable, cast it to the correct type. Writing would otherwise on 64-bit architectures cause the next variable adjacent in memory to also be modified. ok deraadt@ visa@
2019-01-09Printing hex values with right adjustment makes it easier to compareAlexander Bluhm
corresponding digits. So the change the ddb x/x output. OK sashan@ deraadt@ visa@ mpi@
2018-09-18whitespace fix; no binary changeanton
2018-08-31Pass the correct size to free(9) in the error path of db_ctf_decompress().Alexander Bluhm
OK jasper@
2018-05-07Make the print function of db_print_stack_trace() configurable,Visa Hankala
and indicate if a saved stack trace is empty. OK guenther@
2018-01-09Do not truncate 64bit integers when pretty-printing types.Martin Pieuchot
2018-01-05Show uvm_fault and trace when typing show panic on a page fault'd kernelPaul Irofti
Currently there is only support for amd64, if this change settles I will add support for the rest of the architectures. OK kettenis@.
2017-12-13Add 'bt' an alias for 'trace'.Martin Pieuchot
ok pirofti@
2017-12-11In uvm Chuck decided backing store would not be allocated proactivelyTheo de Raadt
for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
2017-11-27Remove MALLOC_DEBUG left overs.Martin Pieuchot
From Klemens Nanni.