diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-07 05:31:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-07 05:31:27 +0000 |
commit | 461f02fc1914d4382d6df52061220443d6b9259b (patch) | |
tree | 03936d96ec59ebb3f77f67ef25d0c0f21322110c /lib/ExecutionEngine/Interpreter/UserInput.cpp | |
parent | 5af0c4803b7064938dabc4c7275dcfb231e814ae (diff) |
*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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1170 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/Interpreter/UserInput.cpp')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/UserInput.cpp | 30 |
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); + } +} |