Save signum and faulting address in static variables
Comes in handy when looking at core files from optimized images.
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I45c8400d15614d5a04a3dcfb9b7daccab47ab446
diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c
index 08f0506..bf66407 100755
--- a/src/vlib/unix/main.c
+++ b/src/vlib/unix/main.c
@@ -88,12 +88,18 @@
dangerous to vec_resize it when crashing, mheap itself might have been
corruptted already */
static u8 *syslog_msg = 0;
+static int last_signum = 0;
+static uword last_faulting_address = 0;
static void
unix_signal_handler (int signum, siginfo_t * si, ucontext_t * uc)
{
uword fatal = 0;
+ /* These come in handy when looking at core files from optimized images */
+ last_signum = signum;
+ last_faulting_address = (uword) si->si_addr;
+
syslog_msg = format (syslog_msg, "received signal %U, PC %U",
format_signal, signum, format_ucontext_pc, uc);