class ExecContext;
class StackTrace;
-class SymbolTable;
class ProcessInfo
{
class StackTrace
{
+ protected:
+ typedef TheISA::MachInst MachInst;
private:
ExecContext *xc;
std::vector<Addr> stack;
bool decodeSave(MachInst inst, int ®, int &disp);
bool decodeStack(MachInst inst, int &disp);
+ void trace(ExecContext *xc, bool is_call);
+
public:
- StackTrace(ExecContext *xc, bool is_call);
+ StackTrace();
+ StackTrace(ExecContext *xc, StaticInstPtr inst);
~StackTrace();
+ void clear()
+ {
+ xc = 0;
+ stack.clear();
+ }
+
+ bool valid() const { return xc != NULL; }
+ bool trace(ExecContext *xc, StaticInstPtr inst);
+
public:
const std::vector<Addr> &getstack() const { return stack; }
- static StackTrace *create(ExecContext *xc, StaticInstPtr<TheISA> inst);
+
+ static const int user = 1;
+ static const int console = 2;
+ static const int unknown = 3;
#if TRACING_ON
private:
#endif
};
-inline StackTrace *
-StackTrace::create(ExecContext *xc, StaticInstPtr<TheISA> inst)
+inline bool
+StackTrace::trace(ExecContext *xc, StaticInstPtr inst)
{
if (!inst->isCall() && !inst->isReturn())
- return NULL;
+ return false;
+
+ if (valid())
+ clear();
- return new StackTrace(xc, !inst->isReturn());
+ trace(xc, !inst->isReturn());
+ return true;
}
#endif // __ARCH_ALPHA_STACKTRACE_HH__