git: 7516130eb912 - main - kdump(1): minimally adapt to exterror category sources
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Aug 2026 21:44:08 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=7516130eb91264b2faf0c532b29a8e27c2ddd098
commit 7516130eb91264b2faf0c532b29a8e27c2ddd098
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2026-08-03 16:51:19 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2026-08-03 21:43:23 +0000
kdump(1): minimally adapt to exterror category sources
Add some minimal handling of category sources other than static kernel
sources. We don't actually look up dynamic sources yet (that would
require extended trace records to add the file names to the trace file
since we can't assume the trace file is running on a kernel with the
same numbers.)
Make the decision to append a "src/" prefix to each file name
dependent on the category source.
Reviewed by: kib
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D58412
---
usr.bin/kdump/kdump.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 398478c2d86c..d7352b28768c 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -2447,13 +2447,32 @@ static const char * const cat_to_filenames[] = {
#include <exterr_cat_filenames.h>
};
+static const char *
+cat_to_file_prefix(int category)
+{
+ switch (EXTERR_CAT_SRC(category)) {
+ case EXTERR_CAT_SRC_KERN_STATIC:
+ return ("sys/");
+ default:
+ return ("");
+ }
+}
+
static const char *
cat_to_filename(int category)
{
- if (category < 0 || (unsigned)category >= nitems(cat_to_filenames) ||
- cat_to_filenames[category] == NULL)
+ switch (EXTERR_CAT_SRC(category)) {
+ case EXTERR_CAT_SRC_KERN_STATIC:
+ if (category < 0 ||
+ (unsigned)category >= nitems(cat_to_filenames) ||
+ cat_to_filenames[category] == NULL)
+ return ("unknown");
+ return (cat_to_filenames[category]);
+ case EXTERR_CAT_SRC_KERN_DYNAMIC:
+ return ("kern:dynamic");
+ default:
return ("unknown");
- return (cat_to_filenames[category]);
+ }
}
static void
@@ -2464,9 +2483,10 @@ ktrexterr(struct ktr_exterr *ke)
ue = &ke->ue;
asprintf(&msg, ue->msg, (uintmax_t)ue->p1, (uintmax_t)ue->p2);
- printf("{ errno %d sys/%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);
+ printf("{ errno %d %s%s:%u \"%s\" (category %u p1 %#jx p2 %#jx) }\n",
+ ue->error, cat_to_file_prefix(ue->cat), cat_to_filename(ue->cat),
+ ue->src_line, msg, ue->cat,
+ (uintmax_t)ue->p1, (uintmax_t)ue->p2);
free(msg);
}