aboutsummaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/Interpreter/UserInput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/UserInput.cpp')
-rw-r--r--lib/ExecutionEngine/Interpreter/UserInput.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/Interpreter/UserInput.cpp b/lib/ExecutionEngine/Interpreter/UserInput.cpp
index a1518d413e..7ece7bc54b 100644
--- a/lib/ExecutionEngine/Interpreter/UserInput.cpp
+++ b/lib/ExecutionEngine/Interpreter/UserInput.cpp
@@ -105,12 +105,15 @@ void Interpreter::handleUserInput() {
case List: list(); break;
case StackTrace: printStackTrace(); break;
case Up:
- if (CurFrame > 0) --CurFrame;
+ if (CurFrame > 0) { --CurFrame; printStackFrame(); }
else cout << "Error: Already at root of stack!\n";
break;
case Down:
- if ((unsigned)CurFrame < ECStack.size()-1) ++CurFrame;
- else cout << "Error: Already at bottom of stack!\n";
+ if ((unsigned)CurFrame < ECStack.size()-1) {
+ ++CurFrame;
+ printStackFrame();
+ } else
+ cout << "Error: Already at bottom of stack!\n";
break;
case Next: nextInstruction(); break;
case Step: stepInstruction(); break;
@@ -277,8 +280,8 @@ bool Interpreter::callMainMethod(const string &Name,
case 2: {
PointerType *SPP = PointerType::get(PointerType::get(Type::SByteTy));
if (MT->getParamTypes()[1] != SPP) {
- cout << "Second argument of '" << Name << "' should have type: '"
- << SPP->getDescription() << "'!\n";
+ CW << "Second argument of '" << Name << "' should have type: '"
+ << SPP << "'!\n";
return true;
}
@@ -306,3 +309,20 @@ bool Interpreter::callMainMethod(const string &Name,
return false;
}
+
+
+
+void Interpreter::list() {
+ if (ECStack.empty())
+ cout << "Error: No program executing!\n";
+ else
+ CW << ECStack[CurFrame].CurMethod; // Just print the method out...
+}
+
+void Interpreter::printStackTrace() {
+ if (ECStack.empty()) cout << "No program executing!\n";
+
+ for (unsigned i = 0; i < ECStack.size(); ++i) {
+ printStackFrame((int)i);
+ }
+}