| OLD | NEW |
| 1 // Copyright (c) 2006, Google Inc. | 1 // Copyright (c) 2006, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // By convention, the stack frame at index 0 is the innermost callee frame, | 38 // By convention, the stack frame at index 0 is the innermost callee frame, |
| 39 // and the frame at the highest index in a call stack is the outermost | 39 // and the frame at the highest index in a call stack is the outermost |
| 40 // caller. CallStack only allows stacks to be built by pushing frames, | 40 // caller. CallStack only allows stacks to be built by pushing frames, |
| 41 // beginning with the innermost callee frame. | 41 // beginning with the innermost callee frame. |
| 42 // | 42 // |
| 43 // Author: Mark Mentovai | 43 // Author: Mark Mentovai |
| 44 | 44 |
| 45 #ifndef GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__ | 45 #ifndef GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__ |
| 46 #define GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__ | 46 #define GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__ |
| 47 | 47 |
| 48 #include <cstdint> |
| 48 #include <vector> | 49 #include <vector> |
| 49 | 50 |
| 50 namespace google_breakpad { | 51 namespace google_breakpad { |
| 51 | 52 |
| 52 using std::vector; | 53 using std::vector; |
| 53 | 54 |
| 54 struct StackFrame; | 55 struct StackFrame; |
| 55 template<typename T> class linked_ptr; | 56 template<typename T> class linked_ptr; |
| 56 | 57 |
| 57 class CallStack { | 58 class CallStack { |
| 58 public: | 59 public: |
| 59 CallStack() { Clear(); } | 60 CallStack() { Clear(); } |
| 60 ~CallStack(); | 61 ~CallStack(); |
| 61 | 62 |
| 62 // Resets the CallStack to its initial empty state | 63 // Resets the CallStack to its initial empty state |
| 63 void Clear(); | 64 void Clear(); |
| 64 | 65 |
| 65 const vector<StackFrame*>* frames() const { return &frames_; } | 66 const vector<StackFrame*>* frames() const { return &frames_; } |
| 66 | 67 |
| 68 // Set the TID associated with this call stack. |
| 69 void set_tid(uint32_t tid) { tid_ = tid; } |
| 70 |
| 71 uint32_t tid() { return tid_; } |
| 72 |
| 67 private: | 73 private: |
| 68 // Stackwalker is responsible for building the frames_ vector. | 74 // Stackwalker is responsible for building the frames_ vector. |
| 69 friend class Stackwalker; | 75 friend class Stackwalker; |
| 70 | 76 |
| 71 // Storage for pushed frames. | 77 // Storage for pushed frames. |
| 72 vector<StackFrame*> frames_; | 78 vector<StackFrame*> frames_; |
| 79 |
| 80 // The TID associated with this call stack. Default to 0 if it's not |
| 81 // available. |
| 82 uint32_t tid_; |
| 73 }; | 83 }; |
| 74 | 84 |
| 75 } // namespace google_breakpad | 85 } // namespace google_breakpad |
| 76 | 86 |
| 77 #endif // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__ | 87 #endif // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__ |
| OLD | NEW |