From 26d9d3e4e6915f312b3430af2b801ac4d4c0e443 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 25 Aug 2014 18:35:59 +0200 Subject: [PATCH] make 'PM: INIT died' message debuggable . PM: print init stacktrace and exit status . init: include debug info in executable . sanity-check against one of the possible causes, missing dev nodes on the ramdisk Change-Id: I813bae174c00dba51a07daf3b7def240e8d1f87b --- minix/drivers/storage/ramdisk/Makefile | 5 +++-- minix/servers/pm/forkexit.c | 3 ++- sbin/init/Makefile | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/minix/drivers/storage/ramdisk/Makefile b/minix/drivers/storage/ramdisk/Makefile index 5edb62fea..47760acf3 100644 --- a/minix/drivers/storage/ramdisk/Makefile +++ b/minix/drivers/storage/ramdisk/Makefile @@ -201,8 +201,9 @@ proto.dev.mtree: proto.dev: proto.dev.mtree etc/pwd.db etc/spwd.db etc/passwd etc/group ${TOOL_MTREE} -f ${.TARGET}.mtree -N ${.OBJDIR}/etc -C -K device | \ ${TOOL_TOPROTO} | ${TOOL_SED} -e '1,4d' | \ - ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp && \ - mv ${.TARGET}.tmp ${.TARGET} + ${TOOL_SED} -e '$$d' |${TOOL_SED} -e '$$d' > ${.TARGET}.tmp + grep console ${.TARGET}.tmp # sanity check; is there a console entry? + mv ${.TARGET}.tmp ${.TARGET} proto.gen: ${PROTO} ${PROTO_FILES} proto.dev ${PROGRAMS} ${STRIP} ${PROGRAMS} diff --git a/minix/servers/pm/forkexit.c b/minix/servers/pm/forkexit.c index a221d3c9f..218fff5e0 100644 --- a/minix/servers/pm/forkexit.c +++ b/minix/servers/pm/forkexit.c @@ -314,7 +314,8 @@ int dump_core; /* flag indicating whether to dump core */ vm_notify_sig_wrapper(rmp->mp_endpoint); if (proc_nr_e == INIT_PROC_NR) { - printf("PM: INIT died\n"); + printf("PM: INIT died with exit status %d; showing stacktrace\n", exit_status); + sys_diagctl_stacktrace(proc_nr_e); return; } if (proc_nr_e == VFS_PROC_NR) diff --git a/sbin/init/Makefile b/sbin/init/Makefile index 602b5e07a..03f4fdd96 100644 --- a/sbin/init/Makefile +++ b/sbin/init/Makefile @@ -7,6 +7,12 @@ DPADD= ${LIBUTIL} LDADD= -lutil CPPFLAGS+= -DMFS_DEV_IF_NO_CONSOLE -DSUPPORT_UTMP -DSUPPORT_UTMPX +#.if defined(__MINIX) +# BJG - by default produce line numbers in case init exits without producing +# output +DBG=-g +#.endif + .ifdef INIT_CHROOT CPPFLAGS+= -DCHROOT .elifdef SMALLPROG