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
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
PROG= kdump
|
PROG= kdump
|
||||||
SRCS= kdump.c subr.c
|
SRCS= kdump.c subr.c
|
||||||
CFLAGS+= -I${SRCTOP}/usr.bin/ktrace
|
CFLAGS+= -I${SRCTOP}/usr.bin/ktrace
|
||||||
|
CFLAGS+= -I${SRCTOP}/lib/libc/gen
|
||||||
|
|
||||||
LIBADD= sysdecode
|
LIBADD= sysdecode
|
||||||
.if ${MK_CASPER} != "no"
|
.if ${MK_CASPER} != "no"
|
||||||
|
|||||||
+20
-3
@@ -40,6 +40,7 @@
|
|||||||
#include <sys/_bitset.h>
|
#include <sys/_bitset.h>
|
||||||
#include <sys/bitset.h>
|
#include <sys/bitset.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
|
#include <sys/exterr_cat.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/event.h>
|
#include <sys/event.h>
|
||||||
@@ -2442,15 +2443,31 @@ ktrstructarray(struct ktr_struct_array *ksa, size_t buflen)
|
|||||||
return;
|
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
|
static void
|
||||||
ktrexterr(struct ktr_exterr *ke)
|
ktrexterr(struct ktr_exterr *ke)
|
||||||
{
|
{
|
||||||
|
char *msg;
|
||||||
struct uexterror *ue;
|
struct uexterror *ue;
|
||||||
|
|
||||||
ue = &ke->ue;
|
ue = &ke->ue;
|
||||||
printf("{ errno %d category %u (src line %u) p1 %#jx p2 %#jx %s }\n",
|
asprintf(&msg, ue->msg, (uintmax_t)ue->p1, (uintmax_t)ue->p2);
|
||||||
ue->error, ue->cat, ue->src_line,
|
printf("{ errno %d %s:%u \"%s\" (category %u p1 %#jx p2 %#jx) }\n",
|
||||||
(uintmax_t)ue->p1, (uintmax_t)ue->p2, ue->msg);
|
ue->error, cat_to_filename(ue->cat), ue->src_line, msg,
|
||||||
|
ue->cat, (uintmax_t)ue->p1, (uintmax_t)ue->p2);
|
||||||
|
free(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user