From f754ee6896ac9a51f7eb82e417db91b8b2b014f3 Mon Sep 17 00:00:00 2001 From: "ramiro%netscape.com" Date: Tue, 14 Sep 1999 13:54:46 +0000 Subject: [PATCH] Add CRAWL_STACK_ON_SIGSEGV to crawl and dump the stack on SIGSEGV and workaround the totally losing linux development experience. --- webshell/tests/viewer/unix/gtk/nsGtkMain.cpp | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp b/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp index b2292b4f6b5..5d9f36695e2 100644 --- a/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp +++ b/webshell/tests/viewer/unix/gtk/nsGtkMain.cpp @@ -95,8 +95,38 @@ nsNativeBrowserWindow::DispatchMenuItem(PRInt32 aID) //---------------------------------------------------------------------- + +#ifdef DEBUG_ramiro +#define CRAWL_STACK_ON_SIGSEGV +#endif // DEBUG_ramiro + + +#ifdef CRAWL_STACK_ON_SIGSEGV +#include "nsTraceRefcnt.h" +#include + +void +sigsegv_handler(int signum) +{ + PR_CurrentThread(); + + printf("sigsegv_handler(signum = %d)\n",signum); + + char stack[4096]; + + nsTraceRefcnt::WalkTheStack(stack, sizeof(stack)); + + printf("stack = %s\n",stack); +} +#endif // CRAWL_STACK_ON_SIGSEGV + int main(int argc, char **argv) { +#ifdef CRAWL_STACK_ON_SIGSEGV + signal(SIGSEGV, sigsegv_handler); + signal(SIGILL, sigsegv_handler); +#endif // CRAWL_STACK_ON_SIGSEGV + // Hack to get il_ss set so it doesn't fail in xpcompat.c nsIImageManager *manager; NS_NewImageManager(&manager);