Add CRAWL_STACK_ON_SIGSEGV to crawl and dump the stack on SIGSEGV and

workaround the totally losing linux development experience.
This commit is contained in:
ramiro%netscape.com 1999-09-14 13:54:46 +00:00
Родитель 6f197e46a0
Коммит f8e5598b73
1 изменённых файлов: 30 добавлений и 0 удалений

Просмотреть файл

@ -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 <signal.h>
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) 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 // Hack to get il_ss set so it doesn't fail in xpcompat.c
nsIImageManager *manager; nsIImageManager *manager;
NS_NewImageManager(&manager); NS_NewImageManager(&manager);