Fix, simplify, no crash dump on SIGTERM.

This commit is contained in:
Glenn Maynard
2003-07-29 21:11:21 +00:00
parent 676fcb90fc
commit d1a11d8f24
2 changed files with 4 additions and 5 deletions
+3 -4
View File
@@ -71,7 +71,7 @@ static void parent_write(int to_child, const void *p, size_t size)
static void parent_process( int to_child, void **BacktracePointers, int SignalReceived ) static void parent_process( int to_child, void **BacktracePointers, int SignalReceived )
{ {
/* 1. Write the backtrace pointers. */ /* 1. Write the backtrace pointers. */
parent_write(to_child, BacktracePointers, sizeof(BacktracePointers)); parent_write(to_child, BacktracePointers, sizeof(void *)*BACKTRACE_MAX_SIZE);
/* 2. Write the signal. */ /* 2. Write the signal. */
parent_write(to_child, &SignalReceived, sizeof(SignalReceived)); parent_write(to_child, &SignalReceived, sizeof(SignalReceived));
@@ -286,8 +286,7 @@ static void do_backtrace( void **buf, size_t size, bool ignore_before_sig = true
sigcontext sig; sigcontext sig;
}; };
struct StackFrame *frame; StackFrame *frame = (StackFrame *) __builtin_frame_address(0);
asm("mov %%ebp, %%eax": "=a" (frame) );
unsigned i=0; unsigned i=0;
/* If ignore_before_sig is true, don't return stack frames before we find a signal trampoline. */ /* If ignore_before_sig is true, don't return stack frames before we find a signal trampoline. */
@@ -370,7 +369,7 @@ static void do_backtrace(void **buf, size_t size)
void CrashSignalHandler( int signal ) void CrashSignalHandler( int signal )
{ {
/* Don't dump a debug file if the user just hit ^C. */ /* Don't dump a debug file if the user just hit ^C. */
if( signal == SIGINT ) if( signal == SIGINT || signal == SIGTERM )
return; return;
static bool received = false; static bool received = false;
@@ -169,7 +169,7 @@ static void child_process()
/* 1. Read the backtrace pointers. */ /* 1. Read the backtrace pointers. */
void *BacktracePointers[BACKTRACE_MAX_SIZE]; void *BacktracePointers[BACKTRACE_MAX_SIZE];
ret = read(3, BacktracePointers, sizeof(BacktracePointers)); ret = read(3, BacktracePointers, sizeof(void *)*BACKTRACE_MAX_SIZE);
/* 2. Read the signal. */ /* 2. Read the signal. */
int SignalReceived; int SignalReceived;