summaryrefslogtreecommitdiff
path: root/src/arch/alpha/stacktrace.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-11-08 00:52:04 -0500
committerGabe Black <gblack@eecs.umich.edu>2006-11-08 00:52:04 -0500
commitf1a55570d305dd15d7bc9667453a0ca14bf16462 (patch)
treee3c1cbc993cc44287cdc80032adb3643cc1b3dd6 /src/arch/alpha/stacktrace.hh
parent16a012e80da8beb2e147bf62ed0d054ed1c0d600 (diff)
downloadgem5-f1a55570d305dd15d7bc9667453a0ca14bf16462.tar.xz
Put the ProcessInfo and StackTrace objects into the ISA namespaces.
--HG-- extra : convert_revision : 1626703583f02a1c9823874290462c1b6bdb6c3c
Diffstat (limited to 'src/arch/alpha/stacktrace.hh')
-rw-r--r--src/arch/alpha/stacktrace.hh130
1 files changed, 67 insertions, 63 deletions
diff --git a/src/arch/alpha/stacktrace.hh b/src/arch/alpha/stacktrace.hh
index d12aee211..834abbc2f 100644
--- a/src/arch/alpha/stacktrace.hh
+++ b/src/arch/alpha/stacktrace.hh
@@ -35,87 +35,91 @@
#include "cpu/static_inst.hh"
class ThreadContext;
-class StackTrace;
-class ProcessInfo
+namespace AlphaISA
{
- private:
- ThreadContext *tc;
+ class StackTrace;
- int thread_info_size;
- int task_struct_size;
- int task_off;
- int pid_off;
- int name_off;
+ class ProcessInfo
+ {
+ private:
+ ThreadContext *tc;
- public:
- ProcessInfo(ThreadContext *_tc);
+ int thread_info_size;
+ int task_struct_size;
+ int task_off;
+ int pid_off;
+ int name_off;
- Addr task(Addr ksp) const;
- int pid(Addr ksp) const;
- std::string name(Addr ksp) const;
-};
+ public:
+ ProcessInfo(ThreadContext *_tc);
-class StackTrace
-{
- protected:
- typedef TheISA::MachInst MachInst;
- private:
- ThreadContext *tc;
- std::vector<Addr> stack;
-
- 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);
-
- void trace(ThreadContext *tc, bool is_call);
-
- public:
- StackTrace();
- StackTrace(ThreadContext *tc, StaticInstPtr inst);
- ~StackTrace();
-
- void clear()
+ Addr task(Addr ksp) const;
+ int pid(Addr ksp) const;
+ std::string name(Addr ksp) const;
+ };
+
+ class StackTrace
{
- tc = 0;
- stack.clear();
- }
+ protected:
+ typedef TheISA::MachInst MachInst;
+ private:
+ ThreadContext *tc;
+ std::vector<Addr> stack;
+
+ 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);
+
+ void trace(ThreadContext *tc, bool is_call);
- bool valid() const { return tc != NULL; }
- bool trace(ThreadContext *tc, StaticInstPtr inst);
+ public:
+ StackTrace();
+ StackTrace(ThreadContext *tc, StaticInstPtr inst);
+ ~StackTrace();
- public:
- const std::vector<Addr> &getstack() const { return stack; }
+ void clear()
+ {
+ tc = 0;
+ stack.clear();
+ }
- static const int user = 1;
- static const int console = 2;
- static const int unknown = 3;
+ bool valid() const { return tc != NULL; }
+ bool trace(ThreadContext *tc, StaticInstPtr inst);
+
+ public:
+ const std::vector<Addr> &getstack() const { return stack; }
+
+ static const int user = 1;
+ static const int console = 2;
+ static const int unknown = 3;
#if TRACING_ON
- private:
- void dump();
+ private:
+ void dump();
- public:
- void dprintf() { if (DTRACE(Stack)) dump(); }
+ public:
+ void dprintf() { if (DTRACE(Stack)) dump(); }
#else
- public:
- void dprintf() {}
+ public:
+ void dprintf() {}
#endif
-};
+ };
-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;
- if (valid())
- clear();
+ if (valid())
+ clear();
- trace(tc, !inst->isReturn());
- return true;
+ trace(tc, !inst->isReturn());
+ return true;
+ }
}
#endif // __ARCH_ALPHA_STACKTRACE_HH__