summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2019-02-28 17:52:57 -0500
committerNeale Ranns <nranns@cisco.com>2019-03-01 09:24:09 +0000
commit9e52ef6024a5f130ed542810a8b0ddb2b5fb08b7 (patch)
tree51e218c19e1722ef290061d7a6e69d4b310ead42
parent6d8233c9a55a78631761488ea79b48b9e370a9b3 (diff)
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
-rwxr-xr-xsrc/vlib/unix/main.c6
1 files changed, 6 insertions, 0 deletions
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);