summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_command.c
Commit message (Collapse)AuthorAgeFilesLines
* 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-121-5/+3
| | | | | | | | | | | | | | | | 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.
* Use LIST_FOREACH().jhb2006-04-211-1/+1
|
* Clean up the way we handle auxiliary commands for a given ddb commandjhb2006-03-071-97/+87
| | | | | | | | | | | | | | | | 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.
* - Rename 'traceall' to 'alltrace' so that the 'tr' shortcut for 'trace'jhb2005-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
* - Call db_setup_paging() for traceall.cognet2005-10-021-0/+5
| | | | | | | | | | | - 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.
* Add a DDB "traceall" function, which stack traces all known processrwatson2005-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
* Remove the need to forward declare statics by moving them around.obrien2005-08-101-57/+54
|
* Implement functions calls from within DDB on ia64. On ia64 a functionmarcel2005-07-021-16/+24
| | | | | | | | | | | | | | | | | | | | | | | 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)
* Start each of the license/copyright comments with /*-imp2005-01-061-1/+1
|
* When printing a stack trace for a thread, also print the pid and tid.rwatson2004-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.
* Oops... Add the CS_OWN flag to the trace and where commands so thatmarcel2004-07-211-2/+2
| | | | db_stack_trace() actually has a chance to parse its own arguments.
* Unify db_stack_trace_cmd(). All it did was look up the thread givenmarcel2004-07-211-2/+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
* Re-add the gdb command. It was removed to be replaced by somethingmarcel2004-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@
* Mega update for the KDB framework: turn DDB into a KDB backend.marcel2004-07-101-53/+4
| | | | | | | | | | | | | | | | 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.
* Give DDB a "watchdog" command which disables all watchdogs.phk2004-02-291-0/+21
|
* Further cleanup <machine/cpu.h> and <machine/md_var.h>: move the MImarcel2003-08-161-1/+1
| | | | | | | | | | | | | | | | | | | prototypes of cpu_halt(), cpu_reset() and swi_vm() from md_var.h to cpu.h. This affects db_command.c and kern_shutdown.c. ia64: move all MD prototypes from cpu.h to md_var.h. This affects madt.c, interrupt.c and mp_machdep.c. Remove is_physical_memory(). It's not used (vm_machdep.c). alpha: the MD prototypes have been left in cpu.h with a comment that they should be there. Moving them is left for later. It was expected that the impact would be significant enough to be done in a seperate commit. powerpc: MD prototypes left in cpu.h. Comment added. Suggested by: bde Tested with: make universe (pc98 incomplete)
* Add a one-shot callout facility to db_printf() that executes the registeredjhb2003-07-311-0/+1
| | | | | | | | | callout when a specified number of lines have been output. This can be used to implement pagers for ddb commands that output a lot of text. A simple paging function is included that automatically rearms itself when fired. Reviewed by: bde, julian
* Use __FBSDID().obrien2003-06-101-4/+4
|
* Make "where" an alias for "trace"phk2003-06-011-0/+1
|
* Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDBphk2003-02-161-2/+2
| | | | will not have a dev_t.
* Add code to ddb to allow backtracing an arbitrary thread.julian2002-12-281-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | (show thread {address}) Remove the IDLE kse state and replace it with a change in the way threads sahre KSEs. Every KSE now has a thread, which is considered its "owner" however a KSE may also be lent to other threads in the same group to allow completion of in-kernel work. n this case the owner remains the same and the KSE will revert to the owner when the other work has been completed. All creations of upcalls etc. is now done from kse_reassign() which in turn is called from mi_switch or thread_exit(). This means that special code can be removed from msleep() and cv_wait(). kse_release() does not leave a KSE with no thread any more but converts the existing thread into teh KSE's owner, and sets it up for doing an upcall. It is just inhibitted from being scheduled until there is some reason to do an upcall. Remove all trace of the kse_idle queue since it is no-longer needed. "Idle" KSEs are now on the loanable queue.
* Indentation indicates missing braces.phk2002-10-011-1/+2
| | | | Spotted by: FlexeLint
* Constify to kill some warnings.markm2002-09-211-1/+1
|
* Fixed some style bugs in the removal of __P(()). Continuation linesbde2002-03-231-12/+8
| | | | | were not outdented to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting.
* Remove __P.alfred2002-03-201-8/+8
|
* pid is 'long' on alpha.mjacob2002-01-171-2/+2
|
* Implement a "kill" DDB command which is an interface to psignal() thatdd2001-11-271-0/+59
| | | | | | | | | | | | | | | respects locks. Before SMPng, one was able to call psignal() using the "call" command, but this is no longer possible because it does not respect locks by itself. This is very useful when one has gotten their machine into a state where it is impossible to spawn ps/kill or su to root. In this case, respecting locks essentially means trying to aquire the proc lock before calling psignal(). We can't block in the debugger, so if trylock fails, the operation fails. This also means that we can't use pfind(), since that will attempt to lock the process for us. Reviewed by: jhb
* - Include machine/md_var.h to get rid of cpu_reset() warning. (-Wall)arr2001-11-051-0/+1
| | | | Approved by: jhb
* Add a 'reset' command. This is useful for panics really early beforepeter2001-11-031-0/+13
| | | | any symbols are loaded. Especially for unattended machines.
* Quiet a variable format-string warning.kris2001-07-191-1/+1
| | | | MFC after: 1 week
* Add 'hwatch' and 'dhwatch' ddb commands analogous to 'watch' andbsd2001-07-111-0/+2
| | | | | | | | | | 'dwatch'. The new commands install hardware watchpoints if supported by the architecture and if there are enough registers to cover the desired memory area. No objection by: audit@, hackers@ MFC after: 2 weeks
* A set of changes to reduce the number of include files the kerneljulian2001-07-081-1/+1
| | | | | | takes from /usr/include. I cannot check them on alpha.. (will try beast) Briefly looked at by: Warner Losh <imp@harmony.village.org>
* With this commit, I hereby pronounce gensetdefs past its use-by date.peter2001-06-131-14/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Merge the cons.c and cons.h to the best of my ability. alpha may orphk1999-08-091-3/+2
| | | | may not compile, I can't test it.
* Quiet warnings on Alpha. (db_expr_t is a long on alpha, int on x86)peter1999-07-011-2/+2
|
* add some amount of sanity to the way the gdb stuff finds its device.phk1999-05-091-3/+7
| | | | | | | | I'm not too happy about the result either, but at least it has less chance of backfiring. This particular feature could be called "a mess" without offending anybody.
* Get rid of extern declarations on gdb stuff so systems compiled withoutmckusick1999-05-071-1/+9
| | | | | DDB will compile. Warn users that try to use GDB without specifying a GDB port in their configuration file.
* Replace includes of <sys/kernel.h> with includes ofjdp1999-01-141-2/+2
| | | | | <sys/linker_set.h> in those files that use only the linker set definitions.
* Use not-so-new printf formats %r and/or %z instead of %n and/or %+x.bde1998-07-081-2/+2
|
* Redo the previous commit in a more Bruce-friendly fashion.phk1998-05-191-2/+1
| | | | Urged by: bde
* Add "show msgbuf" commandphk1998-05-191-1/+2
|
* Ensure that the linker sets for commands exist by putting a standardbde1998-02-131-15/+7
| | | | | command in each of them. This removes the need for hard-to-configure dummy instantiations of the sets.
* Staticize.eivind1998-02-091-2/+2
|
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Fixed bogus linkage of one of the ddb linker sets.bde1996-12-181-2/+6
|
* Support statically attaching of ddb commands in non-ddb modules.bde1996-09-141-32/+70
| | | | | | | | | | | | | | | | The details are hidden in the DB_COMMAND(cmd_name, func_name) and DB_SHOW_COMMAND(cmd_name, func_name) macros. DB_COMMAND() adds to the top-level ddb command table and DB_SHOW_COMMAND adds to the `show' subtable. Most external commands will probably be `show' commands with no side effects. They should check their pointer args more carefully than `show map' :-), or ddb should trap internal faults better (like it does for memory accesses). The vm ddb commands are temporarily unattached. ddb.h: Also declare `db_indent' and db_iprintf() which will replace vm's `indent' and iprintf().
* Allow the user to switch into gdb mode from ddbpst1996-08-271-1/+21
|
OpenPOWER on IntegriCloud