Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: snapshot/win/module_snapshot_win.cc

Issue 1052813002: win: make CrashpadInfo retrievable (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: more fixes Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « snapshot/win/module_snapshot_win.h ('k') | snapshot/win/pe_image_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include "snapshot/win/module_snapshot_win.h"
16
17 #include "base/strings/utf_string_conversions.h"
18 #include "snapshot/win/pe_image_reader.h"
19 #include "util/misc/tri_state.h"
20 #include "util/misc/uuid.h"
21
22 namespace crashpad {
23 namespace internal {
24
25 ModuleSnapshotWin::ModuleSnapshotWin()
26 : ModuleSnapshot(),
27 name_(),
28 timestamp_(0),
29 process_reader_(nullptr),
30 initialized_() {
31 }
32
33 ModuleSnapshotWin::~ModuleSnapshotWin() {
34 }
35
36 bool ModuleSnapshotWin::Initialize(
37 ProcessReaderWin* process_reader,
38 const ProcessInfo::Module& process_reader_module) {
39 INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
40
41 process_reader_ = process_reader;
42 name_ = base::UTF16ToUTF8(process_reader_module.name);
43 timestamp_ = process_reader_module.timestamp;
44 pe_image_reader_.reset(new PEImageReader());
45 if (!pe_image_reader_->Initialize(process_reader_,
46 process_reader_module.dll_base,
47 process_reader_module.size,
48 name_)) {
49 return false;
50 }
51
52 INITIALIZATION_STATE_SET_VALID(initialized_);
53 return true;
54 }
55
56 void ModuleSnapshotWin::GetCrashpadOptions(CrashpadInfoClientOptions* options) {
57 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
58
59 process_types::CrashpadInfo crashpad_info;
60 if (!pe_image_reader_->GetCrashpadInfo(&crashpad_info)) {
61 options->crashpad_handler_behavior = TriState::kUnset;
62 options->system_crash_reporter_forwarding = TriState::kUnset;
63 return;
64 }
65
66 options->crashpad_handler_behavior =
67 CrashpadInfoClientOptions::TriStateFromCrashpadInfo(
68 crashpad_info.crashpad_handler_behavior);
69
70 options->system_crash_reporter_forwarding =
71 CrashpadInfoClientOptions::TriStateFromCrashpadInfo(
72 crashpad_info.system_crash_reporter_forwarding);
73 }
74
75 std::string ModuleSnapshotWin::Name() const {
76 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
77 return name_;
78 }
79
80 uint64_t ModuleSnapshotWin::Address() const {
81 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
82 return pe_image_reader_->Address();
83 }
84
85 uint64_t ModuleSnapshotWin::Size() const {
86 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
87 return pe_image_reader_->Size();
88 }
89
90 time_t ModuleSnapshotWin::Timestamp() const {
91 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
92 return timestamp_;
93 }
94
95 void ModuleSnapshotWin::FileVersion(uint16_t* version_0,
96 uint16_t* version_1,
97 uint16_t* version_2,
98 uint16_t* version_3) const {
99 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
100 CHECK(false) << "TODO(scottmg)";
101 }
102
103 void ModuleSnapshotWin::SourceVersion(uint16_t* version_0,
104 uint16_t* version_1,
105 uint16_t* version_2,
106 uint16_t* version_3) const {
107 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
108 CHECK(false) << "TODO(scottmg)";
109 }
110
111 ModuleSnapshot::ModuleType ModuleSnapshotWin::GetModuleType() const {
112 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
113 CHECK(false) << "TODO(scottmg)";
114 return ModuleSnapshot::ModuleType();
115 }
116
117 void ModuleSnapshotWin::UUID(crashpad::UUID* uuid) const {
118 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
119 CHECK(false) << "TODO(scottmg)";
120 }
121
122 std::vector<std::string> ModuleSnapshotWin::AnnotationsVector() const {
123 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
124 CHECK(false) << "TODO(scottmg)";
125 return std::vector<std::string>();
126 }
127
128 std::map<std::string, std::string> ModuleSnapshotWin::AnnotationsSimpleMap()
129 const {
130 INITIALIZATION_STATE_DCHECK_VALID(initialized_);
131 CHECK(false) << "TODO(scottmg)";
132 return std::map<std::string, std::string>();
133 }
134
135 } // namespace internal
136 } // namespace crashpad
OLDNEW
« no previous file with comments | « snapshot/win/module_snapshot_win.h ('k') | snapshot/win/pe_image_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698