Commit graph

34 commits

Author SHA1 Message Date
Mark Johnston 2524b7dfb0 crashinfo: Print stack traces for all on-CPU threads
Add a python script which implements the bulk of this functionality.
Over time, this would ideally evolve into a library of python routines
which can be used to inspect kernel data structures and automate some
debugging tasks, similar to jhb's out-of-tree scripts, but written in a
somewhat nicer language and with better integration into the kgdb
command prompt.

Note that kgdb currently won't auto-load scripts in this directory.
This should perhaps change in the future.  It probably also makes more
sense to have a crashinfo.py which provides all the kgdb output that we
want to include in core.txt, rather than having crashinfo.sh pipe in
several commands.

Reviewed by:	avg, imp
Discussed with:	jhb
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33817
2024-01-15 16:36:40 -05:00
Mark Johnston 3e356fb885 crashinfo: Get local variable values in the gdb backtrace
This should make crash reports a bit more useful without having to ask
for additional information.

Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42465
2023-11-06 14:59:10 -05:00
Ed Maste 13a9745746 crashinfo: remove unused /usr/bin/gdb support
We have not had gdb 6.1 in the base system for some time; there is no
need to check for it.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34478
2023-11-04 21:45:15 -04:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Jens Schweikhardt 4ee44ffcca Indicate that kgdb.1 is from ports/devel/gdb. 2022-08-14 15:17:29 +02:00
Ed Maste 55e6cbc4d0 crashinfo: Add references to the gdb port/package
We intend to remove the obsolete GDB 6.1.1 from FreeBSD before FreeBSD 13.

Reviewed by	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27447
2020-12-02 19:58:50 +00:00
Gordon Bergling 26762c66e4 crashinfo(8): Fix a few mandoc warnings
- new sentence, new line
2020-11-20 16:59:51 +00:00
Alexander Leidinger 32fd57a8e1 Remove nfsstat. Running nfsstat in crashinfo will give the stats of the
running kernel instead of the stats of the crashed kernel. The current
version uses sysctls to query the stats and does not work at all (anymore)
on crash dumps.
2020-10-01 08:57:36 +00:00
Ed Maste 33bb3dbe38 crashinfo: stop looking for gdb in /usr/bin/gdb
As of r359457 we removed the GDB_LIBEXEC option, always installing in-tree
gdb into /usr/libexec/.  Thus, there is now no need for crashinfo to include
/usr/bin/gdb in the list of pathnames to check when looking for gdb.
2020-06-08 16:11:44 +00:00
John Baldwin 6f77212f27 Support compressed crash dumps in crashinfo(8).
Temporarily decompress a copy of a crash dump compressed with either
gzip or zstd and run various tools against the decompressed copy while
generating the crash information.  The uncompressed copy is deleted when
the script exits.

Note that crashinfo is enabled by default, so this will attempt to
decompress the most recent compressed crash dump after a crash that
generates a compressed crash dump.  Users who wish to only do offline
analysis of compressed crash dumps can disable crashinfo in rc.conf.

Tested by:	ler
Reviewed by:	markj
MFC after:	2 weeks
2018-07-23 18:08:56 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Mark Johnston 5a3924b985 Allow matches of truncated version strings.
Long objdir paths make it easy to hit the version string length limit in
kernel dump headers. The build number and timestamp are unlikely to be
truncated and ought to be sufficient to protect against false positives.

Discussed with:	jhb
MFC after:	1 week
2017-07-19 18:41:16 +00:00
Eric van Gyzen 1f1ed24cc5 crashinfo: add "batch" mode and use it during boot
In batch mode, most messages go into the core.txt.N file instead of stdout.

Reviewed by:	jhb
MFC after:	3 days
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10429
2017-06-01 21:23:04 +00:00
John Baldwin 73ad3fb536 Add a new GDB_LIBEXEC option to install gdb and kgdb to /usr/libexec.
When this option is enabled, only gdb and kgdb are installed to
/usr/libexec for use by crashinfo(8). Other bits of GDB such as
gdbserver and gdbtui are not installed. For this option to be
effective, GDB must be enabled.

Rework r317094 to re-enable GDB on all platforms but enable
GDB_LIBEXEC on platforms for which the GDB in ports is a superset of
functionality.

Reviewed by:	emaste, kib
Suggested by:	kib
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D10449
2017-04-25 18:08:56 +00:00
John Baldwin 241cf416c9 Update crashinfo to work with newer gdb from ports.
If gdb from ports is installed, use it instead of the base system gdb
to extract variables from a kernel.  Note that base gdb and ports gdb
do not support the same options for invoking a single command in batch
mode, so a wrapper shell function is used.  In addition, prefer kgdb
from ports when generating a backtrace if present.

PR:		193335
Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D7218
2016-07-20 18:41:47 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Gleb Smirnoff 5a6d2af301 Remove 'netstat -anr' from crashinfo. 2015-04-09 07:49:42 +00:00
Simon J. Gerraty 3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Sergey Kandaurov 16aaaa690f Do not truncate the `command'' column in `ps'' output.
Reviewed by:	jhb
MFC after:	1 week
2013-12-25 15:23:01 +00:00
Gleb Smirnoff c1fd62d4c1 Remove 'netstat -i' from crashinfo, as this no longer is supported. 2013-10-31 20:30:56 +00:00
Simon J. Gerraty d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Gavin Atkinson 2710901380 Allow more space for interface names.
MFC after:	1 week
2013-08-27 15:06:39 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ed Maste 7ad50a360b Improve multi-line kernel ident parsing
Instead of blindly grabbing the line with 'Version string' and the
following one from the core info file, take all lines after 'Version
string' until the one one that matches the field format in the core info
file.  This provides compatibility with VendorBSD modifications that have
a different kernel ident format.

Reviewed by:	jhb
2012-03-07 18:46:21 +00:00
Colin Percival 9decd44681 Teach crashinfo(8) to look at the currently running kernel (based on the
kern.bootfile sysctl).  Prior to this commit, crashinfo(8) only looks at
/boot/*/kernel; this includes the usual places where kernels reside, so
for most systems this will have no effect.

Approved by:	jhb
MFC after:	3 days
2010-11-30 16:04:40 +00:00
Xin LI 59bf36c3a7 Set umask to 0x077 instead of the default. This prevents non-root user
from reading crashinfo output, which could contain some sensitive
information.

Reviewed by:	jhb
MFC after:	1 week
2009-11-03 09:17:23 +00:00
John Baldwin c5229b9d2b Include the output of the ddb(4) capture buffer.
Submitted by:	Mikolaj Golub  to my trociny of gmail
MFC after:	3 days
2009-10-29 13:45:33 +00:00
Ruslan Ermilov 20ba6b0d61 Fixed markup. 2009-09-17 19:15:49 +00:00
Christian Brueffer 2a72feb42b Correct the information about when the respective functionality first
appeared in FreeBSD.

PR:		133785
Submitted by:	Ulrich Spoerlein <uqs@spoerlein.net>
MFC after:	3 days
2009-04-23 08:37:56 +00:00
John Baldwin a37f97161c Add a script to perform simple analysis of a crash dump (either a full
dump or minidump).  When the script is run, it generates a text file
containing the output of several commands run againt the core dump such
as kgdb (stack trace), ps, netstat, vmstat, iostat, dmesg, and fstat.

Obtained from:	Yahoo!
MFC after:	2 weeks
2008-08-05 20:41:46 +00:00