*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
This commit is contained in:
Chris Lattner
2001-11-07 05:31:27 +00:00
parent 5af0c4803b
commit 461f02fc19
3 changed files with 64 additions and 27 deletions

View File

@@ -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);
}
}