Remove support for breakpoints (not used).

Remove some dead code and whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke
2003-09-04 23:15:40 +00:00
parent 8e53948881
commit 9ad671d540
3 changed files with 8 additions and 47 deletions

View File

@@ -1019,10 +1019,9 @@ void Interpreter::callFunction(Function *F,
StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end()); StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end());
} }
// executeInstruction - Interpret a single instruction, increment the "PC", and // executeInstruction - Interpret a single instruction & increment the "PC".
// return true if the next instruction is a breakpoint...
// //
bool Interpreter::executeInstruction() { void Interpreter::executeInstruction() {
assert(!ECStack.empty() && "No program running, cannot execute inst!"); assert(!ECStack.empty() && "No program running, cannot execute inst!");
ExecutionContext &SF = ECStack.back(); // Current stack frame ExecutionContext &SF = ECStack.back(); // Current stack frame
@@ -1037,11 +1036,8 @@ bool Interpreter::executeInstruction() {
// instruction execution... // instruction execution...
// //
if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) { if (int SigNo = sigsetjmp(SignalRecoverBuffer, 1)) {
--SF.CurInst; // Back up to erroring instruction
std::cout << "EXCEPTION OCCURRED [" << strsignal(SigNo) << "]\n"; std::cout << "EXCEPTION OCCURRED [" << strsignal(SigNo) << "]\n";
exit(1); exit(1);
InInstruction = false;
return true;
} }
InInstruction = true; InInstruction = true;
@@ -1050,11 +1046,6 @@ bool Interpreter::executeInstruction() {
// Reset the current frame location to the top of stack // Reset the current frame location to the top of stack
CurFrame = ECStack.size()-1; CurFrame = ECStack.size()-1;
if (CurFrame == -1) return false; // No breakpoint if no code
// Return true if there is a breakpoint annotation on the instruction...
return ECStack[CurFrame].CurInst->getAnnotation(BreakpointAID) != 0;
} }
void Interpreter::stepInstruction() { // Do the 'step' command void Interpreter::stepInstruction() { // Do the 'step' command
@@ -1082,12 +1073,7 @@ void Interpreter::nextInstruction() { // Do the 'next' command
if (ECStack.back().CurInst->getOpcode() == Instruction::Call) { if (ECStack.back().CurInst->getOpcode() == Instruction::Call) {
unsigned StackSize = ECStack.size(); unsigned StackSize = ECStack.size();
// Step into the function... // Step into the function...
if (executeInstruction()) { executeInstruction();
// Hit a breakpoint, print current instruction, then return to user...
std::cout << "Breakpoint hit!\n";
printCurrentInstruction();
return;
}
// If we we able to step into the function, finish it now. We might not be // If we we able to step into the function, finish it now. We might not be
// able the step into a function, if it's external for example. // able the step into a function, if it's external for example.
@@ -1108,15 +1094,11 @@ void Interpreter::run() {
return; return;
} }
bool HitBreakpoint = false; while (!ECStack.empty()) {
while (!ECStack.empty() && !HitBreakpoint) {
// Run an instruction... // Run an instruction...
HitBreakpoint = executeInstruction(); executeInstruction();
} }
if (HitBreakpoint)
std::cout << "Breakpoint hit!\n";
// Print the next instruction to execute... // Print the next instruction to execute...
printCurrentInstruction(); printCurrentInstruction();
} }
@@ -1128,21 +1110,15 @@ void Interpreter::finish() {
} }
unsigned StackSize = ECStack.size(); unsigned StackSize = ECStack.size();
bool HitBreakpoint = false; while (ECStack.size() >= StackSize) {
while (ECStack.size() >= StackSize && !HitBreakpoint) {
// Run an instruction... // Run an instruction...
HitBreakpoint = executeInstruction(); executeInstruction();
} }
if (HitBreakpoint)
std::cout << "Breakpoint hit!\n";
// Print the next instruction to execute... // Print the next instruction to execute...
printCurrentInstruction(); printCurrentInstruction();
} }
// printCurrentInstruction - Print out the instruction that the virtual PC is // printCurrentInstruction - Print out the instruction that the virtual PC is
// at, or fail silently if no program is running. // at, or fail silently if no program is running.
// //

View File

@@ -37,7 +37,6 @@ private:
unsigned getValueSlot(const Value *V); unsigned getValueSlot(const Value *V);
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Support for the SlotNumber annotation // Support for the SlotNumber annotation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -58,9 +57,6 @@ struct SlotNumber : public Annotation {
SlotNum(sn) {} SlotNum(sn) {}
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// Support for the InstNumber annotation // Support for the InstNumber annotation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@@ -79,14 +75,4 @@ struct InstNumber : public SlotNumber {
InstNumber(unsigned in, unsigned sn) : SlotNumber(sn), InstNum(in) {} InstNumber(unsigned in, unsigned sn) : SlotNumber(sn), InstNum(in) {}
}; };
//===----------------------------------------------------------------------===//
// Support for the Breakpoint annotation
//===----------------------------------------------------------------------===//
static AnnotationID BreakpointAID(
AnnotationManager::getID("Interpreter::Breakpoint"));
// Just use an Annotation directly, Breakpoint is currently just a marker
#endif #endif

View File

@@ -111,7 +111,6 @@ public:
// User Interation Methods... // User Interation Methods...
bool callFunction(const std::string &Name); // return true on failure bool callFunction(const std::string &Name); // return true on failure
void setBreakpoint(const std::string &Name);
void infoValue(const std::string &Name); void infoValue(const std::string &Name);
void print(const std::string &Name); void print(const std::string &Name);
static void print(const Type *Ty, GenericValue V); static void print(const Type *Ty, GenericValue V);
@@ -125,7 +124,7 @@ public:
// Code execution methods... // Code execution methods...
void callFunction(Function *F, const std::vector<GenericValue> &ArgVals); void callFunction(Function *F, const std::vector<GenericValue> &ArgVals);
bool executeInstruction(); // Execute one instruction... void executeInstruction(); // Execute one instruction...
void stepInstruction(); // Do the 'step' command void stepInstruction(); // Do the 'step' command
void nextInstruction(); // Do the 'next' command void nextInstruction(); // Do the 'next' command