|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
#include <sys/wait.h>
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/ucontext.h>
|
|
|
|
|
#include <sys/utsname.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <limits.h>
|
|
|
|
@ -54,18 +55,18 @@ static const struct {
|
|
|
|
|
const char *name;
|
|
|
|
|
int signum;
|
|
|
|
|
} signals[] = {
|
|
|
|
|
{ "Segmentation fault", SIGSEGV },
|
|
|
|
|
{ "Illegal instruction", SIGILL },
|
|
|
|
|
{ "FPU exception", SIGFPE },
|
|
|
|
|
{ "System BUS error", SIGBUS },
|
|
|
|
|
{ NULL, 0 }
|
|
|
|
|
{ "Segmentation fault", SIGSEGV },
|
|
|
|
|
{ "Illegal instruction", SIGILL },
|
|
|
|
|
{ "FPU exception", SIGFPE },
|
|
|
|
|
{ "System BUS error", SIGBUS },
|
|
|
|
|
{ NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const struct {
|
|
|
|
|
int code;
|
|
|
|
|
const char *name;
|
|
|
|
|
} sigill_codes[] = {
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
{ ILL_ILLOPC, "Illegal opcode" },
|
|
|
|
|
{ ILL_ILLOPN, "Illegal operand" },
|
|
|
|
|
{ ILL_ILLADR, "Illegal addressing mode" },
|
|
|
|
@ -74,7 +75,7 @@ static const struct {
|
|
|
|
|
{ ILL_PRVREG, "Privileged register" },
|
|
|
|
|
{ ILL_COPROC, "Coprocessor error" },
|
|
|
|
|
{ ILL_BADSTK, "Internal stack error" },
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -97,10 +98,10 @@ static const struct {
|
|
|
|
|
int code;
|
|
|
|
|
const char *name;
|
|
|
|
|
} sigsegv_codes[] = {
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
{ SEGV_MAPERR, "Address not mapped to object" },
|
|
|
|
|
{ SEGV_ACCERR, "Invalid permissions for mapped object" },
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -108,11 +109,11 @@ static const struct {
|
|
|
|
|
int code;
|
|
|
|
|
const char *name;
|
|
|
|
|
} sigbus_codes[] = {
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
#ifndef __FreeBSD__
|
|
|
|
|
{ BUS_ADRALN, "Invalid address alignment" },
|
|
|
|
|
{ BUS_ADRERR, "Non-existent physical address" },
|
|
|
|
|
{ BUS_OBJERR, "Object specific hardware error" },
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
{ 0, NULL }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -175,13 +176,17 @@ static void gdb_info(pid_t pid)
|
|
|
|
|
static void sys_info(void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef __unix__
|
|
|
|
|
system("echo \"System: `uname -a`\"");
|
|
|
|
|
putchar('\n');
|
|
|
|
|
struct utsname info;
|
|
|
|
|
if(!uname(&info))
|
|
|
|
|
printf("!!! Failed to get system information\n");
|
|
|
|
|
else
|
|
|
|
|
printf("System: %s %s %s %s %s\n",
|
|
|
|
|
info.sysname, info.nodename, info.release, info.version, info.machine);
|
|
|
|
|
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static size_t safe_write(int fd, const void *buf, size_t len)
|
|
|
|
|
{
|
|
|
|
|
size_t ret = 0;
|
|
|
|
|