38,40c38
< class StackTrace;
<
< class ProcessInfo
---
> namespace SparcISA
42,43c40
< private:
< ThreadContext *tc;
---
> class StackTrace;
45,49c42,45
< int thread_info_size;
< int task_struct_size;
< int task_off;
< int pid_off;
< int name_off;
---
> class ProcessInfo
> {
> private:
> ThreadContext *tc;
51,52c47,51
< public:
< ProcessInfo(ThreadContext *_tc);
---
> int thread_info_size;
> int task_struct_size;
> int task_off;
> int pid_off;
> int name_off;
54,57c53,54
< Addr task(Addr ksp) const;
< int pid(Addr ksp) const;
< std::string name(Addr ksp) const;
< };
---
> public:
> ProcessInfo(ThreadContext *_tc);
59,65c56,59
< 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,71c61,67
< 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;
73c69,73
< 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,78c75
< public:
< StackTrace();
< StackTrace(ThreadContext *tc, StaticInstPtr inst);
< ~StackTrace();
---
> void trace(ThreadContext *tc, bool is_call);
80,84c77,80
< void clear()
< {
< tc = 0;
< stack.clear();
< }
---
> public:
> StackTrace();
> StackTrace(ThreadContext *tc, StaticInstPtr inst);
> ~StackTrace();
86,87c82,86
< bool valid() const { return tc != NULL; }
< bool trace(ThreadContext *tc, StaticInstPtr inst);
---
> void clear()
> {
> tc = 0;
> stack.clear();
> }
89,90c88,89
< public:
< const std::vector<Addr> &getstack() const { return stack; }
---
> bool valid() const { return tc != NULL; }
> bool trace(ThreadContext *tc, StaticInstPtr inst);
92,94c91,92
< static const int user = 1;
< static const int console = 2;
< static const int unknown = 3;
---
> public:
> const std::vector<Addr> &getstack() const { return stack; }
95a94,97
> static const int user = 1;
> static const int console = 2;
> static const int unknown = 3;
>
97,98c99,100
< private:
< void dump();
---
> private:
> void dump();
100,101c102,103
< public:
< void dprintf() { if (DTRACE(Stack)) dump(); }
---
> public:
> void dprintf() { if (DTRACE(Stack)) dump(); }
103,104c105,106
< public:
< void dprintf() {}
---
> public:
> void dprintf() {}
106c108
< };
---
> };
108,112c110,114
< 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,115c116,117
< if (valid())
< clear();
---
> if (valid())
> clear();
117,118c119,121
< trace(tc, !inst->isReturn());
< return true;
---
> trace(tc, !inst->isReturn());
> return true;
> }