mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
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
This commit is contained in:
1 parent
5dff273d68
commit
7516130eb9
1 file changed
+26
-6
+26
-6
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user