summaryrefslogtreecommitdiffstats
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* Start each of the license/copyright comments with /*-imp2005-01-0624-24/+24
|
* 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.
* When printing information on the current thread, such as when enteringrwatson2004-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.
* Do not attempt to skip a breakpoint that is a result of a software single step,cognet2004-11-211-3/+12
| | | | or bad things happen.
* Remove the uarea column from the DDB 'ps' display, and from grog's gdbdas2004-11-201-3/+3
| | | | | | scripts. Reviewed by: arch@
* - Change the ddb paging "support" to use a variable (db_lines_per_page) tojhb2004-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
* Refactor a bunch of scheduler code to give basically the same behaviourjulian2004-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
* Damage control. Correcly advance symtab and strtab pointers, notkan2004-07-281-2/+2
| | | | | | table length values. Spotted by: iedowse
* Avoid casts as lvalues.kan2004-07-281-2/+4
|
* 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-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
* 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@
* Remove now unused files:marcel2004-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.
* Mega update for the KDB framework: turn DDB into a KDB backend.marcel2004-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.
* Fixed DDB_NOKLDSYM on amd64's:bde2004-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.
* Remove advertising clause from University of California Regent'simp2004-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
* Give DDB a "watchdog" command which disables all watchdogs.phk2004-02-291-0/+21
|
* Switch the sleep/wakeup and condition variable implementations to use thejhb2004-02-271-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | sleep queue interface: - Sleep queues attempt to merge some of the benefits of both sleep queues and condition variables. Having sleep qeueus in a hash table avoids having to allocate a queue head for each wait channel. Thus, struct cv has shrunk down to just a single char * pointer now. However, the hash table does not hold threads directly, but queue heads. This means that once you have located a queue in the hash bucket, you no longer have to walk the rest of the hash chain looking for threads. Instead, you have a list of all the threads sleeping on that wait channel. - Outside of the sleepq code and the sleep/cv code the kernel no longer differentiates between cv's and sleep/wakeup. For example, calls to abortsleep() and cv_abort() are replaced with a call to sleepq_abort(). Thus, the TDF_CVWAITQ flag is removed. Also, calls to unsleep() and cv_waitq_remove() have been replaced with calls to sleepq_remove(). - The sched_sleep() function no longer accepts a priority argument as sleep's no longer inherently bump the priority. Instead, this is soley a propery of msleep() which explicitly calls sched_prio() before blocking. - The TDF_ONSLEEPQ flag has been dropped as it was never used. The associated TDF_SET_ONSLEEPQ and TDF_CLR_ON_SLEEPQ macros have also been dropped and replaced with a single explicit clearing of td_wchan. TD_SET_ONSLEEPQ() would really have only made sense if it had taken the wait channel and message as arguments anyway. Now that that only happens in one place, a macro would be overkill.
* Add DDB_NUMSYM option which in addition to the symbolic representationphk2004-02-241-0/+6
| | | | | | | | | | | | | | | | | also prints the actual numerical value of the symbol in question. Users of addr2line(1) will be less proficient in hex arithmetic as a consequence. This amongst other things means that traceback lines change from: siointr1(c4016800,c073bda0,0,c06b699c,69f) at siointr1+0xc5 to siointr1(c4016800,c073bda0,0,c06b699c,69f) at 0xc062b0bd = siointr1+0xc5 I made this an option to avoid bikesheds. ~ ~ ~
* If not in the debugger or if the user requests it with thenjl2004-01-281-1/+27
| | | | | | | | | debug.ddb_use_printf sysctl, output kernel debugger data to both the console and kernel message buffer via printf. This fixes the case where backtrace() went directly to the console and should help debugging greatly. Thanks to Ian Dowse for the work, minor edits or any bugs are by myself. Submitted by: iedowse
* Reworked rev.1.14. Use the ELF symbol type again to summarily rejectbde2003-09-281-0/+5
| | | | | | | | | | | | | some symbols in X_db_search_symbol(). Reject the same symbols that rev.1.13 did (all except STT_OBJECT and STT_FUNC), except don't reject typeless symbols. This keeps the typeless symbols in non-verbosely written assembler code visible, but makes file symbols invisible. ELF file symbols have type STT_FILE and value 0, so this stops small values and offsets sometimes being displayed in terms of the first file symbol in the kernel (usually device_if.c). I think it rejects some other unwanted symbols (small absolute symbols for things like struct offsets). It may reject some wanted symbols (large absolute symbols for addresses like PTmap).
* Label the uarea address as such in DDB's ps outputphk2003-08-301-1/+1
|
* 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)
* db_get_value uses a local buffer to first fetch all the bytes of aharti2003-08-121-1/+1
| | | | | | integer value and then to construct the integer from it. This buffer was sizeof(int) bytes long, which was fine until the (undocumented) 'g' modifier for 8-byte integers was introduced. Change this to sizeof(uint64_t).
* Update the 'ps', 'show pci', and 'show ktr' ddb commands to use the newjhb2003-07-311-28/+6
| | | | pager callout instead of homerolling their own paging facility.
* Add a one-shot callout facility to db_printf() that executes the registeredjhb2003-07-313-0/+75
| | | | | | | | | 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
* Whitespace nit.jhb2003-07-301-0/+1
|
* Rename P_THREADED to P_SA. P_SA means a process is using schedulerdavidxu2003-06-151-3/+3
| | | | activations.
* Use __FBSDID().obrien2003-06-1019-53/+67
|
* Attempt to crunch down the thread state info so that it is more likely tojulian2003-06-061-6/+15
| | | | | | | | | | | | fit on one line. Account for threads better. * No need to report that it is on a sleep queue if it is actually sleeping * "Normal" state is almost ubiquitous.. only report abnormal states. * increment the #lines count for each separate thread shown in threaded programs. makes it less likely that a threaded program will make all the data on a screen overflow off the top of the screen.
* Handle the TDS_INACTIVE state by printing '[INACTIVE]' instead ofjhb2003-06-061-1/+4
| | | | | panic'ing. Also, for unknown thread states, print out the value rather than panic. Panic'ing in the debugger is pointless at best.
* Whitespace nits.jhb2003-06-061-2/+3
|
* Make "where" an alias for "trace"phk2003-06-011-0/+1
|
* Add /* FALLTHROUGH */phk2003-05-311-0/+1
| | | | Found by: FlexeLint
* Add /* FALLTHROUGH */phk2003-05-311-0/+1
| | | | Found by: FlexeLint
* Move the _oncpu entry from the KSE to the thread.julian2003-04-101-1/+1
| | | | | The entry in the KSE still exists but it's purpose will change a bit when we add the ability to lock a KSE to a cpu.
* The kernel bcopy() is safe for overlapping regions (and always has), sodes2003-04-041-2/+2
| | | | there is no use for a separate ovbcopy().
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-3/+3
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* - Split the struct kse into struct upcall and struct kse. struct kse willjeff2003-02-171-9/+0
| | | | | | | soon be visible only to schedulers. This greatly simplifies much the KSE code. Submitted by: davidxu
* Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDBphk2003-02-162-3/+3
| | | | will not have a dev_t.
* Reversion of commit by Davidxu plus fixes since applied.julian2003-02-011-0/+9
| | | | | | | | I'm not convinced there is anything major wrong with the patch but them's the rules.. I am using my "David's mentor" hat to revert this as he's offline for a while.
* Move UPCALL related data structure out of kse, introduce a newdavidxu2003-01-261-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | data structure called kse_upcall to manage UPCALL. All KSE binding and loaning code are gone. A thread owns an upcall can collect all completed syscall contexts in its ksegrp, turn itself into UPCALL mode, and takes those contexts back to userland. Any thread without upcall structure has to export their contexts and exit at user boundary. Any thread running in user mode owns an upcall structure, when it enters kernel, if the kse mailbox's current thread pointer is not NULL, then when the thread is blocked in kernel, a new UPCALL thread is created and the upcall structure is transfered to the new UPCALL thread. if the kse mailbox's current thread pointer is NULL, then when a thread is blocked in kernel, no UPCALL thread will be created. Each upcall always has an owner thread. Userland can remove an upcall by calling kse_exit, when all upcalls in ksegrp are removed, the group is atomatically shutdown. An upcall owner thread also exits when process is in exiting state. when an owner thread exits, the upcall it owns is also removed. KSE is a pure scheduler entity. it represents a virtual cpu. when a thread is running, it always has a KSE associated with it. scheduler is free to assign a KSE to thread according thread priority, if thread priority is changed, KSE can be moved from one thread to another. When a ksegrp is created, there is always N KSEs created in the group. the N is the number of physical cpu in the current system. This makes it is possible that even an userland UTS is single CPU safe, threads in kernel still can execute on different cpu in parallel. Userland calls kse_create to add more upcall structures into ksegrp to increase concurrent in userland itself, kernel is not restricted by number of upcalls userland provides. The code hasn't been tested under SMP by author due to lack of hardware. Reviewed by: julian
* Revert previous and move the prototype for db_alt_break to ddb.h.jake2002-12-312-7/+4
| | | | Requested by: bde (I think)
* - Add a function db_alt_break which recognizes the character sequence used tojake2002-12-312-1/+51
| | | | | | | | | | implement ALT_BREAK_TO_DEBUGGER. The caller provides a pointer to a state variable to allow different state to be maintained for separate instances of a device. - Use struct vm_map * instead of vm_map_t in db_break.h to avoid its users needing to include vm headers. Requested by: njl
* Add code to ddb to allow backtracing an arbitrary thread.julian2002-12-283-55/+96
| | | | | | | | | | | | | | | | | | | | | | | | (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.
* - Rename the DDB specific %z printf format to %y.mux2002-10-251-2/+2
| | | | | | | | | | - Make DDB use %y instead of %z. - Teach GCC about %y. - Implement support for the C99 %z format modifier. Approved by: re@ Reviewed by: peter Tested on: i386, sparc64
* Remove the process state PRS_WAIT.julian2002-10-211-3/+0
| | | | | | It is never used. I left it there from pre-KSE days as I didn't know if I'd need it or not but now I know I don't.. It's functionality is in TDI_IWAIT in the thread.
* Round out the facilty for a 'bound' thread to loan out its KSEjulian2002-10-091-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | in specific situations. The owner thread must be blocked, and the borrower can not proceed back to user space with the borrowed KSE. The borrower will return the KSE on the next context switch where teh owner wants it back. This removes a lot of possible race conditions and deadlocks. It is consceivable that the borrower should inherit the priority of the owner too. that's another discussion and would be simple to do. Also, as part of this, the "preallocatd spare thread" is attached to the thread doing a syscall rather than the KSE. This removes the need to lock the scheduler when we want to access it, as it's now "at hand". DDB now shows a lot mor info for threaded proceses though it may need some optimisation to squeeze it all back into 80 chars again. (possible JKH project) Upcalls are now "bound" threads, but "KSE Lending" now means that other completing syscalls can be completed using that KSE before the upcall finally makes it back to the UTS. (getting threads OUT OF THE KERNEL is one of the highest priorities in the KSE system.) The upcall when it happens will present all the completed syscalls to the KSE for selection.
* Rename the mutex thread and process states to use a more generic 'LOCK'jhb2002-10-021-3/+3
| | | | | | | | | name instead. (e.g., SLOCK instead of SMTX, TD_ON_LOCK() instead of TD_ON_MUTEX()) Eventually a turnstile abstraction will be added that will be shared with mutexes and other types of locks. SLOCK/TDI_LOCK will be used internally by the turnstile code and will not be specific to mutexes. Making the change now ensures that turnstiles can be dropped in at a later date without affecting the ABI of userland applications.
* Indentation indicates missing braces.phk2002-10-011-1/+2
| | | | Spotted by: FlexeLint
OpenPOWER on IntegriCloud