aboutsummaryrefslogtreecommitdiff
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* - Move all of the PS_ flags into either p_flag or td_flags.Jeff Roberson2007-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) Notes: svn path=/head/; revision=172207
* Use FOREACH_PROC_IN_SYSTEM instead of using its unrolled form.Xin LI2007-01-172-4/+4
| | | | Notes: svn path=/head/; revision=166074
* Threading cleanup.. part 2 of several.Julian Elischer2006-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. Notes: svn path=/head/; revision=164936
* Fix the output format of MI ddb watches in 'show watch' on 64-bitJohn Baldwin2006-11-171-0/+8
| | | | | | | platforms. Notes: svn path=/head/; revision=164359
* Set up the context for the dbbe_trace callback in the ddb. Otherwise,Konstantin Belousov2006-11-061-1/+14
| | | | | | | | | trap caused by backtracing would lead to panic. Noted and reviewed by: bde Notes: svn path=/head/; revision=164029
* On trap while inside ddb, the trap handler calls kdb_reenter(), thatKonstantin Belousov2006-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 Notes: svn path=/head/; revision=163909
* Make KSE a kernel option, turned on by default in all GENERICJohn Birrell2006-10-261-0/+4
| | | | | | | | | | kernel configs except sun4v (which doesn't process signals properly with KSE). Reviewed by: davidxu@ Notes: svn path=/head/; revision=163709
* The powerpc and sparc64 MD `reboot' commands should never have existedBruce Evans2006-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). Notes: svn path=/head/; revision=163192
* Fixed loss of whitespace suppression at ends of lines. WhitespaceBruce Evans2006-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. Notes: svn path=/head/; revision=163190
* Added some aliases:Bruce Evans2006-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'. Notes: svn path=/head/; revision=163135
* Fixed formatting of printing of command tables. WIth the default maxBruce Evans2006-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. Notes: svn path=/head/; revision=163134
* Fix two nits in the ps header that offset each other making them largelyJohn Baldwin2006-08-011-6/+6
| | | | | | | unnoticable. Notes: svn path=/head/; revision=160893
* Some cosmetic tweaks:John Baldwin2006-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) Notes: svn path=/head/; revision=160878
* Disable the pager for 'panic' and 'call' to be paranoid.John Baldwin2006-07-191-0/+2
| | | | Notes: svn path=/head/; revision=160505
* Simplify the pager support in DDB. Allowing different db commands toJohn Baldwin2006-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. Notes: svn path=/head/; revision=160312
* Never zero-out db_last_symtab. Whan backtraces are doneKonstantin Belousov2006-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 Notes: svn path=/head/; revision=159668
* Use __LP64__ rather than the PTR64 hack.John Baldwin2006-05-111-14/+3
| | | | | | | Suggested by: ru Notes: svn path=/head/; revision=158456
* Sort includes.John Baldwin2006-04-271-2/+2
| | | | Notes: svn path=/head/; revision=158092
* A whitespace fix.John Baldwin2006-04-271-1/+1
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=158091
* Drop locking comments. ddb functions should never use locking anyway andJohn Baldwin2006-04-271-6/+0
| | | | | | | | | | no other ddb functions try to annotate what locking would otherwise be appropriate in comments. Prodded by: bde Notes: svn path=/head/; revision=158090
* - Overhaul the 'ps' command in ddb to be mostly readable again. :) It isJohn Baldwin2006-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. Notes: svn path=/head/; revision=158032
* Add two helper functions: db_lookup_thread() and db_lookup_proc(). TheyJohn Baldwin2006-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. Notes: svn path=/head/; revision=158029
* Use LIST_FOREACH().John Baldwin2006-04-211-1/+1
| | | | Notes: svn path=/head/; revision=157951
* Clean up the way we handle auxiliary commands for a given ddb commandJohn Baldwin2006-03-072-105/+106
| | | | | | | | | | | | | | | | | | | table. Previously, the ddb code knew of each linker set of auxiliary commands and which explicit command list they were tied to. These changes add a simple command_table struct that contains both the static list of commands and the pointers for any auxiliary linker set of additional commands. This also makes it possible for other arbitrary command tables to be defined in other parts of the kernel w/o having to edit ddb itself. The DB_SET macro has also been trimmed down to just creating an entry in a linker set. A new DB_FUNC macro does what the old DB_SET did which is to not only add an entry to the linker set but also to include a function prototype for the function being added. With these changes, it's now also possible to create aliases for ddb functions using DB_SET() directly if desired. Notes: svn path=/head/; revision=156412
* Fix -Wundef.Ruslan Ermilov2005-12-041-0/+4
| | | | Notes: svn path=/head/; revision=153072
* - Rename 'traceall' to 'alltrace' so that the 'tr' shortcut for 'trace'John Baldwin2005-10-241-1/+2
| | | | | | | | | | | | | | still works. Also, this is consistent with 'show pcpu' vs 'show allpcpu'. (And 'show allstacks' on OS X for that matter.) - Add 'bt' as an alias for 'trace'. We already have a 'where' alias as well, so this makes it easier for gdb-wired hands to work in ddb. Ok'd by: rwatson (1) Requested by: scottl (2) MFC after: 1 day Notes: svn path=/head/; revision=151622
* - Call db_setup_paging() for traceall.Olivier Houchard2005-10-022-5/+13
| | | | | | | | | | | | | | - Make it so one can't call db_setup_paging() if it has already been called before. traceall needs this, or else the db_setup_paging() call from db_trace_thread() will reset the printed line number, and override its argument. This is not perfect for traceall, because even if one presses 'q' while in the middle of printing a backtrace it will finish printing the backtrace before exiting, as db_trace_thread() won't be notified it should stop, but it is hard to do better without reworking the pager interface a lot more. Notes: svn path=/head/; revision=150842
* Add a DDB "traceall" function, which stack traces all known processRobert Watson2005-10-021-0/+18
| | | | | | | | | | | | | threads. This is quite useful if generating a debug log for post-mortem by another developer, in which case the person at the console may not know which threads are of interest. The output of this can be quite long. Discussed with: kris MFC after: 3 days Notes: svn path=/head/; revision=150819
* Move the prototypes of db_md_set_watchpoint(), db_md_clr_watchpoint()Marcel Moolenaar2005-09-102-5/+3
| | | | | | | and db_md_list_watchpoints() to ddb/ddb.h. Notes: svn path=/head/; revision=149925
* Remove the need to forward declare statics by moving them around.David E. O'Brien2005-08-101-57/+54
| | | | Notes: svn path=/head/; revision=148919
* Implement functions calls from within DDB on ia64. On ia64 a functionMarcel Moolenaar2005-07-022-16/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | pointer doesn't point to the first instruction of that function, but rather to a descriptor. The descriptor has the address of the first instruction, as well as the value of the global pointer. The symbol table doesn't know anything about descriptors, so if you lookup the name of a function you get the address of the first instruction. The cast from the address, which is the result of the symbol lookup, to a function pointer as is done in db_fncall is therefore invalid. Abstract this detail behind the DB_CALL macro. By default DB_CALL is defined as db_fncall_generic, which yields the old behaviour. On ia64 the macro is defined as db_fncall_ia64, in which a descriptor is constructed to yield a valid function pointer. While here, introduce DB_MAXARGS. DB_MAXARGS replaces the existing (local) MAXARGS. The DB_MAXARGS macro can be defined by platforms to create a convenient maximum. By default this will be the legacy 10. On ia64 we define this macro to be 8, for 8 is the maximum number of arguments that can be passed in registers. This avoids having to implement spilling of arguments on the memory stack. Approved by: re (dwhite) Notes: svn path=/head/; revision=147745
* Don't enter the debugger if KDB_UNATTENDED is set or ifPaul Saab2005-04-201-1/+0
| | | | | | | | | debug.debugger_on_panic=0. MFC after: 2 weeks Notes: svn path=/head/; revision=145343
* rev 1.54 of i386/include/pcb.h depended on sys/proc.h. The prerequisitePeter Wemm2005-04-142-0/+2
| | | | | | | | | | | was satisified for the rest of the kernel on the i386 build except for these two files. Rather than adding a submarine include to pcb.h, I've added proc.h here. I forgot to include these with the original commit. Sorry folks. Notes: svn path=/head/; revision=145053
* Start each of the license/copyright comments with /*-Warner Losh2005-01-0624-24/+24
| | | | Notes: svn path=/head/; revision=139747
* When printing a stack trace for a thread, also print the pid and tid.Robert Watson2004-11-231-0/+6
| | | | | | | | | When a series of traces is included in a bug report, this will make it easier to tie the trace information back to ps or threads output, each of which will show the pid or the tid, but usually not both. Notes: svn path=/head/; revision=138038
* When printing information on the current thread, such as when enteringRobert Watson2004-11-231-1/+6
| | | | | | | | | DDB, also print the pid of the process if present. Since much debugging still centers around processes, having the pid is quite helpful. Notes: svn path=/head/; revision=138037
* Do not attempt to skip a breakpoint that is a result of a software single step,Olivier Houchard2004-11-211-3/+12
| | | | | | | or bad things happen. Notes: svn path=/head/; revision=137974
* Remove the uarea column from the DDB 'ps' display, and from grog's gdbDavid Schultz2004-11-201-3/+3
| | | | | | | | | scripts. Reviewed by: arch@ Notes: svn path=/head/; revision=137923
* - Change the ddb paging "support" to use a variable (db_lines_per_page) toJohn Baldwin2004-11-015-12/+28
| | | | | | | | | | | | | | | | | | | | control the number of lines per page rather than a constant. The variable can be examined and changed in ddb as '$lines'. Setting the variable to 0 will effectively turn off paging. - Change db_putchar() to force out pending whitespace before outputting newlines and carriage returns so that one can rub out content on the current line via '\r \r' type strings. - Change the simple pager to rub out the --More-- prompt explicitly when the routine exits. - Add some aliases to the simple pager to make it more compatible with more(1): 'e' and 'j' do a single line. 'd' does half a page, and 'f' does a full page. MFC after: 1 month Inspired by: kris Notes: svn path=/head/; revision=137117
* Refactor a bunch of scheduler code to give basically the same behaviourJulian Elischer2004-09-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | but with slightly cleaned up interfaces. The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time. The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own. Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens. Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure. The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring. A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated. Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can. Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week Notes: svn path=/head/; revision=134791
* Damage control. Correcly advance symtab and strtab pointers, notAlexander Kabaev2004-07-281-2/+2
| | | | | | | | | table length values. Spotted by: iedowse Notes: svn path=/head/; revision=132791
* Avoid casts as lvalues.Alexander Kabaev2004-07-281-2/+4
| | | | Notes: svn path=/head/; revision=132771
* Oops... Add the CS_OWN flag to the trace and where commands so thatMarcel Moolenaar2004-07-211-2/+2
| | | | | | | db_stack_trace() actually has a chance to parse its own arguments. Notes: svn path=/head/; revision=132484
* Unify db_stack_trace_cmd(). All it did was look up the thread givenMarcel Moolenaar2004-07-212-3/+43
| | | | | | | | | | | | | | | | | | the thread ID and call db_trace_thread(). Since arm has all the logic in db_stack_trace_cmd(), rename the new DB_COMMAND function to db_stack_trace to avoid conflicts on arm. While here, have db_stack_trace parse its own arguments so that we can use a more natural radix for IDs. If the ID is not a thread ID, or more precisely when no thread exists with the ID, try if there's a process with that ID and return the first thread in it. This makes it easier to print stack traces from the ps output. requested by: rwatson@ tested on: amd64, i386, ia64 Notes: svn path=/head/; revision=132482
* Re-add the gdb command. It was removed to be replaced by somethingMarcel Moolenaar2004-07-121-0/+12
| | | | | | | | | | | | more generic, but that didn't actually happen. Since the feature to switch backends (and historically this means from DDB to GDB) is important, make sure people can do just that until such the generic mechanism actually sees the light of day. Suggested by: rwatson@ Notes: svn path=/head/; revision=132002
* Remove now unused files:Marcel Moolenaar2004-07-114-708/+0
| | | | | | | | | db_elf.c, db_kld.c: The new KDB backend supports both at the same time. db_sysctl.c: The functionality has been moved to sys/kern/subr_kdb.c. db_trap.c: The DDB entry point has been moved to sys/ddb/db_main.c. Notes: svn path=/head/; revision=131961
* Mega update for the KDB framework: turn DDB into a KDB backend.Marcel Moolenaar2004-07-1012-291/+455
| | | | | | | | | | | | | | | | | | | Most of the changes are a direct result of adding thread awareness. Typically, DDB_REGS is gone. All registers are taken from the trapframe and backtraces use the PCB based contexts. DDB_REGS was defined to be a trapframe on all platforms anyway. Thread awareness introduces the following new commands: thread X switch to thread X (where X is the TID), show threads list all threads. The backtrace code has been made more flexible so that one can create backtraces for any thread by giving the thread ID as an argument to trace. With this change, ia64 has support for breakpoints. Notes: svn path=/head/; revision=131952
* Fixed DDB_NOKLDSYM on amd64's:Bruce Evans2004-05-181-1/+1
| | | | | | | | | | | machdep.c: Initialize the symbol table pointers, not quite like for other arches. db_elf.c: Don't claim to be an i486 in the fake ELF header. Notes: svn path=/head/; revision=129373
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-071-4/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* Give DDB a "watchdog" command which disables all watchdogs.Poul-Henning Kamp2004-02-291-0/+21
| | | | Notes: svn path=/head/; revision=126399