[llvm-commits] CVS: llvm/lib/Debugger/Debugger.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Jan 14 14:59:01 PST 2004
Changes in directory llvm/lib/Debugger:
Debugger.cpp updated: 1.1 -> 1.2
---
Log message:
Fix some exception safety problems
---
Diffs of the changes: (+22 -9)
Index: llvm/lib/Debugger/Debugger.cpp
diff -u llvm/lib/Debugger/Debugger.cpp:1.1 llvm/lib/Debugger/Debugger.cpp:1.2
--- llvm/lib/Debugger/Debugger.cpp:1.1 Sun Jan 4 23:25:10 2004
+++ llvm/lib/Debugger/Debugger.cpp Wed Jan 14 14:58:17 2004
@@ -117,7 +117,12 @@
/// 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 @@
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 @@
}
} 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 @@
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 @@
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;
}
}
More information about the llvm-commits
mailing list