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

Unified Diff: snapshot/minidump/module_snapshot_minidump.cc

Issue 972383002: snapshot: Add a minimal ModuleSnapshotMinidump and accessor from ProcessSnapshotMinidump (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Add NOTREACHED() comments Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « snapshot/minidump/module_snapshot_minidump.h ('k') | snapshot/minidump/process_snapshot_minidump.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: snapshot/minidump/module_snapshot_minidump.cc
diff --git a/snapshot/minidump/module_snapshot_minidump.cc b/snapshot/minidump/module_snapshot_minidump.cc
new file mode 100644
index 0000000000000000000000000000000000000000..12a340d56607a57e118f74d1992a1fc78450389b
--- /dev/null
+++ b/snapshot/minidump/module_snapshot_minidump.cc
@@ -0,0 +1,174 @@
+// Copyright 2015 The Crashpad Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "snapshot/minidump/module_snapshot_minidump.h"
+
+#include "minidump/minidump_extensions.h"
+#include "snapshot/minidump/minidump_simple_string_dictionary_reader.h"
+#include "snapshot/minidump/minidump_string_list_reader.h"
+
+namespace crashpad {
+namespace internal {
+
+ModuleSnapshotMinidump::ModuleSnapshotMinidump()
+ : ModuleSnapshot(),
+ minidump_module_(),
+ annotations_vector_(),
+ annotations_simple_map_(),
+ initialized_() {
+}
+
+ModuleSnapshotMinidump::~ModuleSnapshotMinidump() {
+}
+
+bool ModuleSnapshotMinidump::Initialize(
+ FileReaderInterface* file_reader,
+ RVA minidump_module_rva,
+ const MINIDUMP_LOCATION_DESCRIPTOR*
+ minidump_module_crashpad_info_location) {
+ INITIALIZATION_STATE_SET_INITIALIZING(initialized_);
+
+ if (!file_reader->SeekSet(minidump_module_rva)) {
+ return false;
+ }
+
+ if (!file_reader->ReadExactly(&minidump_module_, sizeof(minidump_module_))) {
+ return false;
+ }
+
+ if (!InitializeModuleCrashpadInfo(file_reader,
+ minidump_module_crashpad_info_location)) {
+ return false;
+ }
+
+ INITIALIZATION_STATE_SET_VALID(initialized_);
+ return true;
+}
+
+std::string ModuleSnapshotMinidump::Name() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ return std::string();
+}
+
+uint64_t ModuleSnapshotMinidump::Address() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ return 0;
+}
+
+uint64_t ModuleSnapshotMinidump::Size() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ return 0;
+}
+
+time_t ModuleSnapshotMinidump::Timestamp() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ return 0;
+}
+
+void ModuleSnapshotMinidump::FileVersion(uint16_t* version_0,
+ uint16_t* version_1,
+ uint16_t* version_2,
+ uint16_t* version_3) const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ *version_0 = 0;
+ *version_1 = 0;
+ *version_2 = 0;
+ *version_3 = 0;
+}
+
+void ModuleSnapshotMinidump::SourceVersion(uint16_t* version_0,
+ uint16_t* version_1,
+ uint16_t* version_2,
+ uint16_t* version_3) const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ *version_0 = 0;
+ *version_1 = 0;
+ *version_2 = 0;
+ *version_3 = 0;
+}
+
+ModuleSnapshot::ModuleType ModuleSnapshotMinidump::GetModuleType() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ return kModuleTypeUnknown;
+}
+
+void ModuleSnapshotMinidump::UUID(crashpad::UUID* uuid) const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ NOTREACHED(); // https://code.google.com/p/crashpad/issues/detail?id=10
+ *uuid = crashpad::UUID();
+}
+
+std::vector<std::string> ModuleSnapshotMinidump::AnnotationsVector() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return annotations_vector_;
+}
+
+std::map<std::string, std::string>
+ModuleSnapshotMinidump::AnnotationsSimpleMap() const {
+ INITIALIZATION_STATE_DCHECK_VALID(initialized_);
+ return annotations_simple_map_;
+}
+
+bool ModuleSnapshotMinidump::InitializeModuleCrashpadInfo(
+ FileReaderInterface* file_reader,
+ const MINIDUMP_LOCATION_DESCRIPTOR*
+ minidump_module_crashpad_info_location) {
+ if (!minidump_module_crashpad_info_location ||
+ minidump_module_crashpad_info_location->Rva == 0) {
+ return true;
+ }
+
+ MinidumpModuleCrashpadInfo minidump_module_crashpad_info;
+ if (minidump_module_crashpad_info_location->DataSize <
+ sizeof(minidump_module_crashpad_info)) {
+ LOG(ERROR) << "minidump_module_crashpad_info size mismatch";
+ return false;
+ }
+
+ if (!file_reader->SeekSet(minidump_module_crashpad_info_location->Rva)) {
+ return false;
+ }
+
+ if (!file_reader->ReadExactly(&minidump_module_crashpad_info,
+ sizeof(minidump_module_crashpad_info))) {
+ return false;
+ }
+
+ if (minidump_module_crashpad_info.version !=
+ MinidumpModuleCrashpadInfo::kVersion) {
+ LOG(ERROR) << "minidump_module_crashpad_info version mismatch";
+ return false;
+ }
+
+ if (!ReadMinidumpStringList(file_reader,
+ minidump_module_crashpad_info.list_annotations,
+ &annotations_vector_)) {
+ return false;
+ }
+
+ return ReadMinidumpSimpleStringDictionary(
+ file_reader,
+ minidump_module_crashpad_info.simple_annotations,
+ &annotations_simple_map_);
+}
+
+} // namespace internal
+} // namespace crashpad
« no previous file with comments | « snapshot/minidump/module_snapshot_minidump.h ('k') | snapshot/minidump/process_snapshot_minidump.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698