summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-07 05:31:27 +0000
committerChris Lattner <sabre@nondot.org>2001-11-07 05:31:27 +0000
commiteaec4ede57c0aaeada50f40add21885b7ce34da4 (patch)
treee3db706af42fd6a5c7ee48cd150c0b9ca178aa25 /llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp
parent1f01726487df64bb908ffe373bebe3b31e6e547b (diff)
downloadbcm5719-llvm-eaec4ede57c0aaeada50f40add21885b7ce34da4.tar.gz
bcm5719-llvm-eaec4ede57c0aaeada50f40add21885b7ce34da4.zip
*Print Stack traces better.
* Use the cache writer for all it's problems. * print arguments to methods in stack traces. *Print the current stack from for up/down commands. llvm-svn: 1170
Diffstat (limited to 'llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp b/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp
index a1518d413e0..7ece7bc54b9 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/UserInput.cpp
+++ b/llvm/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);
+ }
+}
OpenPOWER on IntegriCloud