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

Unified Diff: third_party/crashpad/crashpad/util/win/initial_client_data.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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
Index: third_party/crashpad/crashpad/util/win/initial_client_data.cc
diff --git a/third_party/crashpad/crashpad/util/win/initial_client_data.cc b/third_party/crashpad/crashpad/util/win/initial_client_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cbeecf164ab81229710e4f1ed5d0e793cbbae9e4
--- /dev/null
+++ b/third_party/crashpad/crashpad/util/win/initial_client_data.cc
@@ -0,0 +1,113 @@
+// Copyright 2016 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 "util/win/initial_client_data.h"
+
+#include <vector>
+
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+#include "util/stdlib/string_number_conversion.h"
+#include "util/string/split_string.h"
+#include "util/win/handle.h"
+
+namespace crashpad {
+
+namespace {
+
+bool HandleFromString(const std::string& str, HANDLE* handle) {
+ unsigned int handle_uint;
+ if (!StringToNumber(str, &handle_uint) ||
+ (*handle = IntToHandle(handle_uint)) == INVALID_HANDLE_VALUE) {
+ LOG(ERROR) << "could not convert '" << str << "' to HANDLE";
+ return false;
+ }
+ return true;
+}
+
+bool AddressFromString(const std::string& str, WinVMAddress* address) {
+ if (!StringToNumber(str, address)) {
+ LOG(ERROR) << "could not convert '" << str << "' to WinVMAddress";
+ return false;
+ }
+ return true;
+}
+
+} // namespace
+
+InitialClientData::InitialClientData()
+ : crash_exception_information_(0),
+ non_crash_exception_information_(0),
+ debug_critical_section_address_(0),
+ request_crash_dump_(nullptr),
+ request_non_crash_dump_(nullptr),
+ non_crash_dump_completed_(nullptr),
+ first_pipe_instance_(INVALID_HANDLE_VALUE),
+ client_process_(nullptr),
+ is_valid_(false) {}
+
+InitialClientData::InitialClientData(
+ HANDLE request_crash_dump,
+ HANDLE request_non_crash_dump,
+ HANDLE non_crash_dump_completed,
+ HANDLE first_pipe_instance,
+ HANDLE client_process,
+ WinVMAddress crash_exception_information,
+ WinVMAddress non_crash_exception_information,
+ WinVMAddress debug_critical_section_address)
+ : crash_exception_information_(crash_exception_information),
+ non_crash_exception_information_(non_crash_exception_information),
+ debug_critical_section_address_(debug_critical_section_address),
+ request_crash_dump_(request_crash_dump),
+ request_non_crash_dump_(request_non_crash_dump),
+ non_crash_dump_completed_(non_crash_dump_completed),
+ first_pipe_instance_(first_pipe_instance),
+ client_process_(client_process),
+ is_valid_(true) {}
+
+bool InitialClientData::InitializeFromString(const std::string& str) {
+ std::vector<std::string> parts(SplitString(str, ','));
+ if (parts.size() != 8) {
+ LOG(ERROR) << "expected 8 comma separated arguments";
+ return false;
+ }
+
+ if (!HandleFromString(parts[0], &request_crash_dump_) ||
+ !HandleFromString(parts[1], &request_non_crash_dump_) ||
+ !HandleFromString(parts[2], &non_crash_dump_completed_) ||
+ !HandleFromString(parts[3], &first_pipe_instance_) ||
+ !HandleFromString(parts[4], &client_process_) ||
+ !AddressFromString(parts[5], &crash_exception_information_) ||
+ !AddressFromString(parts[6], &non_crash_exception_information_) ||
+ !AddressFromString(parts[7], &debug_critical_section_address_)) {
+ return false;
+ }
+
+ is_valid_ = true;
+ return true;
+}
+
+std::string InitialClientData::StringRepresentation() const {
+ return base::StringPrintf("0x%x,0x%x,0x%x,0x%x,0x%x,0x%I64x,0x%I64x,0x%I64x",
+ HandleToInt(request_crash_dump_),
+ HandleToInt(request_non_crash_dump_),
+ HandleToInt(non_crash_dump_completed_),
+ HandleToInt(first_pipe_instance_),
+ HandleToInt(client_process_),
+ crash_exception_information_,
+ non_crash_exception_information_,
+ debug_critical_section_address_);
+}
+
+} // namespace crashpad

Powered by Google App Engine
This is Rietveld 408576698