mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Replay: encapsulated signal handling
This commit is contained in:
parent
70c4038751
commit
9576be3a21
@ -498,23 +498,7 @@ void Replay::setup()
|
|||||||
logreader.set_save_chek_messages(true);
|
logreader.set_save_chek_messages(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (generate_fpe) {
|
set_signal_handlers();
|
||||||
// SITL_State::_parse_command_line sets up an FPE handler. We
|
|
||||||
// can do better:
|
|
||||||
feenableexcept(FE_INVALID | FE_OVERFLOW);
|
|
||||||
signal(SIGFPE, _replay_sig_fpe);
|
|
||||||
} else {
|
|
||||||
// disable floating point exception generation:
|
|
||||||
int exceptions = FE_OVERFLOW | FE_DIVBYZERO;
|
|
||||||
#ifndef __i386__
|
|
||||||
// i386 with gcc doesn't work with FE_INVALID
|
|
||||||
exceptions |= FE_INVALID;
|
|
||||||
#endif
|
|
||||||
if (feclearexcept(exceptions)) {
|
|
||||||
::fprintf(stderr, "Failed to disable floating point exceptions: %s", strerror(errno));
|
|
||||||
}
|
|
||||||
signal(SIGFPE, SIG_IGN);
|
|
||||||
}
|
|
||||||
|
|
||||||
hal.console->printf("Processing log %s\n", filename);
|
hal.console->printf("Processing log %s\n", filename);
|
||||||
|
|
||||||
@ -595,6 +579,27 @@ void Replay::set_user_parameters(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Replay::set_signal_handlers(void)
|
||||||
|
{
|
||||||
|
if (generate_fpe) {
|
||||||
|
// SITL_State::_parse_command_line sets up an FPE handler. We
|
||||||
|
// can do better:
|
||||||
|
feenableexcept(FE_INVALID | FE_OVERFLOW);
|
||||||
|
signal(SIGFPE, _replay_sig_fpe);
|
||||||
|
} else {
|
||||||
|
// disable floating point exception generation:
|
||||||
|
int exceptions = FE_OVERFLOW | FE_DIVBYZERO;
|
||||||
|
#ifndef __i386__
|
||||||
|
// i386 with gcc doesn't work with FE_INVALID
|
||||||
|
exceptions |= FE_INVALID;
|
||||||
|
#endif
|
||||||
|
if (feclearexcept(exceptions)) {
|
||||||
|
::fprintf(stderr, "Failed to disable floating point exceptions: %s", strerror(errno));
|
||||||
|
}
|
||||||
|
signal(SIGFPE, SIG_IGN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
write out EKF log messages
|
write out EKF log messages
|
||||||
*/
|
*/
|
||||||
|
@ -176,6 +176,7 @@ private:
|
|||||||
const char **parse_list_from_string(const char *str);
|
const char **parse_list_from_string(const char *str);
|
||||||
bool parse_param_line(char *line, char **vname, float &value);
|
bool parse_param_line(char *line, char **vname, float &value);
|
||||||
void load_param_file(const char *filename);
|
void load_param_file(const char *filename);
|
||||||
|
void set_signal_handlers(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user