Commit Graph

510 Commits

Author SHA1 Message Date
thorpej c5931c832d Add a "show kqueue <addr>" command. 2021-10-10 18:08:12 +00:00
uwe 4d98da76c8 Sort variable declarations. Add short comments while here.
The list was neither sorted nor grouped logically when db_dumpstack
and db_panicstackframes were added to modify the panic behavior.
2021-10-06 17:04:49 +00:00
uwe 3051541536 KNF: The function type must be declared on a line by itself. 2021-10-06 12:18:20 +00:00
uwe 74286622f8 Add DDB_DUMPSTACK to opt_ddbparam.h.
PR kern/56445
2021-10-06 12:14:51 +00:00
uwe aeaee0d51e One option per-line for opt_ddbparam.h options. Sort. 2021-10-06 12:12:39 +00:00
andvar c69f42d323 fix mainly same typos as in my previous commit but outside sys/dev/dm. 2021-08-21 23:00:30 +00:00
andvar ebbc7028d3 fix typos in words "pointer" and s/fram /frame/ 2021-08-13 20:47:54 +00:00
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
christos bf4e24e79b need <sys/param.h> for COHERENCY_UNIT 2021-07-20 11:39:16 +00:00
mrg d3874c24e6 don't provide db_lstacktrace() for crash (yet?). 2021-04-18 01:28:50 +00:00
mrg e2d256dc93 db_lstacktrace() can't use db_stacktrace_print and log() directly.
log() takes a 'int level' first argument, that must be supplied.
add an inline wrapper that calls vlog() with LOG_INFO, and the
supplied va_list.

(not noticed because this macro is not used anywhere in src but
i have a use in some uncommited code, that now failed to compile.)
2021-04-18 01:05:23 +00:00
mrg b80645cc71 avoid assigning both signed and unsigned variables in the same statement. 2021-04-12 02:49:02 +00:00
mrg 110ac605f8 introduce DDB_END_CMD and replace more than 20 copies of the same
list of NULLs and 0.  idea from rillig@.

all touched ports built, several booted.
2021-02-23 07:13:51 +00:00
simonb 5267a28fdc Allow for MD code to use a different function than db_stack_trace_print()
to be used with db_stacktrace() and friends by pre-defining the
db_stacktrace_print macro.
2021-02-10 07:17:39 +00:00
dbj 99cd27f7ea defparam DB_MAX_WIDTH 2021-02-06 16:03:26 +00:00
simonb 0df872764f For "ps/a" print all of p_comm instead of just the first 10 chars, add a
space after PID, left justify the command name.
2021-01-11 07:49:04 +00:00
mrg e17ac28afe update several items that are done or dead. 2020-12-19 23:32:36 +00:00
skrll d20ab3a0c2 Remove "also;" 2020-10-30 16:29:49 +00:00
skrll 155f2770cc Add a "show fdt" ddb command 2020-10-30 16:08:44 +00:00
skrll 3d56dc6d58 Sort the db_show_cmd entries 2020-10-30 07:17:29 +00:00
skrll 9fe75a0d78 Put the 'added from all sub cmds' comment above the four commands that
were added as part of the work in r1.98
2020-10-30 07:03:50 +00:00
skrll 0bdfd0c319 Whitespace 2020-10-30 06:59:43 +00:00
skrll f157d2e256 Trailing whitespace 2020-10-30 06:57:08 +00:00
uwe 54e5d2611a db_get_line - raw access to the DDB command line.
Provide a way for DDB commands to access the remainder of the command
line as-is.
2020-07-29 23:29:42 +00:00
simonb afb79ab05b Protect against multiple inclusion. 2020-06-28 04:06:14 +00:00
rin d76d437a3f Switch from kmem_intr_alloc(sz, KM_NOSLEEP) to kmem_alloc(sz, KM_SLEEP).
Clearly document these functions are *not* for DDB session, but for
permanent data storage when initializing DDB.
2020-05-31 23:34:34 +00:00
rin c3cc3a31be Revert introduction of db_alloc.h.
db_alloc() and friends are already provided in crash.c.
Sorry for confusing you...
2020-05-31 09:51:55 +00:00
rin 223a0956ca XXX
DDB can be running in the interrupt context, e.g., when activated from
console. Therefore, we use kmem_intr_alloc(9) and friends in order to
avoid assertion failure.
2020-05-31 09:42:46 +00:00
rin cd246064d2 Introduce db_alloc.h.
Provide db_alloc() and friends to userland, i.e., crash(8).
2020-05-31 09:40:09 +00:00
ad 0eaaa024ea Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2020-05-23 23:42:41 +00:00
skrll 15572d36c9 Handle "no count" properly in db_kernhist_print_cmd 2020-04-13 11:43:27 +00:00
mlelstv 06d11bb0d0 also print the LWP reference count. 2020-04-04 13:59:16 +00:00
maya 5f3e77959d Remove a.out leftovers (unused) 2020-03-30 20:45:59 +00:00
christos 5a4646458a Make the db_kernelonly() macro visible to all files and re-use it.
Register access is kernel only.
2020-03-10 15:58:36 +00:00
christos 18fbafecbc print a message for the commands crash does not support.
Allow "show lock"
2020-03-09 01:46:24 +00:00
hikaru 5a05c3b804 Correct PPID of "show all procs/n" 2020-02-26 07:57:24 +00:00
ad 82002773ec - Move the LW_RUNNING flag back into l_pflag: updating l_flag without lock
in softint_dispatch() is risky.  May help with the "softint screwup"
  panic.

- Correct the memory barriers around zombies switching into oblivion.
2020-02-15 18:12:14 +00:00
riastradh 17201b1c03 Load struct fdfile::ff_file with atomic_load_consume.
Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper.  And a little clearer without a long comment.)
2020-02-01 02:23:23 +00:00
riastradh 8e6cd4ce57 Load struct filedesc::fd_dt with atomic_load_consume.
Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
  => This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
  => atomic_load_consume serves the same purpose now.
  => Was needed only on alpha anyway.
2020-02-01 02:23:03 +00:00
uwe 3c58a5dbfe Fix typo in comment. 2020-01-26 01:42:55 +00:00
ad 2ddceed1d9 Hopefully fix some problems seen with MP support on non-x86, in particular
where curcpu() is defined as curlwp->l_cpu:

- mi_switch(): undo the ~2007ish optimisation to unlock curlwp before
  calling cpu_switchto().  It's not safe to let other actors mess with the
  LWP (in particular l->l_cpu) while it's still context switching.  This
  removes l->l_ctxswtch.

- Move the LP_RUNNING flag into l->l_flag and rename to LW_RUNNING since
  it's now covered by the LWP's lock.

- Ditch lwp_exit_switchaway() and just call mi_switch() instead.  Everything
  is in cache anyway so it wasn't buying much by trying to avoid saving old
  state.  This means cpu_switchto() will never be called with prevlwp ==
  NULL.

- Remove some KERNEL_LOCK handling which hasn't been needed for years.
2020-01-08 17:38:41 +00:00
thorpej 599c240526 - Introduce a new global kernel variable "shutting_down" to indicate that
the system is shutting down or rebooting.
- Set this global in a new function called kern_reboot(), which is currently
  just a basic wrapper around cpu_reboot().
- Call kern_reboot() instead of cpu_reboot() almost everywhere; a few
  places remain where it's still called directly, but those are in early
  pre-main() machdep locations.

Eventually, all of the various cpu_reboot() functions should be re-factored
and common functionality moved to kern_reboot(), but that's for another day.
2020-01-01 22:57:16 +00:00
ad 9b1e2fa25c Redo the page allocator to perform better, especially on multi-core and
multi-socket systems.  Proposed on tech-kern.  While here:

- add rudimentary NUMA support - needs more work.
- remove now unused "listq" from vm_page.
2019-12-27 12:51:56 +00:00
joerg fcbdfe5fba Teach ddb(4) about printing the full mount list. 2019-12-15 20:29:08 +00:00
ad c8d15fa565 Fix crash(8). Will revisit. 2019-11-22 23:01:49 +00:00
rin df564de276 Simplify logic to get rid of implicit dependence on order of ASCII
codes of upper and lower cases ('a' > 'A').

Found by the lgtm bot.

No functional changes intended.
2019-10-02 09:36:30 +00:00
uwe dc64369beb db_command - don't hide local static variable in the middle of other
local variable definitions.  While here, get rid of the alignment of
variable names.
2019-09-29 02:49:59 +00:00
uwe 59ae426bf2 db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.
2019-09-29 02:42:12 +00:00
uwe a11e9371ac db_command - make sure count is always initialized. 2019-09-29 02:35:39 +00:00
uwe 22d01b8c34 Print db> prompt in db_read_line(), not db_readline().
The former is what DDB repl calls.  The latter performs the actual
input so let other code use it without the unwanted db> prompt.  It's
already used by ACPI (and AcpiOsWaitCommandReady supplies its own
prompt).  I also use it for my uncommitted Forth scripting for DDB.
2019-09-29 02:00:22 +00:00