Date: Wed, 22 Apr 2026 00:44:21 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 5c89d661a023 - main - kdump: tweaks for the extended errors decoding Message-ID: <69e819e5.1f66a.6cd4c91a@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5c89d661a023c83a2001cf5b354b09c7d3ac91d8 commit 5c89d661a023c83a2001cf5b354b09c7d3ac91d8 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-04-21 06:13:04 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-04-21 22:57:24 +0000 kdump: tweaks for the extended errors decoding Format the message. Convert category to the source name if known. Still print the raw value for the category, and the values of the EXTERROR() optional arguments. Requested and reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D56542 --- usr.bin/kdump/Makefile | 1 + usr.bin/kdump/kdump.c | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/usr.bin/kdump/Makefile b/usr.bin/kdump/Makefile index 2c5c456a6de5..cef87f665b46 100644 --- a/usr.bin/kdump/Makefile +++ b/usr.bin/kdump/Makefile @@ -5,6 +5,7 @@ PROG= kdump SRCS= kdump.c subr.c CFLAGS+= -I${SRCTOP}/usr.bin/ktrace +CFLAGS+= -I${SRCTOP}/lib/libc/gen LIBADD= sysdecode .if ${MK_CASPER} != "no" diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index d3f2ac882e61..9ebd18646474 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -40,6 +40,7 @@ #include <sys/_bitset.h> #include <sys/bitset.h> #include <sys/errno.h> +#include <sys/exterr_cat.h> #include <sys/time.h> #include <sys/uio.h> #include <sys/event.h> @@ -2442,15 +2443,31 @@ bad_size: return; } +static const char * const cat_to_filenames[] = { +#include <exterr_cat_filenames.h> +}; + +static const char * +cat_to_filename(int category) +{ + if (category < 0 || (unsigned)category >= nitems(cat_to_filenames) || + cat_to_filenames[category] == NULL) + return ("unknown"); + return (cat_to_filenames[category]); +} + static void ktrexterr(struct ktr_exterr *ke) { + char *msg; struct uexterror *ue; ue = &ke->ue; - printf("{ errno %d category %u (src line %u) p1 %#jx p2 %#jx %s }\n", - ue->error, ue->cat, ue->src_line, - (uintmax_t)ue->p1, (uintmax_t)ue->p2, ue->msg); + asprintf(&msg, ue->msg, (uintmax_t)ue->p1, (uintmax_t)ue->p2); + printf("{ errno %d %s:%u \"%s\" (category %u p1 %#jx p2 %#jx) }\n", + ue->error, cat_to_filename(ue->cat), ue->src_line, msg, + ue->cat, (uintmax_t)ue->p1, (uintmax_t)ue->p2); + free(msg); } static voidhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69e819e5.1f66a.6cd4c91a>
