From 9e52ef6024a5f130ed542810a8b0ddb2b5fb08b7 Mon Sep 17 00:00:00 2001 From: Dave Barach Date: Thu, 28 Feb 2019 17:52:57 -0500 Subject: Save signum and faulting address in static variables Comes in handy when looking at core files from optimized images. Signed-off-by: Dave Barach Change-Id: I45c8400d15614d5a04a3dcfb9b7daccab47ab446 --- src/vlib/unix/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c index 08f0506fbc2..bf66407f0be 100755 --- a/src/vlib/unix/main.c +++ b/src/vlib/unix/main.c @@ -88,12 +88,18 @@ unsetup_signal_handlers (int sig) 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); -- cgit 1.2.3-korg