forked from OSchip/llvm-project
[Driver] Fix a segfault in signal handlers
Summary: If we recieve a SIGCONT or SIGTSTP, while the driver is shutting down (which, sometimes, we do, for reasons which are not completely clear to me), we would crash to due a null pointer dereference. Guard against this situation. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D18965 llvm-svn: 265958
This commit is contained in:
parent
c98de13871
commit
bb5c39d79e
|
@ -1283,7 +1283,9 @@ sigint_handler (int signo)
|
|||
void
|
||||
sigtstp_handler (int signo)
|
||||
{
|
||||
g_driver->GetDebugger().SaveInputTerminalState();
|
||||
if (g_driver)
|
||||
g_driver->GetDebugger().SaveInputTerminalState();
|
||||
|
||||
signal (signo, SIG_DFL);
|
||||
kill (getpid(), signo);
|
||||
signal (signo, sigtstp_handler);
|
||||
|
@ -1292,7 +1294,9 @@ sigtstp_handler (int signo)
|
|||
void
|
||||
sigcont_handler (int signo)
|
||||
{
|
||||
g_driver->GetDebugger().RestoreInputTerminalState();
|
||||
if (g_driver)
|
||||
g_driver->GetDebugger().RestoreInputTerminalState();
|
||||
|
||||
signal (signo, SIG_DFL);
|
||||
kill (getpid(), signo);
|
||||
signal (signo, sigcont_handler);
|
||||
|
|
Loading…
Reference in New Issue