38d37
< class StackTrace;
40c39
< class ProcessInfo
---
> namespace AlphaISA
42,43c41
< private:
< ThreadContext *tc;
---
> class StackTrace;
45,49c43,46
< int thread_info_size;
< int task_struct_size;
< int task_off;
< int pid_off;
< int name_off;
---
> class ProcessInfo
> {
> private:
> ThreadContext *tc;
51,52c48,52
< public:
< ProcessInfo(ThreadContext *_tc);
---
> int thread_info_size;
> int task_struct_size;
> int task_off;
> int pid_off;
> int name_off;
54,57c54,55
< Addr task(Addr ksp) const;
< int pid(Addr ksp) const;
< std::string name(Addr ksp) const;
< };
---
> public:
> ProcessInfo(ThreadContext *_tc);
59,65c57,60
< class StackTrace
< {
< protected:
< typedef TheISA::MachInst MachInst;
< private:
< ThreadContext *tc;
< std::vector<Addr> stack;
---
> Addr task(Addr ksp) const;
> int pid(Addr ksp) const;
> std::string name(Addr ksp) const;
> };
67,71c62,68
< private:
< bool isEntry(Addr addr);
< bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
< bool decodeSave(MachInst inst, int &reg, int &disp);
< bool decodeStack(MachInst inst, int &disp);
---
> class StackTrace
> {
> protected:
> typedef TheISA::MachInst MachInst;
> private:
> ThreadContext *tc;
> std::vector<Addr> stack;
73c70,74
< void trace(ThreadContext *tc, bool is_call);
---
> private:
> bool isEntry(Addr addr);
> bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
> bool decodeSave(MachInst inst, int &reg, int &disp);
> bool decodeStack(MachInst inst, int &disp);
75,78c76
< public:
< StackTrace();
< StackTrace(ThreadContext *tc, StaticInstPtr inst);
< ~StackTrace();
---
> void trace(ThreadContext *tc, bool is_call);
80,84c78,81
< void clear()
< {
< tc = 0;
< stack.clear();
< }
---
> public:
> StackTrace();
> StackTrace(ThreadContext *tc, StaticInstPtr inst);
> ~StackTrace();
86,87c83,87
< bool valid() const { return tc != NULL; }
< bool trace(ThreadContext *tc, StaticInstPtr inst);
---
> void clear()
> {
> tc = 0;
> stack.clear();
> }
89,90c89,90
< public:
< const std::vector<Addr> &getstack() const { return stack; }
---
> bool valid() const { return tc != NULL; }
> bool trace(ThreadContext *tc, StaticInstPtr inst);
92,94c92,93
< static const int user = 1;
< static const int console = 2;
< static const int unknown = 3;
---
> public:
> const std::vector<Addr> &getstack() const { return stack; }
95a95,98
> static const int user = 1;
> static const int console = 2;
> static const int unknown = 3;
>
97,98c100,101
< private:
< void dump();
---
> private:
> void dump();
100,101c103,104
< public:
< void dprintf() { if (DTRACE(Stack)) dump(); }
---
> public:
> void dprintf() { if (DTRACE(Stack)) dump(); }
103,104c106,107
< public:
< void dprintf() {}
---
> public:
> void dprintf() {}
106c109
< };
---
> };
108,112c111,115
< inline bool
< StackTrace::trace(ThreadContext *tc, StaticInstPtr inst)
< {
< if (!inst->isCall() && !inst->isReturn())
< return false;
---
> inline bool
> StackTrace::trace(ThreadContext *tc, StaticInstPtr inst)
> {
> if (!inst->isCall() && !inst->isReturn())
> return false;
114,115c117,118
< if (valid())
< clear();
---
> if (valid())
> clear();
117,118c120,122
< trace(tc, !inst->isReturn());
< return true;
---
> trace(tc, !inst->isReturn());
> return true;
> }