diff options
author | Chris Lattner <sabre@nondot.org> | 2004-01-14 20:58:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-01-14 20:58:17 +0000 |
commit | de31b76784c8c8e673afd2e14480df7644266da3 (patch) | |
tree | 700b2fb3bb02a38391a2e93f3508cd62239ddcad /lib/Debugger | |
parent | f907bac06887abf84fd7b46cd54f8d53ff0272c5 (diff) | |
download | external_llvm-de31b76784c8c8e673afd2e14480df7644266da3.zip external_llvm-de31b76784c8c8e673afd2e14480df7644266da3.tar.gz external_llvm-de31b76784c8c8e673afd2e14480df7644266da3.tar.bz2 |
Fix some exception safety problems
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Debugger')
-rw-r--r-- | lib/Debugger/Debugger.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/lib/Debugger/Debugger.cpp b/lib/Debugger/Debugger.cpp index fd11f23..02c4a8a 100644 --- a/lib/Debugger/Debugger.cpp +++ b/lib/Debugger/Debugger.cpp @@ -117,7 +117,12 @@ void Debugger::createProgram() { /// there is no program currently running, this just silently succeeds. void Debugger::killProgram() { // The destructor takes care of the dirty work. - delete Process; + try { + delete Process; + } catch (...) { + Process = 0; + throw; + } Process = 0; } @@ -128,10 +133,12 @@ void Debugger::stepProgram() { try { Process->stepProgram(); } catch (InferiorProcessDead &IPD) { - delete Process; - Process = 0; + killProgram(); throw NonErrorException("The program stopped with exit code " + itostr(IPD.getExitCode())); + } catch (...) { + killProgram(); + throw; } } @@ -176,10 +183,12 @@ void Debugger::nextProgram() { } } catch (InferiorProcessDead &IPD) { - delete Process; - Process = 0; + killProgram(); throw NonErrorException("The program stopped with exit code " + itostr(IPD.getExitCode())); + } catch (...) { + killProgram(); + throw; } } @@ -190,10 +199,12 @@ void Debugger::finishProgram(void *Frame) { try { Process->finishProgram(Frame); } catch (InferiorProcessDead &IPD) { - delete Process; - Process = 0; + killProgram(); throw NonErrorException("The program stopped with exit code " + itostr(IPD.getExitCode())); + } catch (...) { + killProgram(); + throw; } } @@ -204,9 +215,11 @@ void Debugger::contProgram() { try { Process->contProgram(); } catch (InferiorProcessDead &IPD) { - delete Process; - Process = 0; + killProgram(); throw NonErrorException("The program stopped with exit code " + itostr(IPD.getExitCode())); + } catch (...) { + killProgram(); + throw; } } |