added facility to log a clue for crash handler to hint where things

got stuck/caused a crash.
This commit is contained in:
gardners 2013-02-16 09:09:36 +10:30 committed by Jeremy Lakeman
parent d593b569c1
commit 7cc4324ac6
3 changed files with 7 additions and 2 deletions

View File

@ -861,6 +861,6 @@ extern int last_radio_temperature;
int rhizome_active_fetch_count();
int rhizome_active_fetch_bytes_received(int q);
extern long long bundles_available;
extern char crash_handler_clue[1024];
#endif // __SERVALD_SERVALD_H

View File

@ -361,6 +361,7 @@ void signal_handler(int signal)
char buf[80];
signame(buf, sizeof(buf), signal);
INFOF("Caught %s", buf);
WHYF("The following clue may help: %s",crash_handler_clue);
dump_stack();
switch (signal) {
@ -378,11 +379,13 @@ void signal_handler(int signal)
exit(0);
}
char crash_handler_clue[1024]="no clue";
void crash_handler(int signal)
{
char buf[80];
signame(buf, sizeof(buf), signal);
WHYF("Caught %s", buf);
WHYF("The following clue may help: %s",crash_handler_clue);
dump_stack();
BACKTRACE;
if (config.server.respawn_on_crash) {

4
slip.c
View File

@ -195,7 +195,9 @@ int upper7_decode(struct slip_decode_state *state,unsigned char byte)
{
IN()
if (config.debug.slipdecode)
DEBUGF("state=%d, byte=0x%02x",state->state,byte);
snprintf(crash_handler_clue,1024,
"upper7_decode(): state=%d, byte=0x%02x, rssi_len=%d, dst_offset=%d",
state->state,byte,state->rssi_len,state->dst_offset);
// Parse out inline RSSI reports
if (byte=='{') {