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
Родитель 17e4d0d167
Коммит f754ee6896
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);