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;

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

71 bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
72 bool decodeSave(MachInst inst, int &reg, int &disp);
73 bool decodeStack(MachInst inst, int &disp);
74
75 void trace(ThreadContext *tc, bool is_call);
76
77 public:
78 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;

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

71 bool decodePrologue(Addr sp, Addr callpc, Addr func, int &size, Addr &ra);
72 bool decodeSave(MachInst inst, int &reg, int &disp);
73 bool decodeStack(MachInst inst, int &disp);
74
75 void trace(ThreadContext *tc, bool is_call);
76
77 public:
78 StackTrace();
79 StackTrace(ThreadContext *tc, StaticInstPtr inst);
79 StackTrace(ThreadContext *tc, const StaticInstPtr &inst);
80 ~StackTrace();
81
82 void
83 clear()
84 {
85 tc = 0;
86 stack.clear();
87 }
88
89 bool valid() const { return tc != NULL; }
80 ~StackTrace();
81
82 void
83 clear()
84 {
85 tc = 0;
86 stack.clear();
87 }
88
89 bool valid() const { return tc != NULL; }
90 bool trace(ThreadContext *tc, StaticInstPtr inst);
90 bool trace(ThreadContext *tc, const StaticInstPtr &inst);
91
92 public:
93 const std::vector<Addr> &getstack() const { return stack; }
94
95 enum {
96 user = 1,
97 console = 2,
98 unknown = 3

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

106 void dprintf() { if (DTRACE(Stack)) dump(); }
107#else
108 public:
109 void dprintf() {}
110#endif
111};
112
113inline bool
91
92 public:
93 const std::vector<Addr> &getstack() const { return stack; }
94
95 enum {
96 user = 1,
97 console = 2,
98 unknown = 3

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

106 void dprintf() { if (DTRACE(Stack)) dump(); }
107#else
108 public:
109 void dprintf() {}
110#endif
111};
112
113inline bool
114StackTrace::trace(ThreadContext *tc, StaticInstPtr inst)
114StackTrace::trace(ThreadContext *tc, const StaticInstPtr &inst)
115{
116 if (!inst->isCall() && !inst->isReturn())
117 return false;
118
119 if (valid())
120 clear();
121
122 trace(tc, !inst->isReturn());
123 return true;
124}
125
126} // namespace AlphaISA
127
128#endif // __ARCH_ALPHA_STACKTRACE_HH__
115{
116 if (!inst->isCall() && !inst->isReturn())
117 return false;
118
119 if (valid())
120 clear();
121
122 trace(tc, !inst->isReturn());
123 return true;
124}
125
126} // namespace AlphaISA
127
128#endif // __ARCH_ALPHA_STACKTRACE_HH__