summaryrefslogtreecommitdiffstats
path: root/sys/ddb
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Be consistent about "static" functions: if the function is markedphk2002-09-282-7/+7
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* Constify to kill some warnings.markm2002-09-212-2/+2
|
* Implement db_print_backtrace() if DDB is compiled into the kernel. Thisjhb2002-09-191-0/+3
| | | | | | | | | | | | | | | | | | | | MD function is just a wrapper around db_stack_trace_cmd() that prints out a backtrace of curthread. Currently, this function is only implemented on i386 and alpha (and the alpha version isn't quite tested yet, will do that in a bit). Other changes: - For i386, fix a bug in the raw frame address case. The eip we extract from the passed in frame address does not match the frame we received. Thus, instead of printing a bogus frame with the wrong eip, go ahead and advance frame down to the same frame as the eip we are using. - For alpha, attempt to add a way of doing a raw trace for alpha. Instead of passing a frame address in 'addr', pass in a pointer to a structure containing PC and KSP and use those to start the backtrace. The alpha db_print_backtrace() uses asm to read in the current PC and KSP values into such a request. Tested on: i386 Requested by: many
* Garbage-collected __ELF__ ifdefs.bde2002-09-151-10/+2
| | | | Fixed some style bugs (mainly unused includes).
* Don't use the ELF symbol type to summarily reject symbols inbde2002-09-151-4/+0
| | | | | | | | | | | | | | | X_db_search_symbol(). Otherwise we don't see important symbols in non-verbosely written assembler code. NetBSD already has this. The kld version already has a stronger form of it without really trying -- linker_ddb_search_symbol() doesn't support ddb's symbol search strategy parameter, so the kld X_db_search_symbol() doesn't pass the parameter to linker_ddb...() and linker_ddb...() doesn't make distinctions based on the symbol type. db_elf.c now works better than db_kld.c when it works (which is essentially when there are no modules except the kernel). It works after booting with -d. db_kld.c doesn't work until lots of SYSINIT()s have run.
* Made this work on i386's at least. It wants ELF section headers forbde2002-09-151-2/+34
| | | | | | | | | | | | | | | | | symbol table sections. Reconstruct the necessary section headers from (ksym_start, ksym_end). This was much easier than converting to use module metadata, and just works for static symbols, unlike db_kld when there is no module metadata. Initialize (ksym_start, ksym_end) from bootinfo on i386's only. The boot loader should load section headers for all sections that it loads, and apparently did this for at least the symbol table sections when this file last worked under FreeBSD (on alphas only) and always did this under NetBSD (where this file was obtained from). At least on i386's, boot2 discards the section headers (except for converting them to (bootinfo.bi_symtab, bootinfo.bi_esymtab), and as far as I can tell, loader(8) discards them apart from converting them to the bootinfo values and module metadata.
* Made this compile (but not work). This involved mainly const poisoningbde2002-09-151-8/+18
| | | | | | | | | | | and renaming ALIGNED_POINTER() to _ALIGNED_POINTER() plus the following hacks for i386's: - define _ALIGNED_POINTER() if it is not already defined. Most non-i386 arches define it <machine/param.h> define it in <machine/param.h>, although none actually used it in the kernel. - define ksym_start and ksym_end. Most non-i386 arches still define and initialize these in machdep.c although they didn't used them. Here is a better place to define them but not to initialize them.
* Completely redo thread states.julian2002-09-111-25/+48
| | | | Reviewed by: davidxu@freebsd.org
* db_ps.c:bde2002-08-311-5/+6
| | | | | | | | | | | | | | | | | | | | | | | Don't attempt to follow null pointers for zombie processes in db_ps(). Style fix: use explicit an comparison with NULL for all null pointer checks in db_ps() instead of for half of them. db_interface.c: Fixed ddb's handling of traps from with ddb on i386's only. This was mostly fixed in rev.1.27 (by longjmp()'ing back to the top level) but was completly broken in rev.1.48 (by not unwinding the new state (mainly db_active) either before or after the longjmp(). This mostly never worked for other arches, since rev.1.27 has not been ported and lower level longjmp()'s only handle traps for memory accesses. All cases should be handled at a lower level to provided better control and simplify unwinding of state. Implementation details: don't pretend to maintain db_active in a nested way -- ddb cannot be reentered in a nested way. Use db_active instead of the db_global_jmpbuf_valid flag and longjmp()'s return value for things related to reentering ddb. [re]entering is still not atomic enough.
* When talking about c_db_sym_t, mention that it is not just like db_sym_t:jmallett2002-08-141-1/+1
| | | | | | it's const. Inspired by: bde
* Realign columns in DDB's ps output. Don't waste more horizontal space thanphk2002-08-131-9/+9
| | | | necessary.
OpenPOWER on IntegriCloud