stacktrace.hh (8232:b28d06a175be) stacktrace.hh (10417:710ee116eb68)
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 64 unchanged lines hidden (view full) ---

73 bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
74 bool decodeSave(MachInst inst, int &reg, int &disp);
75 bool decodeStack(MachInst inst, int &disp);
76
77 void trace(ThreadContext *tc, bool is_call);
78
79 public:
80 StackTrace();
1/*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 64 unchanged lines hidden (view full) ---

73 bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
74 bool decodeSave(MachInst inst, int &reg, int &disp);
75 bool decodeStack(MachInst inst, int &disp);
76
77 void trace(ThreadContext *tc, bool is_call);
78
79 public:
80 StackTrace();
81 StackTrace(ThreadContext *tc, StaticInstPtr inst);
81 StackTrace(ThreadContext *tc, const StaticInstPtr &inst);
82 ~StackTrace();
83
84 void clear()
85 {
86 tc = 0;
87 stack.clear();
88 }
89
90 bool valid() const { return tc != NULL; }
82 ~StackTrace();
83
84 void clear()
85 {
86 tc = 0;
87 stack.clear();
88 }
89
90 bool valid() const { return tc != NULL; }
91 bool trace(ThreadContext *tc, StaticInstPtr inst);
91 bool trace(ThreadContext *tc, const StaticInstPtr &inst);
92
93 public:
94 const std::vector<Addr> &getstack() const { return stack; }
95
96#if TRACING_ON
97 private:
98 void dump();
99
100 public:
101 void dprintf() { if (DTRACE(Stack)) dump(); }
102#else
103 public:
104 void dprintf() {}
105#endif
106};
107
108inline bool
92
93 public:
94 const std::vector<Addr> &getstack() const { return stack; }
95
96#if TRACING_ON
97 private:
98 void dump();
99
100 public:
101 void dprintf() { if (DTRACE(Stack)) dump(); }
102#else
103 public:
104 void dprintf() {}
105#endif
106};
107
108inline bool
109StackTrace::trace(ThreadContext *tc, StaticInstPtr inst)
109StackTrace::trace(ThreadContext *tc, const StaticInstPtr &inst)
110{
111 if (!inst->isCall() && !inst->isReturn())
112 return false;
113
114 if (valid())
115 clear();
116
117 trace(tc, !inst->isReturn());
118 return true;
119}
120
121} // Namespace ArmISA
122
123#endif // __ARCH_ARM_STACKTRACE_HH__
110{
111 if (!inst->isCall() && !inst->isReturn())
112 return false;
113
114 if (valid())
115 clear();
116
117 trace(tc, !inst->isReturn());
118 return true;
119}
120
121} // Namespace ArmISA
122
123#endif // __ARCH_ARM_STACKTRACE_HH__