OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006, Google Inc. | |
2 // All rights reserved. | |
3 // | |
4 // Redistribution and use in source and binary forms, with or without | |
5 // modification, are permitted provided that the following conditions are | |
6 // met: | |
7 // | |
8 // * Redistributions of source code must retain the above copyright | |
9 // notice, this list of conditions and the following disclaimer. | |
10 // * Redistributions in binary form must reproduce the above | |
11 // copyright notice, this list of conditions and the following disclaimer | |
12 // in the documentation and/or other materials provided with the | |
13 // distribution. | |
14 // * Neither the name of Google Inc. nor the names of its | |
15 // contributors may be used to endorse or promote products derived from | |
16 // this software without specific prior written permission. | |
17 // | |
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | |
30 // process_state.h: A snapshot of a process, in a fully-digested state. | |
31 // | |
32 // Author: Mark Mentovai | |
33 | |
34 #ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__ | |
35 #define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__ | |
36 | |
37 #include <string> | |
38 #include <vector> | |
39 #include "google_breakpad/common/breakpad_types.h" | |
40 #include "google_breakpad/processor/system_info.h" | |
41 #include "google_breakpad/processor/minidump.h" | |
42 | |
43 namespace google_breakpad { | |
44 | |
45 using std::string; | |
46 using std::vector; | |
47 | |
48 class CallStack; | |
49 class CodeModules; | |
50 | |
51 class ProcessState { | |
52 public: | |
53 ProcessState() : modules_(NULL) { Clear(); } | |
54 ~ProcessState(); | |
55 | |
56 // Resets the ProcessState to its default values | |
57 void Clear(); | |
58 | |
59 // Accessors. See the data declarations below. | |
60 u_int32_t time_date_stamp() const { return time_date_stamp_; } | |
61 bool crashed() const { return crashed_; } | |
62 string crash_reason() const { return crash_reason_; } | |
63 u_int64_t crash_address() const { return crash_address_; } | |
64 string assertion() const { return assertion_; } | |
65 int requesting_thread() const { return requesting_thread_; } | |
66 const vector<CallStack*>* threads() const { return &threads_; } | |
67 const vector<MinidumpMemoryRegion*>* thread_memory_regions() const { | |
68 return &thread_memory_regions_; | |
69 } | |
70 const SystemInfo* system_info() const { return &system_info_; } | |
71 const CodeModules* modules() const { return modules_; } | |
72 | |
73 private: | |
74 // MinidumpProcessor is responsible for building ProcessState objects. | |
75 friend class MinidumpProcessor; | |
76 | |
77 // The time-date stamp of the minidump (time_t format) | |
78 u_int32_t time_date_stamp_; | |
79 | |
80 // True if the process crashed, false if the dump was produced outside | |
81 // of an exception handler. | |
82 bool crashed_; | |
83 | |
84 // If the process crashed, the type of crash. OS- and possibly CPU- | |
85 // specific. For example, "EXCEPTION_ACCESS_VIOLATION" (Windows), | |
86 // "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS" (Mac OS X), "SIGSEGV" | |
87 // (other Unix). | |
88 string crash_reason_; | |
89 | |
90 // If the process crashed, and if crash_reason implicates memory, | |
91 // the memory address that caused the crash. For data access errors, | |
92 // this will be the data address that caused the fault. For code errors, | |
93 // this will be the address of the instruction that caused the fault. | |
94 u_int64_t crash_address_; | |
95 | |
96 // If there was an assertion that was hit, a textual representation | |
97 // of that assertion, possibly including the file and line at which | |
98 // it occurred. | |
99 string assertion_; | |
100 | |
101 // The index of the thread that requested a dump be written in the | |
102 // threads vector. If a dump was produced as a result of a crash, this | |
103 // will point to the thread that crashed. If the dump was produced as | |
104 // by user code without crashing, and the dump contains extended Breakpad | |
105 // information, this will point to the thread that requested the dump. | |
106 // If the dump was not produced as a result of an exception and no | |
107 // extended Breakpad information is present, this field will be set to -1, | |
108 // indicating that the dump thread is not available. | |
109 int requesting_thread_; | |
110 | |
111 // Stacks for each thread (except possibly the exception handler | |
112 // thread) at the time of the crash. | |
113 vector<CallStack*> threads_; | |
114 vector<MinidumpMemoryRegion*> thread_memory_regions_; | |
115 | |
116 // OS and CPU information. | |
117 SystemInfo system_info_; | |
118 | |
119 // The modules that were loaded into the process represented by the | |
120 // ProcessState. | |
121 const CodeModules *modules_; | |
122 }; | |
123 | |
124 } // namespace google_breakpad | |
125 | |
126 #endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__ | |
OLD | NEW |