xref: /aosp_15_r20/external/google-breakpad/src/processor/process_state.cc (revision 9712c20fc9bbfbac4935993a2ca0b3958c5adad2)
1 // Copyright 2006 Google LLC
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //     * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //     * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //     * Neither the name of Google LLC nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 // process_state.cc: A snapshot of a process, in a fully-digested state.
30 //
31 // See process_state.h for documentation.
32 //
33 // Author: Mark Mentovai
34 
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>  // Must come first
37 #endif
38 
39 #include "google_breakpad/processor/process_state.h"
40 #include "google_breakpad/processor/call_stack.h"
41 #include "google_breakpad/processor/code_modules.h"
42 
43 namespace google_breakpad {
44 
~ProcessState()45 ProcessState::~ProcessState() {
46   Clear();
47 }
48 
Clear()49 void ProcessState::Clear() {
50   time_date_stamp_ = 0;
51   process_create_time_ = 0;
52   crashed_ = false;
53   crash_reason_.clear();
54   crash_address_ = 0;
55   assertion_.clear();
56   requesting_thread_ = -1;
57   for (vector<CallStack*>::const_iterator iterator = threads_.begin();
58        iterator != threads_.end();
59        ++iterator) {
60     delete *iterator;
61   }
62   threads_.clear();
63   system_info_.Clear();
64   thread_names_.clear();
65   // modules_without_symbols_ and modules_with_corrupt_symbols_ DO NOT own
66   // the underlying CodeModule pointers.  Just clear the vectors.
67   modules_without_symbols_.clear();
68   modules_with_corrupt_symbols_.clear();
69   delete modules_;
70   modules_ = NULL;
71   delete unloaded_modules_;
72   unloaded_modules_ = NULL;
73 }
74 
75 }  // namespace google_breakpad
76