]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
kdb: Handle process enumeration before procinit()
authorMitchell Horne <mhorne@FreeBSD.org>
Wed, 11 Aug 2021 17:40:01 +0000 (14:40 -0300)
committerMitchell Horne <mhorne@FreeBSD.org>
Wed, 11 Aug 2021 17:44:22 +0000 (14:44 -0300)
commit4ccaa87f695c8b9eb31f2ba9ce4913a045755fe0
tree07d13f97deacb0e3682c57af5ebd824880282fa3
parent09319f7d3f8aefe8a6b37b1c2a6d842126a2c181
kdb: Handle process enumeration before procinit()

Make kdb_thr_first() and kdb_thr_next() return sane values if the
allproc list and pidhashtbl haven't been initialized yet. This can
happen if the debugger is entered very early on, for example with the
'-d' boot flag.

This allows remote gdb to attach at such a time, and fixes some ddb
commands like 'show threads'.

Be explicit about the static initialization of these variables. This
part has no functional change.

Reviewed by: markj, imp (previous version)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31495
sys/kern/kern_proc.c
sys/kern/subr_kdb.c