diff options
| author | Jim Ingham <jingham@apple.com> | 2012-11-30 20:23:19 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2012-11-30 20:23:19 +0000 |
| commit | c5917d9a38ce0e4ad0a8f888f759de382dbe8f2d (patch) | |
| tree | 4adecd07d2319ceb7d1d5028fc69f5244ad287b5 /lldb/tools/driver/Driver.cpp | |
| parent | 69ea91b4028711040aeb4bf46efa95214f693e15 (diff) | |
| download | bcm5719-llvm-c5917d9a38ce0e4ad0a8f888f759de382dbe8f2d.tar.gz bcm5719-llvm-c5917d9a38ce0e4ad0a8f888f759de382dbe8f2d.zip | |
Save and restore terminal state when lldb is suspended with SIGTSTP and resumed with SIGCONT.
Readline & gdb have a bunch of code to handle older UNIX'es with other job control mechanisms.
I didn't try to replicate that.
llvm-svn: 169032
Diffstat (limited to 'lldb/tools/driver/Driver.cpp')
| -rw-r--r-- | lldb/tools/driver/Driver.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 85fec519f37..b410f572a6e 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -1579,6 +1579,24 @@ sigint_handler (int signo) exit (signo); } +void +sigtstp_handler (int signo) +{ + g_driver->GetDebugger().SaveInputTerminalState(); + signal (signo, SIG_DFL); + kill (getpid(), signo); + signal (signo, sigtstp_handler); +} + +void +sigcont_handler (int signo) +{ + g_driver->GetDebugger().RestoreInputTerminalState(); + signal (signo, SIG_DFL); + kill (getpid(), signo); + signal (signo, sigcont_handler); +} + int main (int argc, char const *argv[], const char *envp[]) { @@ -1589,6 +1607,8 @@ main (int argc, char const *argv[], const char *envp[]) signal (SIGPIPE, SIG_IGN); signal (SIGWINCH, sigwinch_handler); signal (SIGINT, sigint_handler); + signal (SIGTSTP, sigtstp_handler); + signal (SIGCONT, sigcont_handler); // Create a scope for driver so that the driver object will destroy itself // before SBDebugger::Terminate() is called. |

