Provide std::move() in compat instead of using crashpad::move()
This more-natural spelling doesn’t require Crashpad developers to have to remember anything special when writing code in Crashpad. It’s easier to grep for and it’s easier to remove the “compat” part when pre-C++11 libraries are no longer relevant. R=scottmg@chromium.org Review URL: https://codereview.chromium.org/1513573005 .
This commit is contained in:
Родитель
8f3b0af215
Коммит
583d1dc3ef
|
@ -18,6 +18,8 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/numerics/safe_math.h"
|
#include "base/numerics/safe_math.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
|
@ -25,7 +27,6 @@
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "client/settings.h"
|
#include "client/settings.h"
|
||||||
#include "util/misc/initialization_state_dcheck.h"
|
#include "util/misc/initialization_state_dcheck.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
|
@ -822,7 +823,7 @@ scoped_ptr<CrashReportDatabase> InitializeInternal(
|
||||||
scoped_ptr<CrashReportDatabaseWin> database_win(
|
scoped_ptr<CrashReportDatabaseWin> database_win(
|
||||||
new CrashReportDatabaseWin(path));
|
new CrashReportDatabaseWin(path));
|
||||||
return database_win->Initialize(may_create)
|
return database_win->Initialize(may_create)
|
||||||
? crashpad::move(database_win)
|
? std::move(database_win)
|
||||||
: scoped_ptr<CrashReportDatabaseWin>();
|
: scoped_ptr<CrashReportDatabaseWin>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/mach_logging.h"
|
#include "base/mac/mach_logging.h"
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
|
@ -32,7 +34,6 @@
|
||||||
#include "util/mach/notify_server.h"
|
#include "util/mach/notify_server.h"
|
||||||
#include "util/misc/clock.h"
|
#include "util/misc/clock.h"
|
||||||
#include "util/misc/implicit_cast.h"
|
#include "util/misc/implicit_cast.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/posix/close_multiple.h"
|
#include "util/posix/close_multiple.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -159,7 +160,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
|
||||||
url,
|
url,
|
||||||
annotations,
|
annotations,
|
||||||
arguments,
|
arguments,
|
||||||
crashpad::move(receive_right),
|
std::move(receive_right),
|
||||||
handler_restarter.get(),
|
handler_restarter.get(),
|
||||||
false)) {
|
false)) {
|
||||||
return base::mac::ScopedMachSendRight();
|
return base::mac::ScopedMachSendRight();
|
||||||
|
@ -539,7 +540,7 @@ bool CrashpadClient::StartHandler(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHandlerMachPort(crashpad::move(exception_port));
|
SetHandlerMachPort(std::move(exception_port));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,14 +550,14 @@ bool CrashpadClient::SetHandlerMachService(const std::string& service_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetHandlerMachPort(crashpad::move(exception_port));
|
SetHandlerMachPort(std::move(exception_port));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashpadClient::SetHandlerMachPort(
|
void CrashpadClient::SetHandlerMachPort(
|
||||||
base::mac::ScopedMachSendRight exception_port) {
|
base::mac::ScopedMachSendRight exception_port) {
|
||||||
DCHECK(exception_port.is_valid());
|
DCHECK(exception_port.is_valid());
|
||||||
exception_port_ = crashpad::move(exception_port);
|
exception_port_ = std::move(exception_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CrashpadClient::UseHandler() {
|
bool CrashpadClient::UseHandler() {
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/in_range_cast.h"
|
#include "util/numeric/in_range_cast.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
'mac/mach-o/getsect.h',
|
'mac/mach-o/getsect.h',
|
||||||
'mac/mach-o/loader.h',
|
'mac/mach-o/loader.h',
|
||||||
'mac/sys/resource.h',
|
'mac/sys/resource.h',
|
||||||
|
'non_cxx11_lib/type_traits',
|
||||||
|
'non_cxx11_lib/utility',
|
||||||
'non_mac/mach/mach.h',
|
'non_mac/mach/mach.h',
|
||||||
'non_win/dbghelp.h',
|
'non_win/dbghelp.h',
|
||||||
'non_win/minwinbase.h',
|
'non_win/minwinbase.h',
|
||||||
|
@ -50,10 +52,12 @@
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'mac',
|
'mac',
|
||||||
|
'non_cxx11_lib',
|
||||||
],
|
],
|
||||||
'direct_dependent_settings': {
|
'direct_dependent_settings': {
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
'mac',
|
'mac',
|
||||||
|
'non_cxx11_lib',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_
|
||||||
|
#define CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_
|
||||||
|
|
||||||
|
#include "util/stdlib/cxx.h"
|
||||||
|
|
||||||
|
#if CXX_LIBRARY_VERSION >= 2011
|
||||||
|
|
||||||
|
#include_next <type_traits>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct remove_reference { using type = T; };
|
||||||
|
template <class T>
|
||||||
|
struct remove_reference<T&> { using type = T; };
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
#endif // CXX_LIBRARY_VERSION
|
||||||
|
|
||||||
|
#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_
|
|
@ -0,0 +1,46 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_
|
||||||
|
#define CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_
|
||||||
|
|
||||||
|
#include_next <utility>
|
||||||
|
|
||||||
|
#include "util/stdlib/cxx.h"
|
||||||
|
|
||||||
|
#if CXX_LIBRARY_VERSION < 2011
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
T&& forward(typename remove_reference<T>::type& t) noexcept {
|
||||||
|
return static_cast<T&&>(t);
|
||||||
|
}
|
||||||
|
template <class T>
|
||||||
|
T&& forward(typename remove_reference<T>::type&& t) noexcept {
|
||||||
|
return static_cast<T&&>(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
typename remove_reference<T>::type&& move(T&& t) noexcept {
|
||||||
|
return static_cast<typename remove_reference<T>::type&&>(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
#endif // CXX_LIBRARY_VERSION
|
||||||
|
|
||||||
|
#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_
|
|
@ -28,7 +28,6 @@
|
||||||
#include "snapshot/minidump/process_snapshot_minidump.h"
|
#include "snapshot/minidump/process_snapshot_minidump.h"
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "util/file/file_reader.h"
|
#include "util/file/file_reader.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
#include "util/net/http_body.h"
|
#include "util/net/http_body.h"
|
||||||
#include "util/net/http_multipart_builder.h"
|
#include "util/net/http_multipart_builder.h"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
#include "tools/tool_support.h"
|
#include "tools/tool_support.h"
|
||||||
#include "handler/crash_report_upload_thread.h"
|
#include "handler/crash_report_upload_thread.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/stdlib/map_insert.h"
|
#include "util/stdlib/map_insert.h"
|
||||||
#include "util/stdlib/string_number_conversion.h"
|
#include "util/stdlib/string_number_conversion.h"
|
||||||
#include "util/string/split_string.h"
|
#include "util/string/split_string.h"
|
||||||
|
@ -315,7 +315,7 @@ int HandlerMain(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExceptionHandlerServer exception_handler_server(
|
ExceptionHandlerServer exception_handler_server(
|
||||||
crashpad::move(receive_right), !options.mach_service.empty());
|
std::move(receive_right), !options.mach_service.empty());
|
||||||
base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server(
|
base::AutoReset<ExceptionHandlerServer*> reset_g_exception_handler_server(
|
||||||
&g_exception_handler_server, &exception_handler_server);
|
&g_exception_handler_server, &exception_handler_server);
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "handler/mac/exception_handler_server.h"
|
#include "handler/mac/exception_handler_server.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/mach_logging.h"
|
#include "base/mac/mach_logging.h"
|
||||||
#include "util/mach/composite_mach_message_server.h"
|
#include "util/mach/composite_mach_message_server.h"
|
||||||
|
@ -21,7 +23,6 @@
|
||||||
#include "util/mach/mach_message.h"
|
#include "util/mach/mach_message.h"
|
||||||
#include "util/mach/mach_message_server.h"
|
#include "util/mach/mach_message_server.h"
|
||||||
#include "util/mach/notify_server.h"
|
#include "util/mach/notify_server.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface,
|
||||||
ExceptionHandlerServer::ExceptionHandlerServer(
|
ExceptionHandlerServer::ExceptionHandlerServer(
|
||||||
base::mac::ScopedMachReceiveRight receive_port,
|
base::mac::ScopedMachReceiveRight receive_port,
|
||||||
bool launchd)
|
bool launchd)
|
||||||
: receive_port_(crashpad::move(receive_port)),
|
: receive_port_(std::move(receive_port)),
|
||||||
notify_port_(NewMachPort(MACH_PORT_RIGHT_RECEIVE)),
|
notify_port_(NewMachPort(MACH_PORT_RIGHT_RECEIVE)),
|
||||||
launchd_(launchd) {
|
launchd_(launchd) {
|
||||||
CHECK(receive_port_.is_valid());
|
CHECK(receive_port_.is_valid());
|
||||||
|
|
|
@ -14,12 +14,13 @@
|
||||||
|
|
||||||
#include "minidump/minidump_crashpad_info_writer.h"
|
#include "minidump/minidump_crashpad_info_writer.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "minidump/minidump_module_crashpad_info_writer.h"
|
#include "minidump/minidump_module_crashpad_info_writer.h"
|
||||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||||
#include "snapshot/process_snapshot.h"
|
#include "snapshot/process_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
|
@ -52,14 +53,14 @@ void MinidumpCrashpadInfoWriter::InitializeFromSnapshot(
|
||||||
simple_annotations->InitializeFromMap(
|
simple_annotations->InitializeFromMap(
|
||||||
process_snapshot->AnnotationsSimpleMap());
|
process_snapshot->AnnotationsSimpleMap());
|
||||||
if (simple_annotations->IsUseful()) {
|
if (simple_annotations->IsUseful()) {
|
||||||
SetSimpleAnnotations(crashpad::move(simple_annotations));
|
SetSimpleAnnotations(std::move(simple_annotations));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
||||||
|
|
||||||
if (modules->IsUseful()) {
|
if (modules->IsUseful()) {
|
||||||
SetModuleList(crashpad::move(modules));
|
SetModuleList(std::move(modules));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,14 +80,14 @@ void MinidumpCrashpadInfoWriter::SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
simple_annotations_ = crashpad::move(simple_annotations);
|
simple_annotations_ = std::move(simple_annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpCrashpadInfoWriter::SetModuleList(
|
void MinidumpCrashpadInfoWriter::SetModuleList(
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) {
|
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
module_list_ = crashpad::move(module_list);
|
module_list_ = std::move(module_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinidumpCrashpadInfoWriter::Freeze() {
|
bool MinidumpCrashpadInfoWriter::Freeze() {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include "snapshot/test/test_module_snapshot.h"
|
#include "snapshot/test/test_module_snapshot.h"
|
||||||
#include "snapshot/test/test_process_snapshot.h"
|
#include "snapshot/test/test_process_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -68,7 +68,7 @@ TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -103,7 +103,7 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||||
|
|
||||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -138,13 +138,13 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||||
simple_string_dictionary_writer->AddEntry(
|
simple_string_dictionary_writer->AddEntry(
|
||||||
crashpad::move(simple_string_dictionary_entry_writer));
|
std::move(simple_string_dictionary_entry_writer));
|
||||||
crashpad_info_writer->SetSimpleAnnotations(
|
crashpad_info_writer->SetSimpleAnnotations(
|
||||||
crashpad::move(simple_string_dictionary_writer));
|
std::move(simple_string_dictionary_writer));
|
||||||
|
|
||||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -178,12 +178,13 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer), kMinidumpModuleListIndex);
|
module_list_writer->AddModule(std::move(module_writer),
|
||||||
crashpad_info_writer->SetModuleList(crashpad::move(module_list_writer));
|
kMinidumpModuleListIndex);
|
||||||
|
crashpad_info_writer->SetModuleList(std::move(module_list_writer));
|
||||||
|
|
||||||
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
EXPECT_TRUE(crashpad_info_writer->IsUseful());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer));
|
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -233,7 +234,7 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||||
auto process_snapshot = make_scoped_ptr(new TestProcessSnapshot());
|
auto process_snapshot = make_scoped_ptr(new TestProcessSnapshot());
|
||||||
|
|
||||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
||||||
process_snapshot->AddModule(crashpad::move(module_snapshot));
|
process_snapshot->AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
auto info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||||
|
@ -252,14 +253,14 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
||||||
module_snapshot.reset(new TestModuleSnapshot());
|
module_snapshot.reset(new TestModuleSnapshot());
|
||||||
std::vector<std::string> annotations_list(1, std::string(kEntry));
|
std::vector<std::string> annotations_list(1, std::string(kEntry));
|
||||||
module_snapshot->SetAnnotationsVector(annotations_list);
|
module_snapshot->SetAnnotationsVector(annotations_list);
|
||||||
process_snapshot->AddModule(crashpad::move(module_snapshot));
|
process_snapshot->AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
info_writer.reset(new MinidumpCrashpadInfoWriter());
|
info_writer.reset(new MinidumpCrashpadInfoWriter());
|
||||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||||
EXPECT_TRUE(info_writer->IsUseful());
|
EXPECT_TRUE(info_writer->IsUseful());
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(info_writer));
|
minidump_file_writer.AddStream(std::move(info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
|
|
@ -16,12 +16,13 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
#include "minidump/minidump_context_writer.h"
|
#include "minidump/minidump_context_writer.h"
|
||||||
#include "snapshot/exception_snapshot.h"
|
#include "snapshot/exception_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
|
@ -49,14 +50,14 @@ void MinidumpExceptionWriter::InitializeFromSnapshot(
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context =
|
scoped_ptr<MinidumpContextWriter> context =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context());
|
MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context());
|
||||||
SetContext(crashpad::move(context));
|
SetContext(std::move(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpExceptionWriter::SetContext(
|
void MinidumpExceptionWriter::SetContext(
|
||||||
scoped_ptr<MinidumpContextWriter> context) {
|
scoped_ptr<MinidumpContextWriter> context) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
context_ = crashpad::move(context);
|
context_ = std::move(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpExceptionWriter::SetExceptionInformation(
|
void MinidumpExceptionWriter::SetExceptionInformation(
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
#include "snapshot/test/test_exception_snapshot.h"
|
#include "snapshot/test/test_exception_snapshot.h"
|
||||||
#include "test/gtest_death_check.h"
|
#include "test/gtest_death_check.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -105,9 +105,9 @@ TEST(MinidumpExceptionWriter, Minimal) {
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
exception_writer->SetContext(crashpad::move(context_x86_writer));
|
exception_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
minidump_file_writer.AddStream(std::move(exception_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -145,7 +145,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
exception_writer->SetContext(crashpad::move(context_x86_writer));
|
exception_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
exception_writer->SetThreadID(kThreadID);
|
exception_writer->SetThreadID(kThreadID);
|
||||||
exception_writer->SetExceptionCode(kExceptionCode);
|
exception_writer->SetExceptionCode(kExceptionCode);
|
||||||
|
@ -166,7 +166,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
||||||
exception_information.push_back(kExceptionInformation2);
|
exception_information.push_back(kExceptionInformation2);
|
||||||
exception_writer->SetExceptionInformation(exception_information);
|
exception_writer->SetExceptionInformation(exception_information);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
minidump_file_writer.AddStream(std::move(exception_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -239,7 +239,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
||||||
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
minidump_file_writer.AddStream(std::move(exception_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -261,7 +261,7 @@ TEST(MinidumpExceptionWriterDeathTest, NoContext) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(exception_writer));
|
minidump_file_writer.AddStream(std::move(exception_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "minidump/minidump_crashpad_info_writer.h"
|
#include "minidump/minidump_crashpad_info_writer.h"
|
||||||
#include "minidump/minidump_exception_writer.h"
|
#include "minidump/minidump_exception_writer.h"
|
||||||
|
@ -28,7 +30,6 @@
|
||||||
#include "minidump/minidump_writer_util.h"
|
#include "minidump/minidump_writer_util.h"
|
||||||
#include "snapshot/process_snapshot.h"
|
#include "snapshot/process_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -68,11 +69,11 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||||
const SystemSnapshot* system_snapshot = process_snapshot->System();
|
const SystemSnapshot* system_snapshot = process_snapshot->System();
|
||||||
auto system_info = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
||||||
system_info->InitializeFromSnapshot(system_snapshot);
|
system_info->InitializeFromSnapshot(system_snapshot);
|
||||||
AddStream(crashpad::move(system_info));
|
AddStream(std::move(system_info));
|
||||||
|
|
||||||
auto misc_info = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||||
misc_info->InitializeFromSnapshot(process_snapshot);
|
misc_info->InitializeFromSnapshot(process_snapshot);
|
||||||
AddStream(crashpad::move(misc_info));
|
AddStream(std::move(misc_info));
|
||||||
|
|
||||||
auto memory_list = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||||
auto thread_list = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list = make_scoped_ptr(new MinidumpThreadListWriter());
|
||||||
|
@ -80,18 +81,18 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||||
MinidumpThreadIDMap thread_id_map;
|
MinidumpThreadIDMap thread_id_map;
|
||||||
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
||||||
&thread_id_map);
|
&thread_id_map);
|
||||||
AddStream(crashpad::move(thread_list));
|
AddStream(std::move(thread_list));
|
||||||
|
|
||||||
const ExceptionSnapshot* exception_snapshot = process_snapshot->Exception();
|
const ExceptionSnapshot* exception_snapshot = process_snapshot->Exception();
|
||||||
if (exception_snapshot) {
|
if (exception_snapshot) {
|
||||||
auto exception = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception = make_scoped_ptr(new MinidumpExceptionWriter());
|
||||||
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
||||||
AddStream(crashpad::move(exception));
|
AddStream(std::move(exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto module_list = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||||
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
||||||
AddStream(crashpad::move(module_list));
|
AddStream(std::move(module_list));
|
||||||
|
|
||||||
auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
||||||
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
||||||
|
@ -99,7 +100,7 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||||
// Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add
|
// Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add
|
||||||
// it to the minidump file if it wouldn’t carry any useful information.
|
// it to the minidump file if it wouldn’t carry any useful information.
|
||||||
if (crashpad_info->IsUseful()) {
|
if (crashpad_info->IsUseful()) {
|
||||||
AddStream(crashpad::move(crashpad_info));
|
AddStream(std::move(crashpad_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
||||||
|
@ -107,19 +108,19 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
||||||
if (!memory_map_snapshot.empty()) {
|
if (!memory_map_snapshot.empty()) {
|
||||||
auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
||||||
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
||||||
AddStream(crashpad::move(memory_info_list));
|
AddStream(std::move(memory_info_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles();
|
std::vector<HandleSnapshot> handles_snapshot = process_snapshot->Handles();
|
||||||
if (!handles_snapshot.empty()) {
|
if (!handles_snapshot.empty()) {
|
||||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
||||||
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
||||||
AddStream(crashpad::move(handle_data_writer));
|
AddStream(std::move(handle_data_writer));
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_list->AddFromSnapshot(process_snapshot->ExtraMemory());
|
memory_list->AddFromSnapshot(process_snapshot->ExtraMemory());
|
||||||
|
|
||||||
AddStream(crashpad::move(memory_list));
|
AddStream(std::move(memory_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
|
void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
@ -35,7 +36,6 @@
|
||||||
#include "snapshot/test/test_thread_snapshot.h"
|
#include "snapshot/test/test_thread_snapshot.h"
|
||||||
#include "test/gtest_death_check.h"
|
#include "test/gtest_death_check.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -97,7 +97,7 @@ TEST(MinidumpFileWriter, OneStream) {
|
||||||
const uint8_t kStreamValue = 0x5a;
|
const uint8_t kStreamValue = 0x5a;
|
||||||
auto stream =
|
auto stream =
|
||||||
make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
||||||
minidump_file.AddStream(crashpad::move(stream));
|
minidump_file.AddStream(std::move(stream));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||||
|
@ -136,7 +136,7 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||||
const uint8_t kStream0Value = 0x5a;
|
const uint8_t kStream0Value = 0x5a;
|
||||||
auto stream0 = make_scoped_ptr(
|
auto stream0 = make_scoped_ptr(
|
||||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||||
minidump_file.AddStream(crashpad::move(stream0));
|
minidump_file.AddStream(std::move(stream0));
|
||||||
|
|
||||||
// Make the second stream’s type be a smaller quantity than the first stream’s
|
// Make the second stream’s type be a smaller quantity than the first stream’s
|
||||||
// to test that the streams show up in the order that they were added, not in
|
// to test that the streams show up in the order that they were added, not in
|
||||||
|
@ -146,14 +146,14 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
||||||
const uint8_t kStream1Value = 0xa5;
|
const uint8_t kStream1Value = 0xa5;
|
||||||
auto stream1 = make_scoped_ptr(
|
auto stream1 = make_scoped_ptr(
|
||||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||||
minidump_file.AddStream(crashpad::move(stream1));
|
minidump_file.AddStream(std::move(stream1));
|
||||||
|
|
||||||
const size_t kStream2Size = 1;
|
const size_t kStream2Size = 1;
|
||||||
const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e);
|
const MinidumpStreamType kStream2Type = static_cast<MinidumpStreamType>(0x7e);
|
||||||
const uint8_t kStream2Value = 0x36;
|
const uint8_t kStream2Value = 0x36;
|
||||||
auto stream2 = make_scoped_ptr(
|
auto stream2 = make_scoped_ptr(
|
||||||
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
||||||
minidump_file.AddStream(crashpad::move(stream2));
|
minidump_file.AddStream(std::move(stream2));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||||
|
@ -220,7 +220,7 @@ TEST(MinidumpFileWriter, ZeroLengthStream) {
|
||||||
const size_t kStreamSize = 0;
|
const size_t kStreamSize = 0;
|
||||||
const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
|
const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
|
||||||
auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0));
|
auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0));
|
||||||
minidump_file.AddStream(crashpad::move(stream));
|
minidump_file.AddStream(std::move(stream));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file.WriteEverything(&string_file));
|
||||||
|
@ -252,7 +252,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
||||||
const uint64_t kPebAddress = 0x07f90000;
|
const uint64_t kPebAddress = 0x07f90000;
|
||||||
|
@ -260,7 +260,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
||||||
const size_t kPebSize = 0x280;
|
const size_t kPebSize = 0x280;
|
||||||
peb_snapshot->SetSize(kPebSize);
|
peb_snapshot->SetSize(kPebSize);
|
||||||
peb_snapshot->SetValue('p');
|
peb_snapshot->SetValue('p');
|
||||||
process_snapshot.AddExtraMemory(crashpad::move(peb_snapshot));
|
process_snapshot.AddExtraMemory(std::move(peb_snapshot));
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||||
|
@ -316,22 +316,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
||||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||||
process_snapshot.AddThread(crashpad::move(thread_snapshot));
|
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||||
|
|
||||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
||||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||||
process_snapshot.SetException(crashpad::move(exception_snapshot));
|
process_snapshot.SetException(std::move(exception_snapshot));
|
||||||
|
|
||||||
// The module does not have anything that needs to be represented in a
|
// The module does not have anything that needs to be represented in a
|
||||||
// MinidumpModuleCrashpadInfo structure, so no such structure is expected to
|
// MinidumpModuleCrashpadInfo structure, so no such structure is expected to
|
||||||
// be present, which will in turn suppress the addition of a
|
// be present, which will in turn suppress the addition of a
|
||||||
// MinidumpCrashpadInfo stream.
|
// MinidumpCrashpadInfo stream.
|
||||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
||||||
process_snapshot.AddModule(crashpad::move(module_snapshot));
|
process_snapshot.AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||||
|
@ -380,22 +380,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
||||||
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64);
|
||||||
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX);
|
||||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
||||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||||
process_snapshot.AddThread(crashpad::move(thread_snapshot));
|
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||||
|
|
||||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
||||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||||
process_snapshot.SetException(crashpad::move(exception_snapshot));
|
process_snapshot.SetException(std::move(exception_snapshot));
|
||||||
|
|
||||||
// The module needs an annotation for the MinidumpCrashpadInfo stream to be
|
// The module needs an annotation for the MinidumpCrashpadInfo stream to be
|
||||||
// considered useful and be included.
|
// considered useful and be included.
|
||||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
||||||
std::vector<std::string> annotations_list(1, std::string("annotation"));
|
std::vector<std::string> annotations_list(1, std::string("annotation"));
|
||||||
module_snapshot->SetAnnotationsVector(annotations_list);
|
module_snapshot->SetAnnotationsVector(annotations_list);
|
||||||
process_snapshot.AddModule(crashpad::move(module_snapshot));
|
process_snapshot.AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
minidump_file_writer.InitializeFromSnapshot(&process_snapshot);
|
||||||
|
@ -446,7 +446,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
||||||
const uint8_t kStream0Value = 0x5a;
|
const uint8_t kStream0Value = 0x5a;
|
||||||
auto stream0 = make_scoped_ptr(
|
auto stream0 = make_scoped_ptr(
|
||||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||||
minidump_file.AddStream(crashpad::move(stream0));
|
minidump_file.AddStream(std::move(stream0));
|
||||||
|
|
||||||
// It is an error to add a second stream of the same type.
|
// It is an error to add a second stream of the same type.
|
||||||
const size_t kStream1Size = 3;
|
const size_t kStream1Size = 3;
|
||||||
|
@ -454,7 +454,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
||||||
const uint8_t kStream1Value = 0xa5;
|
const uint8_t kStream1Value = 0xa5;
|
||||||
auto stream1 = make_scoped_ptr(
|
auto stream1 = make_scoped_ptr(
|
||||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||||
ASSERT_DEATH_CHECK(minidump_file.AddStream(crashpad::move(stream1)),
|
ASSERT_DEATH_CHECK(minidump_file.AddStream(std::move(stream1)),
|
||||||
"already present");
|
"already present");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "minidump/minidump_handle_writer.h"
|
#include "minidump/minidump_handle_writer.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -23,7 +24,6 @@
|
||||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -58,7 +58,7 @@ void GetHandleDataStream(
|
||||||
TEST(MinidumpHandleDataWriter, Empty) {
|
TEST(MinidumpHandleDataWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
||||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
minidump_file_writer.AddStream(std::move(handle_data_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -91,7 +91,7 @@ TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||||
|
|
||||||
handle_data_writer->InitializeFromSnapshot(snapshot);
|
handle_data_writer->InitializeFromSnapshot(snapshot);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
minidump_file_writer.AddStream(std::move(handle_data_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -149,7 +149,7 @@ TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||||
|
|
||||||
handle_data_writer->InitializeFromSnapshot(snapshot);
|
handle_data_writer->InitializeFromSnapshot(snapshot);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(handle_data_writer));
|
minidump_file_writer.AddStream(std::move(handle_data_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "minidump/minidump_memory_info_writer.h"
|
#include "minidump/minidump_memory_info_writer.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
|
@ -22,7 +23,6 @@
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "snapshot/test/test_memory_map_region_snapshot.h"
|
#include "snapshot/test/test_memory_map_region_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -59,7 +59,7 @@ TEST(MinidumpMemoryInfoWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_info_list_writer =
|
auto memory_info_list_writer =
|
||||||
make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_info_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -96,7 +96,7 @@ TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||||
memory_map.push_back(memory_map_region.get());
|
memory_map.push_back(memory_map_region.get());
|
||||||
memory_info_list_writer->InitializeFromSnapshot(memory_map);
|
memory_info_list_writer->InitializeFromSnapshot(memory_map);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_info_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
|
|
@ -14,11 +14,12 @@
|
||||||
|
|
||||||
#include "minidump/minidump_memory_writer.h"
|
#include "minidump/minidump_memory_writer.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "snapshot/memory_snapshot.h"
|
#include "snapshot/memory_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -178,7 +179,7 @@ void MinidumpMemoryListWriter::AddFromSnapshot(
|
||||||
for (const MemorySnapshot* memory_snapshot : memory_snapshots) {
|
for (const MemorySnapshot* memory_snapshot : memory_snapshots) {
|
||||||
scoped_ptr<MinidumpMemoryWriter> memory =
|
scoped_ptr<MinidumpMemoryWriter> memory =
|
||||||
MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot);
|
MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot);
|
||||||
AddMemory(crashpad::move(memory));
|
AddMemory(std::move(memory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
|
@ -30,7 +32,6 @@
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "snapshot/test/test_memory_snapshot.h"
|
#include "snapshot/test/test_memory_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -81,7 +82,7 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -107,9 +108,9 @@ TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
||||||
memory_list_writer->AddMemory(crashpad::move(memory_writer));
|
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -145,12 +146,12 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
||||||
|
|
||||||
auto memory_writer_0 = make_scoped_ptr(
|
auto memory_writer_0 = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
||||||
memory_list_writer->AddMemory(crashpad::move(memory_writer_0));
|
memory_list_writer->AddMemory(std::move(memory_writer_0));
|
||||||
auto memory_writer_1 = make_scoped_ptr(
|
auto memory_writer_1 = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||||
memory_list_writer->AddMemory(crashpad::move(memory_writer_1));
|
memory_list_writer->AddMemory(std::move(memory_writer_1));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -249,7 +250,7 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
||||||
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(test_memory_stream));
|
minidump_file_writer.AddStream(std::move(test_memory_stream));
|
||||||
|
|
||||||
const uint64_t kBaseAddress1 = 0x2000;
|
const uint64_t kBaseAddress1 = 0x2000;
|
||||||
const size_t kSize1 = 0x0400;
|
const size_t kSize1 = 0x0400;
|
||||||
|
@ -257,9 +258,9 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||||
memory_list_writer->AddMemory(crashpad::move(memory_writer));
|
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -337,7 +338,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) {
|
||||||
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
#include "snapshot/test/test_process_snapshot.h"
|
#include "snapshot/test/test_process_snapshot.h"
|
||||||
#include "snapshot/test/test_system_snapshot.h"
|
#include "snapshot/test/test_system_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/stdlib/strlcpy.h"
|
#include "util/stdlib/strlcpy.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -169,7 +169,7 @@ TEST(MinidumpMiscInfoWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -190,7 +190,7 @@ TEST(MinidumpMiscInfoWriter, ProcessId) {
|
||||||
|
|
||||||
misc_info_writer->SetProcessID(kProcessId);
|
misc_info_writer->SetProcessID(kProcessId);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -216,7 +216,7 @@ TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
||||||
misc_info_writer->SetProcessTimes(
|
misc_info_writer->SetProcessTimes(
|
||||||
kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
|
kProcessCreateTime, kProcessUserTime, kProcessKernelTime);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -249,7 +249,7 @@ TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
||||||
kProcessorMaxIdleState,
|
kProcessorMaxIdleState,
|
||||||
kProcessorCurrentIdleState);
|
kProcessorCurrentIdleState);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -276,7 +276,7 @@ TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
||||||
|
|
||||||
misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel);
|
misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -299,7 +299,7 @@ TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
||||||
|
|
||||||
misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags);
|
misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -322,7 +322,7 @@ TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
||||||
|
|
||||||
misc_info_writer->SetProtectedProcess(kProtectedProcess);
|
misc_info_writer->SetProtectedProcess(kProtectedProcess);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -359,7 +359,7 @@ TEST(MinidumpMiscInfoWriter, TimeZone) {
|
||||||
kDaylightDate,
|
kDaylightDate,
|
||||||
kDaylightBias);
|
kDaylightBias);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -420,7 +420,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
||||||
kSystemTimeZero,
|
kSystemTimeZero,
|
||||||
kDaylightBias);
|
kDaylightBias);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -461,7 +461,7 @@ TEST(MinidumpMiscInfoWriter, BuildStrings) {
|
||||||
|
|
||||||
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -498,7 +498,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
||||||
|
|
||||||
misc_info_writer->SetBuildString(build_string, debug_build_string);
|
misc_info_writer->SetBuildString(build_string, debug_build_string);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -568,7 +568,7 @@ TEST(MinidumpMiscInfoWriter, Everything) {
|
||||||
kDaylightBias);
|
kDaylightBias);
|
||||||
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
misc_info_writer->SetBuildString(kBuildString, kDebugBuildString);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -702,13 +702,13 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
||||||
system_snapshot->SetOSVersionFull(kOSVersionFull);
|
system_snapshot->SetOSVersionFull(kOSVersionFull);
|
||||||
system_snapshot->SetMachineDescription(kMachineDescription);
|
system_snapshot->SetMachineDescription(kMachineDescription);
|
||||||
|
|
||||||
process_snapshot.SetSystem(crashpad::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
||||||
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
|
|
@ -16,11 +16,12 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -45,7 +46,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
||||||
auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
||||||
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
||||||
if (list_annotations->IsUseful()) {
|
if (list_annotations->IsUseful()) {
|
||||||
SetListAnnotations(crashpad::move(list_annotations));
|
SetListAnnotations(std::move(list_annotations));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto simple_annotations =
|
auto simple_annotations =
|
||||||
|
@ -53,7 +54,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
||||||
simple_annotations->InitializeFromMap(
|
simple_annotations->InitializeFromMap(
|
||||||
module_snapshot->AnnotationsSimpleMap());
|
module_snapshot->AnnotationsSimpleMap());
|
||||||
if (simple_annotations->IsUseful()) {
|
if (simple_annotations->IsUseful()) {
|
||||||
SetSimpleAnnotations(crashpad::move(simple_annotations));
|
SetSimpleAnnotations(std::move(simple_annotations));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +62,14 @@ void MinidumpModuleCrashpadInfoWriter::SetListAnnotations(
|
||||||
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) {
|
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
list_annotations_ = crashpad::move(list_annotations);
|
list_annotations_ = std::move(list_annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
|
void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
simple_annotations_ = crashpad::move(simple_annotations);
|
simple_annotations_ = std::move(simple_annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinidumpModuleCrashpadInfoWriter::IsUseful() const {
|
bool MinidumpModuleCrashpadInfoWriter::IsUseful() const {
|
||||||
|
@ -145,7 +146,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot(
|
||||||
auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||||
module->InitializeFromSnapshot(module_snapshot);
|
module->InitializeFromSnapshot(module_snapshot);
|
||||||
if (module->IsUseful()) {
|
if (module->IsUseful()) {
|
||||||
AddModule(crashpad::move(module), index);
|
AddModule(std::move(module), index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||||
|
@ -25,7 +27,6 @@
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "snapshot/test/test_module_snapshot.h"
|
#include "snapshot/test/test_module_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -78,7 +79,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) {
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(module_writer->IsUseful());
|
EXPECT_FALSE(module_writer->IsUseful());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer), 0);
|
module_list_writer->AddModule(std::move(module_writer), 0);
|
||||||
|
|
||||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||||
|
|
||||||
|
@ -120,18 +121,18 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||||
auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
||||||
string_list_writer->InitializeFromVector(vector);
|
string_list_writer->InitializeFromVector(vector);
|
||||||
module_writer->SetListAnnotations(crashpad::move(string_list_writer));
|
module_writer->SetListAnnotations(std::move(string_list_writer));
|
||||||
auto simple_string_dictionary_writer =
|
auto simple_string_dictionary_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
||||||
auto simple_string_dictionary_entry_writer =
|
auto simple_string_dictionary_entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue);
|
||||||
simple_string_dictionary_writer->AddEntry(
|
simple_string_dictionary_writer->AddEntry(
|
||||||
crashpad::move(simple_string_dictionary_entry_writer));
|
std::move(simple_string_dictionary_entry_writer));
|
||||||
module_writer->SetSimpleAnnotations(
|
module_writer->SetSimpleAnnotations(
|
||||||
crashpad::move(simple_string_dictionary_writer));
|
std::move(simple_string_dictionary_writer));
|
||||||
EXPECT_TRUE(module_writer->IsUseful());
|
EXPECT_TRUE(module_writer->IsUseful());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer),
|
module_list_writer->AddModule(std::move(module_writer),
|
||||||
kMinidumpModuleListIndex);
|
kMinidumpModuleListIndex);
|
||||||
|
|
||||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||||
|
@ -214,17 +215,17 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
simple_string_dictionary_entry_writer_0->SetKeyValue(kKey0, kValue0);
|
simple_string_dictionary_entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||||
simple_string_dictionary_writer_0->AddEntry(
|
simple_string_dictionary_writer_0->AddEntry(
|
||||||
crashpad::move(simple_string_dictionary_entry_writer_0));
|
std::move(simple_string_dictionary_entry_writer_0));
|
||||||
module_writer_0->SetSimpleAnnotations(
|
module_writer_0->SetSimpleAnnotations(
|
||||||
crashpad::move(simple_string_dictionary_writer_0));
|
std::move(simple_string_dictionary_writer_0));
|
||||||
EXPECT_TRUE(module_writer_0->IsUseful());
|
EXPECT_TRUE(module_writer_0->IsUseful());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_0),
|
module_list_writer->AddModule(std::move(module_writer_0),
|
||||||
kMinidumpModuleListIndex0);
|
kMinidumpModuleListIndex0);
|
||||||
|
|
||||||
auto module_writer_1 =
|
auto module_writer_1 =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(module_writer_1->IsUseful());
|
EXPECT_FALSE(module_writer_1->IsUseful());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_1),
|
module_list_writer->AddModule(std::move(module_writer_1),
|
||||||
kMinidumpModuleListIndex1);
|
kMinidumpModuleListIndex1);
|
||||||
|
|
||||||
auto module_writer_2 =
|
auto module_writer_2 =
|
||||||
|
@ -235,16 +236,16 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
simple_string_dictionary_entry_writer_2a->SetKeyValue(kKey2A, kValue2A);
|
simple_string_dictionary_entry_writer_2a->SetKeyValue(kKey2A, kValue2A);
|
||||||
simple_string_dictionary_writer_2->AddEntry(
|
simple_string_dictionary_writer_2->AddEntry(
|
||||||
crashpad::move(simple_string_dictionary_entry_writer_2a));
|
std::move(simple_string_dictionary_entry_writer_2a));
|
||||||
auto simple_string_dictionary_entry_writer_2b =
|
auto simple_string_dictionary_entry_writer_2b =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
simple_string_dictionary_entry_writer_2b->SetKeyValue(kKey2B, kValue2B);
|
simple_string_dictionary_entry_writer_2b->SetKeyValue(kKey2B, kValue2B);
|
||||||
simple_string_dictionary_writer_2->AddEntry(
|
simple_string_dictionary_writer_2->AddEntry(
|
||||||
crashpad::move(simple_string_dictionary_entry_writer_2b));
|
std::move(simple_string_dictionary_entry_writer_2b));
|
||||||
module_writer_2->SetSimpleAnnotations(
|
module_writer_2->SetSimpleAnnotations(
|
||||||
crashpad::move(simple_string_dictionary_writer_2));
|
std::move(simple_string_dictionary_writer_2));
|
||||||
EXPECT_TRUE(module_writer_2->IsUseful());
|
EXPECT_TRUE(module_writer_2->IsUseful());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_2),
|
module_list_writer->AddModule(std::move(module_writer_2),
|
||||||
kMinidumpModuleListIndex2);
|
kMinidumpModuleListIndex2);
|
||||||
|
|
||||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
|
@ -25,7 +26,6 @@
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/misc/implicit_cast.h"
|
#include "util/misc/implicit_cast.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/in_range_cast.h"
|
#include "util/numeric/in_range_cast.h"
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ void MinidumpModuleWriter::InitializeFromSnapshot(
|
||||||
auto codeview_record =
|
auto codeview_record =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||||
codeview_record->InitializeFromSnapshot(module_snapshot);
|
codeview_record->InitializeFromSnapshot(module_snapshot);
|
||||||
SetCodeViewRecord(crashpad::move(codeview_record));
|
SetCodeViewRecord(std::move(codeview_record));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const {
|
const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const {
|
||||||
|
@ -267,14 +267,14 @@ void MinidumpModuleWriter::SetCodeViewRecord(
|
||||||
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
|
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
codeview_record_ = crashpad::move(codeview_record);
|
codeview_record_ = std::move(codeview_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleWriter::SetMiscDebugRecord(
|
void MinidumpModuleWriter::SetMiscDebugRecord(
|
||||||
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
|
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
misc_debug_record_ = crashpad::move(misc_debug_record);
|
misc_debug_record_ = std::move(misc_debug_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleWriter::SetTimestamp(time_t timestamp) {
|
void MinidumpModuleWriter::SetTimestamp(time_t timestamp) {
|
||||||
|
@ -386,7 +386,7 @@ void MinidumpModuleListWriter::InitializeFromSnapshot(
|
||||||
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
||||||
auto module = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module = make_scoped_ptr(new MinidumpModuleWriter());
|
||||||
module->InitializeFromSnapshot(module_snapshot);
|
module->InitializeFromSnapshot(module_snapshot);
|
||||||
AddModule(crashpad::move(module));
|
AddModule(std::move(module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
|
@ -33,7 +35,6 @@
|
||||||
#include "test/gtest_death_check.h"
|
#include "test/gtest_death_check.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/misc/implicit_cast.h"
|
#include "util/misc/implicit_cast.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
|
|
||||||
|
@ -69,7 +70,7 @@ TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -277,8 +278,8 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
||||||
module_writer->SetName(kModuleName);
|
module_writer->SetName(kModuleName);
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -360,16 +361,16 @@ TEST(MinidumpModuleWriter, OneModule) {
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||||
codeview_pdb70_writer->SetPDBName(kPDBName);
|
codeview_pdb70_writer->SetPDBName(kPDBName);
|
||||||
codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge);
|
codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge);
|
||||||
module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer));
|
module_writer->SetCodeViewRecord(std::move(codeview_pdb70_writer));
|
||||||
|
|
||||||
auto misc_debug_writer =
|
auto misc_debug_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
||||||
misc_debug_writer->SetDataType(kDebugType);
|
misc_debug_writer->SetDataType(kDebugType);
|
||||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||||
module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer));
|
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -435,16 +436,16 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||||
codeview_pdb20_writer->SetPDBName(kPDBName);
|
codeview_pdb20_writer->SetPDBName(kPDBName);
|
||||||
codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge);
|
codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge);
|
||||||
module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb20_writer));
|
module_writer->SetCodeViewRecord(std::move(codeview_pdb20_writer));
|
||||||
|
|
||||||
auto misc_debug_writer =
|
auto misc_debug_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter());
|
||||||
misc_debug_writer->SetDataType(kDebugType);
|
misc_debug_writer->SetDataType(kDebugType);
|
||||||
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
misc_debug_writer->SetData(kDebugName, kDebugUTF16);
|
||||||
module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer));
|
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -512,16 +513,16 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||||
codeview_pdb70_writer_0->SetPDBName(kPDBName0);
|
codeview_pdb70_writer_0->SetPDBName(kPDBName0);
|
||||||
codeview_pdb70_writer_0->SetUUIDAndAge(pdb_uuid_0, kPDBAge0);
|
codeview_pdb70_writer_0->SetUUIDAndAge(pdb_uuid_0, kPDBAge0);
|
||||||
module_writer_0->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_0));
|
module_writer_0->SetCodeViewRecord(std::move(codeview_pdb70_writer_0));
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_0));
|
module_list_writer->AddModule(std::move(module_writer_0));
|
||||||
|
|
||||||
auto module_writer_1 = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer_1 = make_scoped_ptr(new MinidumpModuleWriter());
|
||||||
module_writer_1->SetName(kModuleName1);
|
module_writer_1->SetName(kModuleName1);
|
||||||
module_writer_1->SetImageBaseAddress(kModuleBase1);
|
module_writer_1->SetImageBaseAddress(kModuleBase1);
|
||||||
module_writer_1->SetImageSize(kModuleSize1);
|
module_writer_1->SetImageSize(kModuleSize1);
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_1));
|
module_list_writer->AddModule(std::move(module_writer_1));
|
||||||
|
|
||||||
auto module_writer_2 = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer_2 = make_scoped_ptr(new MinidumpModuleWriter());
|
||||||
module_writer_2->SetName(kModuleName2);
|
module_writer_2->SetName(kModuleName2);
|
||||||
|
@ -532,11 +533,11 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
||||||
codeview_pdb70_writer_2->SetPDBName(kPDBName2);
|
codeview_pdb70_writer_2->SetPDBName(kPDBName2);
|
||||||
codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
|
codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2);
|
||||||
module_writer_2->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_2));
|
module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2));
|
||||||
|
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer_2));
|
module_list_writer->AddModule(std::move(module_writer_2));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -729,7 +730,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
||||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -760,8 +761,8 @@ TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
||||||
module_list_writer->AddModule(crashpad::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||||
|
|
|
@ -14,13 +14,14 @@
|
||||||
|
|
||||||
#include "minidump/minidump_rva_list_writer.h"
|
#include "minidump/minidump_rva_list_writer.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/test/minidump_rva_list_test_util.h"
|
#include "minidump/test/minidump_rva_list_test_util.h"
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -33,7 +34,7 @@ class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter {
|
||||||
|
|
||||||
void AddChild(uint32_t value) {
|
void AddChild(uint32_t value) {
|
||||||
auto child = make_scoped_ptr(new TestUInt32MinidumpWritable(value));
|
auto child = make_scoped_ptr(new TestUInt32MinidumpWritable(value));
|
||||||
MinidumpRVAListWriter::AddChild(crashpad::move(child));
|
MinidumpRVAListWriter::AddChild(std::move(child));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -14,10 +14,11 @@
|
||||||
|
|
||||||
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
#include "minidump/minidump_simple_string_dictionary_writer.h"
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/stl_util.h"
|
#include "base/stl_util.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -110,7 +111,7 @@ void MinidumpSimpleStringDictionaryWriter::InitializeFromMap(
|
||||||
auto entry =
|
auto entry =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry->SetKeyValue(iterator.first, iterator.second);
|
entry->SetKeyValue(iterator.first, iterator.second);
|
||||||
AddEntry(crashpad::move(entry));
|
AddEntry(std::move(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/test/minidump_string_writer_test_util.h"
|
#include "minidump/test/minidump_string_writer_test_util.h"
|
||||||
#include "minidump/test/minidump_writable_test_util.h"
|
#include "minidump/test/minidump_writable_test_util.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -63,7 +63,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
||||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||||
auto entry_writer =
|
auto entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer));
|
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||||
|
|
||||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
||||||
auto entry_writer =
|
auto entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer->SetKeyValue(kKey, kValue);
|
entry_writer->SetKeyValue(kKey, kValue);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer));
|
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||||
|
|
||||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||||
|
|
||||||
|
@ -135,15 +135,15 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
||||||
auto entry_writer_0 =
|
auto entry_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_0));
|
dictionary_writer.AddEntry(std::move(entry_writer_0));
|
||||||
auto entry_writer_1 =
|
auto entry_writer_1 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_1));
|
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
||||||
auto entry_writer_2 =
|
auto entry_writer_2 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_2));
|
dictionary_writer.AddEntry(std::move(entry_writer_2));
|
||||||
|
|
||||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||||
|
|
||||||
|
@ -203,11 +203,11 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
||||||
auto entry_writer_0 =
|
auto entry_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_0->SetKeyValue(kKey, kValue0);
|
entry_writer_0->SetKeyValue(kKey, kValue0);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_0));
|
dictionary_writer.AddEntry(std::move(entry_writer_0));
|
||||||
auto entry_writer_1 =
|
auto entry_writer_1 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_1->SetKeyValue(kKey, kValue1);
|
entry_writer_1->SetKeyValue(kKey, kValue1);
|
||||||
dictionary_writer.AddEntry(crashpad::move(entry_writer_1));
|
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
||||||
|
|
||||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||||
|
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "minidump/minidump_writer_util.h"
|
#include "minidump/minidump_writer_util.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -122,7 +123,7 @@ void MinidumpStringListWriter<MinidumpStringWriterType>::AddStringUTF8(
|
||||||
const std::string& string_utf8) {
|
const std::string& string_utf8) {
|
||||||
auto string_writer = make_scoped_ptr(new MinidumpStringWriterType());
|
auto string_writer = make_scoped_ptr(new MinidumpStringWriterType());
|
||||||
string_writer->SetUTF8(string_utf8);
|
string_writer->SetUTF8(string_utf8);
|
||||||
AddChild(crashpad::move(string_writer));
|
AddChild(std::move(string_writer));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MinidumpStringWriterType>
|
template <typename MinidumpStringWriterType>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include "snapshot/test/test_system_snapshot.h"
|
#include "snapshot/test/test_system_snapshot.h"
|
||||||
#include "test/gtest_death_check.h"
|
#include "test/gtest_death_check.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -84,7 +84,7 @@ TEST(MinidumpSystemInfoWriter, Empty) {
|
||||||
|
|
||||||
system_info_writer->SetCSDVersion(std::string());
|
system_info_writer->SetCSDVersion(std::string());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -155,7 +155,7 @@ TEST(MinidumpSystemInfoWriter, X86_Win) {
|
||||||
system_info_writer->SetCPUX86VersionAndFeatures(kCPUVersion, kCPUFeatures);
|
system_info_writer->SetCPUX86VersionAndFeatures(kCPUVersion, kCPUFeatures);
|
||||||
system_info_writer->SetCPUX86AMDExtendedFeatures(kAMDFeatures);
|
system_info_writer->SetCPUX86AMDExtendedFeatures(kAMDFeatures);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -215,7 +215,7 @@ TEST(MinidumpSystemInfoWriter, AMD64_Mac) {
|
||||||
system_info_writer->SetCSDVersion(kCSDVersion);
|
system_info_writer->SetCSDVersion(kCSDVersion);
|
||||||
system_info_writer->SetCPUOtherFeatures(kCPUFeatures[0], kCPUFeatures[1]);
|
system_info_writer->SetCPUOtherFeatures(kCPUFeatures[0], kCPUFeatures[1]);
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -257,7 +257,7 @@ TEST(MinidumpSystemInfoWriter, X86_CPUVendorFromRegisters) {
|
||||||
kCPUVendor[0], kCPUVendor[1], kCPUVendor[2]);
|
kCPUVendor[0], kCPUVendor[1], kCPUVendor[2]);
|
||||||
system_info_writer->SetCSDVersion(std::string());
|
system_info_writer->SetCSDVersion(std::string());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -337,7 +337,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) {
|
||||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -432,7 +432,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -470,7 +470,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
||||||
TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) {
|
TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
||||||
minidump_file_writer.AddStream(crashpad::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||||
|
|
|
@ -16,13 +16,14 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "minidump/minidump_context_writer.h"
|
#include "minidump/minidump_context_writer.h"
|
||||||
#include "minidump/minidump_memory_writer.h"
|
#include "minidump/minidump_memory_writer.h"
|
||||||
#include "snapshot/memory_snapshot.h"
|
#include "snapshot/memory_snapshot.h"
|
||||||
#include "snapshot/thread_snapshot.h"
|
#include "snapshot/thread_snapshot.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -53,12 +54,12 @@ void MinidumpThreadWriter::InitializeFromSnapshot(
|
||||||
if (stack_snapshot && stack_snapshot->Size() > 0) {
|
if (stack_snapshot && stack_snapshot->Size() > 0) {
|
||||||
scoped_ptr<MinidumpMemoryWriter> stack =
|
scoped_ptr<MinidumpMemoryWriter> stack =
|
||||||
MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
|
MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
|
||||||
SetStack(crashpad::move(stack));
|
SetStack(std::move(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context =
|
scoped_ptr<MinidumpContextWriter> context =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
|
MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
|
||||||
SetContext(crashpad::move(context));
|
SetContext(std::move(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||||
|
@ -70,14 +71,14 @@ const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
||||||
void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) {
|
void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
stack_ = crashpad::move(stack);
|
stack_ = std::move(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpThreadWriter::SetContext(
|
void MinidumpThreadWriter::SetContext(
|
||||||
scoped_ptr<MinidumpContextWriter> context) {
|
scoped_ptr<MinidumpContextWriter> context) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
context_ = crashpad::move(context);
|
context_ = std::move(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MinidumpThreadWriter::Freeze() {
|
bool MinidumpThreadWriter::Freeze() {
|
||||||
|
@ -149,7 +150,7 @@ void MinidumpThreadListWriter::InitializeFromSnapshot(
|
||||||
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
||||||
auto thread = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread = make_scoped_ptr(new MinidumpThreadWriter());
|
||||||
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
||||||
AddThread(crashpad::move(thread));
|
AddThread(std::move(thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do this in a separate loop to keep the thread stacks earlier in the dump,
|
// Do this in a separate loop to keep the thread stacks earlier in the dump,
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
|
@ -37,7 +38,6 @@
|
||||||
#include "snapshot/test/test_thread_snapshot.h"
|
#include "snapshot/test/test_thread_snapshot.h"
|
||||||
#include "test/gtest_death_check.h"
|
#include "test/gtest_death_check.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
@ -84,7 +84,7 @@ TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -161,10 +161,10 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
thread_writer->SetContext(crashpad::move(context_x86_writer));
|
thread_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
thread_list_writer->AddThread(std::move(thread_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -223,15 +223,15 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
||||||
thread_writer->SetStack(crashpad::move(memory_writer));
|
thread_writer->SetStack(std::move(memory_writer));
|
||||||
|
|
||||||
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
|
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
|
||||||
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
||||||
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
||||||
thread_writer->SetContext(crashpad::move(context_amd64_writer));
|
thread_writer->SetContext(std::move(context_amd64_writer));
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
thread_list_writer->AddThread(std::move(thread_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -301,13 +301,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||||
|
|
||||||
auto memory_writer_0 = make_scoped_ptr(
|
auto memory_writer_0 = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
||||||
thread_writer_0->SetStack(crashpad::move(memory_writer_0));
|
thread_writer_0->SetStack(std::move(memory_writer_0));
|
||||||
|
|
||||||
auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
||||||
thread_writer_0->SetContext(crashpad::move(context_x86_writer_0));
|
thread_writer_0->SetContext(std::move(context_x86_writer_0));
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer_0));
|
thread_list_writer->AddThread(std::move(thread_writer_0));
|
||||||
|
|
||||||
const uint32_t kThreadID1 = 2222222;
|
const uint32_t kThreadID1 = 2222222;
|
||||||
const uint32_t kSuspendCount1 = 222222;
|
const uint32_t kSuspendCount1 = 222222;
|
||||||
|
@ -328,13 +328,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||||
|
|
||||||
auto memory_writer_1 = make_scoped_ptr(
|
auto memory_writer_1 = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
||||||
thread_writer_1->SetStack(crashpad::move(memory_writer_1));
|
thread_writer_1->SetStack(std::move(memory_writer_1));
|
||||||
|
|
||||||
auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
||||||
thread_writer_1->SetContext(crashpad::move(context_x86_writer_1));
|
thread_writer_1->SetContext(std::move(context_x86_writer_1));
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer_1));
|
thread_list_writer->AddThread(std::move(thread_writer_1));
|
||||||
|
|
||||||
const uint32_t kThreadID2 = 3333333;
|
const uint32_t kThreadID2 = 3333333;
|
||||||
const uint32_t kSuspendCount2 = 333333;
|
const uint32_t kSuspendCount2 = 333333;
|
||||||
|
@ -355,16 +355,16 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||||
|
|
||||||
auto memory_writer_2 = make_scoped_ptr(
|
auto memory_writer_2 = make_scoped_ptr(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
||||||
thread_writer_2->SetStack(crashpad::move(memory_writer_2));
|
thread_writer_2->SetStack(std::move(memory_writer_2));
|
||||||
|
|
||||||
auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
||||||
thread_writer_2->SetContext(crashpad::move(context_x86_writer_2));
|
thread_writer_2->SetContext(std::move(context_x86_writer_2));
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer_2));
|
thread_list_writer->AddThread(std::move(thread_writer_2));
|
||||||
|
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -601,7 +601,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||||
expect_threads[index].Stack.StartOfMemoryRange);
|
expect_threads[index].Stack.StartOfMemoryRange);
|
||||||
memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize);
|
memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize);
|
||||||
memory_snapshot->SetValue(memory_values[index]);
|
memory_snapshot->SetValue(memory_values[index]);
|
||||||
thread_snapshot->SetStack(crashpad::move(memory_snapshot));
|
thread_snapshot->SetStack(std::move(memory_snapshot));
|
||||||
}
|
}
|
||||||
|
|
||||||
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
||||||
|
@ -611,7 +611,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||||
teb_snapshot->SetAddress(expect_threads[index].Teb);
|
teb_snapshot->SetAddress(expect_threads[index].Teb);
|
||||||
teb_snapshot->SetSize(kTebSize);
|
teb_snapshot->SetSize(kTebSize);
|
||||||
teb_snapshot->SetValue(static_cast<char>('t' + index));
|
teb_snapshot->SetValue(static_cast<char>('t' + index));
|
||||||
thread_snapshot->AddExtraMemory(crashpad::move(teb_snapshot));
|
thread_snapshot->AddExtraMemory(std::move(teb_snapshot));
|
||||||
|
|
||||||
thread_snapshots.push_back(thread_snapshot);
|
thread_snapshots.push_back(thread_snapshot);
|
||||||
}
|
}
|
||||||
|
@ -623,8 +623,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
||||||
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file));
|
||||||
|
@ -701,8 +701,8 @@ TEST(MinidumpThreadWriterDeathTest, NoContext) {
|
||||||
|
|
||||||
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
||||||
|
|
||||||
thread_list_writer->AddThread(crashpad::move(thread_writer));
|
thread_list_writer->AddThread(std::move(thread_writer));
|
||||||
minidump_file_writer.AddStream(crashpad::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file),
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
@ -32,7 +33,6 @@
|
||||||
#include "snapshot/process_snapshot.h"
|
#include "snapshot/process_snapshot.h"
|
||||||
#include "snapshot/system_snapshot.h"
|
#include "snapshot/system_snapshot.h"
|
||||||
#include "snapshot/thread_snapshot.h"
|
#include "snapshot/thread_snapshot.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
||||||
//! \param[in] system The system snapshot that System() will return. The
|
//! \param[in] system The system snapshot that System() will return. The
|
||||||
//! TestProcessSnapshot object takes ownership of \a system.
|
//! TestProcessSnapshot object takes ownership of \a system.
|
||||||
void SetSystem(scoped_ptr<SystemSnapshot> system) {
|
void SetSystem(scoped_ptr<SystemSnapshot> system) {
|
||||||
system_ = crashpad::move(system);
|
system_ = std::move(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Adds a thread snapshot to be returned by Threads().
|
//! \brief Adds a thread snapshot to be returned by Threads().
|
||||||
|
@ -97,7 +97,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
||||||
//! \param[in] exception The exception snapshot that Exception() will return.
|
//! \param[in] exception The exception snapshot that Exception() will return.
|
||||||
//! The TestProcessSnapshot object takes ownership of \a exception.
|
//! The TestProcessSnapshot object takes ownership of \a exception.
|
||||||
void SetException(scoped_ptr<ExceptionSnapshot> exception) {
|
void SetException(scoped_ptr<ExceptionSnapshot> exception) {
|
||||||
exception_ = crashpad::move(exception);
|
exception_ = std::move(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \brief Adds a memory map region snapshot to be returned by MemoryMap().
|
//! \brief Adds a memory map region snapshot to be returned by MemoryMap().
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
@ -24,7 +25,6 @@
|
||||||
#include "snapshot/cpu_context.h"
|
#include "snapshot/cpu_context.h"
|
||||||
#include "snapshot/memory_snapshot.h"
|
#include "snapshot/memory_snapshot.h"
|
||||||
#include "snapshot/thread_snapshot.h"
|
#include "snapshot/thread_snapshot.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -56,9 +56,7 @@ class TestThreadSnapshot final : public ThreadSnapshot {
|
||||||
//!
|
//!
|
||||||
//! \param[in] stack The memory region that Stack() will return. The
|
//! \param[in] stack The memory region that Stack() will return. The
|
||||||
//! TestThreadSnapshot object takes ownership of \a stack.
|
//! TestThreadSnapshot object takes ownership of \a stack.
|
||||||
void SetStack(scoped_ptr<MemorySnapshot> stack) {
|
void SetStack(scoped_ptr<MemorySnapshot> stack) { stack_ = std::move(stack); }
|
||||||
stack_ = crashpad::move(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; }
|
void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; }
|
||||||
void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; }
|
void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; }
|
||||||
|
|
|
@ -18,12 +18,12 @@
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/stdlib/string_number_conversion.h"
|
#include "util/stdlib/string_number_conversion.h"
|
||||||
#include "util/string/split_string.h"
|
#include "util/string/split_string.h"
|
||||||
#include "util/win/handle.h"
|
#include "util/win/handle.h"
|
||||||
|
@ -126,8 +126,8 @@ bool CreateInheritablePipe(ScopedFileHANDLE* read_handle,
|
||||||
if (!write_inheritable && !UnsetHandleInheritance(temp_write.get()))
|
if (!write_inheritable && !UnsetHandleInheritance(temp_write.get()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*read_handle = crashpad::move(temp_read);
|
*read_handle = std::move(temp_read);
|
||||||
*write_handle = crashpad::move(temp_write);
|
*write_handle = std::move(temp_write);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ scoped_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
||||||
return scoped_ptr<Handles>();
|
return scoped_ptr<Handles>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return crashpad::move(handles_for_parent);
|
return std::move(handles_for_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHandle WinChildProcess::ReadPipeHandle() const {
|
FileHandle WinChildProcess::ReadPipeHandle() const {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
@ -36,7 +37,6 @@
|
||||||
#include "tools/tool_support.h"
|
#include "tools/tool_support.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/file/file_reader.h"
|
#include "util/file/file_reader.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -553,7 +553,7 @@ int DatabaseUtilMain(int argc, char* argv[]) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
file_reader = crashpad::move(file_path_reader);
|
file_reader = std::move(file_path_reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
CrashReportDatabase::NewReport* new_report;
|
CrashReportDatabase::NewReport* new_report;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/mach_logging.h"
|
#include "base/mac/mach_logging.h"
|
||||||
|
@ -37,7 +38,6 @@
|
||||||
#include "util/mach/mach_message.h"
|
#include "util/mach/mach_message.h"
|
||||||
#include "util/mach/mach_message_server.h"
|
#include "util/mach/mach_message_server.h"
|
||||||
#include "util/misc/implicit_cast.h"
|
#include "util/misc/implicit_cast.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/random_string.h"
|
#include "util/misc/random_string.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -353,30 +353,30 @@ ChildPortHandshake::~ChildPortHandshake() {
|
||||||
|
|
||||||
base::ScopedFD ChildPortHandshake::ClientReadFD() {
|
base::ScopedFD ChildPortHandshake::ClientReadFD() {
|
||||||
DCHECK(client_read_fd_.is_valid());
|
DCHECK(client_read_fd_.is_valid());
|
||||||
return crashpad::move(client_read_fd_);
|
return std::move(client_read_fd_);
|
||||||
}
|
}
|
||||||
|
|
||||||
base::ScopedFD ChildPortHandshake::ServerWriteFD() {
|
base::ScopedFD ChildPortHandshake::ServerWriteFD() {
|
||||||
DCHECK(server_write_fd_.is_valid());
|
DCHECK(server_write_fd_.is_valid());
|
||||||
return crashpad::move(server_write_fd_);
|
return std::move(server_write_fd_);
|
||||||
}
|
}
|
||||||
|
|
||||||
mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) {
|
mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) {
|
||||||
client_read_fd_.reset();
|
client_read_fd_.reset();
|
||||||
return RunServerForFD(crashpad::move(server_write_fd_), port_right_type);
|
return RunServerForFD(std::move(server_write_fd_), port_right_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChildPortHandshake::RunClient(mach_port_t port,
|
bool ChildPortHandshake::RunClient(mach_port_t port,
|
||||||
mach_msg_type_name_t right_type) {
|
mach_msg_type_name_t right_type) {
|
||||||
server_write_fd_.reset();
|
server_write_fd_.reset();
|
||||||
return RunClientForFD(crashpad::move(client_read_fd_), port, right_type);
|
return RunClientForFD(std::move(client_read_fd_), port, right_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd,
|
mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd,
|
||||||
PortRightType port_right_type) {
|
PortRightType port_right_type) {
|
||||||
ChildPortHandshakeServer server;
|
ChildPortHandshakeServer server;
|
||||||
return server.RunServer(crashpad::move(server_write_fd), port_right_type);
|
return server.RunServer(std::move(server_write_fd), port_right_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -138,7 +138,7 @@ class ChildPortHandshakeTest;
|
||||||
//! // Obtain a receive right from the parent process.
|
//! // Obtain a receive right from the parent process.
|
||||||
//! base::mac::ScopedMachReceiveRight receive_right(
|
//! base::mac::ScopedMachReceiveRight receive_right(
|
||||||
//! ChildPortHandshake::RunServerForFD(
|
//! ChildPortHandshake::RunServerForFD(
|
||||||
//! crashpad::move(server_write_fd),
|
//! std::move(server_write_fd),
|
||||||
//! ChildPortHandshake::PortRightType::kReceiveRight));
|
//! ChildPortHandshake::PortRightType::kReceiveRight));
|
||||||
//! }
|
//! }
|
||||||
//! \endcode
|
//! \endcode
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
#include "util/net/http_transport.h"
|
#include "util/net/http_transport.h"
|
||||||
|
|
||||||
#include "util/stdlib/move.h"
|
#include <utility>
|
||||||
|
|
||||||
#include "util/net/http_body.h"
|
#include "util/net/http_body.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
@ -44,7 +45,7 @@ void HTTPTransport::SetHeader(const std::string& header,
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPTransport::SetBodyStream(scoped_ptr<HTTPBodyStream> stream) {
|
void HTTPTransport::SetBodyStream(scoped_ptr<HTTPBodyStream> stream) {
|
||||||
body_stream_ = crashpad::move(stream);
|
body_stream_ = std::move(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPTransport::SetTimeout(double timeout) {
|
void HTTPTransport::SetTimeout(double timeout) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include "test/multiprocess_exec.h"
|
#include "test/multiprocess_exec.h"
|
||||||
#include "test/paths.h"
|
#include "test/paths.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/random_string.h"
|
#include "util/misc/random_string.h"
|
||||||
#include "util/net/http_body.h"
|
#include "util/net/http_body.h"
|
||||||
#include "util/net/http_headers.h"
|
#include "util/net/http_headers.h"
|
||||||
|
@ -52,7 +52,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
||||||
RequestValidator request_validator)
|
RequestValidator request_validator)
|
||||||
: MultiprocessExec(),
|
: MultiprocessExec(),
|
||||||
headers_(headers),
|
headers_(headers),
|
||||||
body_stream_(crashpad::move(body_stream)),
|
body_stream_(std::move(body_stream)),
|
||||||
response_code_(http_response_code),
|
response_code_(http_response_code),
|
||||||
request_validator_(request_validator) {
|
request_validator_(request_validator) {
|
||||||
base::FilePath server_path = Paths::TestDataRoot().Append(
|
base::FilePath server_path = Paths::TestDataRoot().Append(
|
||||||
|
@ -103,7 +103,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
||||||
for (const auto& pair : headers_) {
|
for (const auto& pair : headers_) {
|
||||||
transport->SetHeader(pair.first, pair.second);
|
transport->SetHeader(pair.first, pair.second);
|
||||||
}
|
}
|
||||||
transport->SetBodyStream(crashpad::move(body_stream_));
|
transport->SetBodyStream(std::move(body_stream_));
|
||||||
|
|
||||||
std::string response_body;
|
std::string response_body;
|
||||||
bool success = transport->ExecuteSynchronously(&response_body);
|
bool success = transport->ExecuteSynchronously(&response_body);
|
||||||
|
@ -271,8 +271,8 @@ TEST(HTTPTransport, UnchunkedPlainText) {
|
||||||
headers[kContentType] = kTextPlain;
|
headers[kContentType] = kTextPlain;
|
||||||
headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody));
|
headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody));
|
||||||
|
|
||||||
HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200,
|
HTTPTransportTestFixture test(
|
||||||
&UnchunkedPlainText);
|
headers, std::move(body_stream), 200, &UnchunkedPlainText);
|
||||||
test.Run();
|
test.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,10 @@ void RunUpload33k(bool has_content_length) {
|
||||||
headers[kContentLength] =
|
headers[kContentLength] =
|
||||||
base::StringPrintf("%" PRIuS, request_string.size());
|
base::StringPrintf("%" PRIuS, request_string.size());
|
||||||
}
|
}
|
||||||
HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200,
|
HTTPTransportTestFixture test(
|
||||||
|
headers,
|
||||||
|
std::move(body_stream),
|
||||||
|
200,
|
||||||
[](HTTPTransportTestFixture* fixture, const std::string& request) {
|
[](HTTPTransportTestFixture* fixture, const std::string& request) {
|
||||||
size_t body_start = request.rfind("\r\n");
|
size_t body_start = request.rfind("\r\n");
|
||||||
EXPECT_EQ(33 * 1024u + 2, request.size() - body_start);
|
EXPECT_EQ(33 * 1024u + 2, request.size() - body_start);
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
// 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.
|
|
||||||
|
|
||||||
#ifndef CRASHPAD_UTIL_STDLIB_MOVE_H_
|
|
||||||
#define CRASHPAD_UTIL_STDLIB_MOVE_H_
|
|
||||||
|
|
||||||
#include "util/stdlib/cxx.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
|
||||||
|
|
||||||
#if CXX_LIBRARY_VERSION >= 2011
|
|
||||||
//! \brief A typedef for std::remove_reference until C++11 library support is
|
|
||||||
// always available.
|
|
||||||
template <typename T>
|
|
||||||
using remove_reference = std::remove_reference<T>;
|
|
||||||
#else
|
|
||||||
//! \brief A replacement for std::remove_reference until C++11 library support
|
|
||||||
// is always available.
|
|
||||||
template <class T>
|
|
||||||
struct remove_reference { using type = T; };
|
|
||||||
template <class T>
|
|
||||||
struct remove_reference<T&> { using type = T; };
|
|
||||||
#endif // CXX_LIBRARY_VERSION
|
|
||||||
|
|
||||||
#if CXX_LIBRARY_VERSION >= 2011
|
|
||||||
//! \brief A wrapper around std::move() until C++11 library support is
|
|
||||||
// always available.
|
|
||||||
template <typename T>
|
|
||||||
typename std::remove_reference<T>::type&& move(T&& t) {
|
|
||||||
return std::move(t);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
//! \brief A replacement for std::move() until C++11 library support is
|
|
||||||
// always available.
|
|
||||||
template <typename T>
|
|
||||||
typename remove_reference<T>::type&& move(T&& t) {
|
|
||||||
return static_cast<typename remove_reference<T>::type&&>(t);
|
|
||||||
}
|
|
||||||
#endif // CXX_LIBRARY_VERSION
|
|
||||||
|
|
||||||
} // namespace crashpad
|
|
||||||
|
|
||||||
#endif // CRASHPAD_UTIL_STDLIB_MOVE_H_
|
|
|
@ -132,7 +132,6 @@
|
||||||
'stdlib/aligned_allocator.h',
|
'stdlib/aligned_allocator.h',
|
||||||
'stdlib/cxx.h',
|
'stdlib/cxx.h',
|
||||||
'stdlib/map_insert.h',
|
'stdlib/map_insert.h',
|
||||||
'stdlib/move.h',
|
|
||||||
'stdlib/objc.h',
|
'stdlib/objc.h',
|
||||||
'stdlib/pointer_container.h',
|
'stdlib/pointer_container.h',
|
||||||
'stdlib/string_number_conversion.cc',
|
'stdlib/string_number_conversion.cc',
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
#include "base/rand_util.h"
|
#include "base/rand_util.h"
|
||||||
|
@ -26,7 +28,6 @@
|
||||||
#include "snapshot/crashpad_info_client_options.h"
|
#include "snapshot/crashpad_info_client_options.h"
|
||||||
#include "snapshot/win/process_snapshot_win.h"
|
#include "snapshot/win/process_snapshot_win.h"
|
||||||
#include "util/file/file_writer.h"
|
#include "util/file/file_writer.h"
|
||||||
#include "util/stdlib/move.h"
|
|
||||||
#include "util/misc/random_string.h"
|
#include "util/misc/random_string.h"
|
||||||
#include "util/misc/tri_state.h"
|
#include "util/misc/tri_state.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
|
@ -180,7 +181,7 @@ class ClientData {
|
||||||
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
||||||
non_crash_dump_completed_event_(
|
non_crash_dump_completed_event_(
|
||||||
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
CreateEvent(nullptr, false /* auto reset */, false, nullptr)),
|
||||||
process_(crashpad::move(process)),
|
process_(std::move(process)),
|
||||||
crash_exception_information_address_(
|
crash_exception_information_address_(
|
||||||
crash_exception_information_address),
|
crash_exception_information_address),
|
||||||
non_crash_exception_information_address_(
|
non_crash_exception_information_address_(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче