Commit Graph

522 Commits

Author SHA1 Message Date
uwe 053fb2b498 ddb: PR kern/57435 - fix duplicate "show mount"
Bolivar cannot carry double.  One of these commands should have been
"show mounts", cf. page/pages and a few others.  While here fix the
function name to be db_show_all_mounts to conform to the pattern.
2023-05-25 21:46:55 +00:00
riastradh 7b4abd4b1d ddb(4): Declare extern db_active if _KMEMUSER too, not just DDB.
crash(8) is built with _KMEMUSER defined but DDB not defined except
for a few specific files or on MIPS.

Seems to me crash(8) should really be built with DDB defined in all
.c files but that leads to other fallout I'm not really inclined to
diagnose right now.
2022-10-27 20:00:24 +00:00
riastradh dbfa10e52a ddb/db_active.h: New home for extern db_active.
This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero.  Reduces need for #include opt_ddb.h, #ifdef DDB.
2022-10-26 23:38:05 +00:00
riastradh 5ec46ddfac ddb(9): Make db_symstr safe to use concurrently with pserialize(9). 2022-08-30 22:38:01 +00:00
riastradh 953ad39a79 ddb(4): Use db_num_to_strbuf in db_symstr.
Simplifies it and will make safer to use.
2022-08-30 22:37:36 +00:00
riastradh 3566aefb0b ddb(9): New db_num_to_strbuf.
Like db_num_to_str, but writes to caller-provided buffer instead of
returning pointer to static storage.
2022-08-30 22:37:03 +00:00
msaitoh 5082768d7f Remove 'a' modifier from "show vmem". It was removed in sbur_vmem.c rev. 1.55. 2022-04-28 07:08:38 +00:00
uwe 6b33e13a13 ddb: guard invocation of db_cmd_on_enter properly.
db_command_loop - do not ignore the return value from setjmp used to
guard db_cmd_on_enter.  We do not want to re-execute the enter command
if it fails.  Note that "fails" includes e.g. aborting long output
from the enter command with "q" at the --db more-- prompt, which is
quite likely as the default enter command is "bt".

While here, don't even bother with the whole song and dance if the
enter command is not set.
2022-04-20 19:06:35 +00:00
andvar 75d2abaeb1 fix various typos in comments and output/log messages. 2022-04-10 09:50:44 +00:00
riastradh b6c8c37ff6 sys: Split struct device into a private device_impl.h.
Include this only inside autoconf itself, and a few files that abuse
autoconf in ways I can't confidently make easy fixes for.

XXX kernel ABI change requires bump -- no more use of struct device
internals allowed, previously done by some drivers
2022-03-28 12:38:57 +00:00
kre 30ec2d6e25 mv out: label into the #ifdef _KERNEL section, as it is only
referenced from there.  Hopefully ubbreak buikd of usr.sbin/crash
2021-12-13 03:17:50 +00:00
chs 6ee08449c7 ddb: fix function names of "noreturn" functions in stack traces.
when looking up function names for stack traces (where the addresses are the
return addresses of function calls), if the address is the first instruction
in the function, assume that the function being called is marked "noreturn"
and that the function containing the call is actually the function immediately
before the address that we looked up.  to find the correct function name,
do the lookup again with (address - 1) and then add one to the offset within
the function that we find.
2021-12-13 01:25:29 +00:00
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