mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
Convert from scoped_ptr to std::unique_ptr
Follows https://codereview.chromium.org/1911823002/ but fixes includes that were messed up there. Change-Id: Ic4bad7d095ee6f5a1c9f8ca2d11ac9e67d55a626 Reviewed-on: https://chromium-review.googlesource.com/340497 Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
parent
d6d726a0eb
commit
a02ba24006
@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
|
|
||||||
@ -176,7 +176,8 @@ class CrashReportDatabase {
|
|||||||
//! logged.
|
//! logged.
|
||||||
//!
|
//!
|
||||||
//! \sa InitializeWithoutCreating
|
//! \sa InitializeWithoutCreating
|
||||||
static scoped_ptr<CrashReportDatabase> Initialize(const base::FilePath& path);
|
static std::unique_ptr<CrashReportDatabase> Initialize(
|
||||||
|
const base::FilePath& path);
|
||||||
|
|
||||||
//! \brief Opens an existing database of crash reports.
|
//! \brief Opens an existing database of crash reports.
|
||||||
//!
|
//!
|
||||||
@ -190,7 +191,7 @@ class CrashReportDatabase {
|
|||||||
//! logged.
|
//! logged.
|
||||||
//!
|
//!
|
||||||
//! \sa Initialize
|
//! \sa Initialize
|
||||||
static scoped_ptr<CrashReportDatabase> InitializeWithoutCreating(
|
static std::unique_ptr<CrashReportDatabase> InitializeWithoutCreating(
|
||||||
const base::FilePath& path);
|
const base::FilePath& path);
|
||||||
|
|
||||||
//! \brief Returns the Settings object for this database.
|
//! \brief Returns the Settings object for this database.
|
||||||
|
@ -273,7 +273,7 @@ CrashReportDatabase::OperationStatus
|
|||||||
CrashReportDatabaseMac::PrepareNewCrashReport(NewReport** out_report) {
|
CrashReportDatabaseMac::PrepareNewCrashReport(NewReport** out_report) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<NewReport> report(new NewReport());
|
std::unique_ptr<NewReport> report(new NewReport());
|
||||||
|
|
||||||
uuid_t uuid_gen;
|
uuid_t uuid_gen;
|
||||||
uuid_generate(uuid_gen);
|
uuid_generate(uuid_gen);
|
||||||
@ -312,7 +312,7 @@ CrashReportDatabaseMac::FinishedWritingCrashReport(NewReport* report,
|
|||||||
base::ScopedFD lock(report->handle);
|
base::ScopedFD lock(report->handle);
|
||||||
|
|
||||||
// Take ownership of the report.
|
// Take ownership of the report.
|
||||||
scoped_ptr<NewReport> scoped_report(report);
|
std::unique_ptr<NewReport> scoped_report(report);
|
||||||
|
|
||||||
// Get the report's UUID to return.
|
// Get the report's UUID to return.
|
||||||
std::string uuid_string;
|
std::string uuid_string;
|
||||||
@ -355,7 +355,7 @@ CrashReportDatabaseMac::ErrorWritingCrashReport(NewReport* report) {
|
|||||||
base::ScopedFD lock(report->handle);
|
base::ScopedFD lock(report->handle);
|
||||||
|
|
||||||
// Take ownership of the report.
|
// Take ownership of the report.
|
||||||
scoped_ptr<NewReport> scoped_report(report);
|
std::unique_ptr<NewReport> scoped_report(report);
|
||||||
|
|
||||||
// Remove the file that the report would have been written to had no error
|
// Remove the file that the report would have been written to had no error
|
||||||
// occurred.
|
// occurred.
|
||||||
@ -413,7 +413,7 @@ CrashReportDatabaseMac::GetReportForUploading(const UUID& uuid,
|
|||||||
if (report_path.empty())
|
if (report_path.empty())
|
||||||
return kReportNotFound;
|
return kReportNotFound;
|
||||||
|
|
||||||
scoped_ptr<UploadReport> upload_report(new UploadReport());
|
std::unique_ptr<UploadReport> upload_report(new UploadReport());
|
||||||
upload_report->file_path = report_path;
|
upload_report->file_path = report_path;
|
||||||
|
|
||||||
base::ScopedFD lock(ObtainReportLock(report_path));
|
base::ScopedFD lock(ObtainReportLock(report_path));
|
||||||
@ -441,7 +441,7 @@ CrashReportDatabaseMac::RecordUploadAttempt(const Report* report,
|
|||||||
if (report_path.empty())
|
if (report_path.empty())
|
||||||
return kReportNotFound;
|
return kReportNotFound;
|
||||||
|
|
||||||
scoped_ptr<const UploadReport> upload_report(
|
std::unique_ptr<const UploadReport> upload_report(
|
||||||
static_cast<const UploadReport*>(report));
|
static_cast<const UploadReport*>(report));
|
||||||
|
|
||||||
base::ScopedFD lock(upload_report->lock_fd);
|
base::ScopedFD lock(upload_report->lock_fd);
|
||||||
@ -647,27 +647,28 @@ std::string CrashReportDatabaseMac::XattrName(const base::StringPiece& name) {
|
|||||||
return XattrNameInternal(name, xattr_new_names_);
|
return XattrNameInternal(name, xattr_new_names_);
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<CrashReportDatabase> InitializeInternal(const base::FilePath& path,
|
std::unique_ptr<CrashReportDatabase> InitializeInternal(
|
||||||
bool may_create) {
|
const base::FilePath& path,
|
||||||
scoped_ptr<CrashReportDatabaseMac> database_mac(
|
bool may_create) {
|
||||||
|
std::unique_ptr<CrashReportDatabaseMac> database_mac(
|
||||||
new CrashReportDatabaseMac(path));
|
new CrashReportDatabaseMac(path));
|
||||||
if (!database_mac->Initialize(may_create))
|
if (!database_mac->Initialize(may_create))
|
||||||
database_mac.reset();
|
database_mac.reset();
|
||||||
|
|
||||||
return scoped_ptr<CrashReportDatabase>(database_mac.release());
|
return std::unique_ptr<CrashReportDatabase>(database_mac.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
|
std::unique_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
return InitializeInternal(path, true);
|
return InitializeInternal(path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<CrashReportDatabase> CrashReportDatabase::InitializeWithoutCreating(
|
std::unique_ptr<CrashReportDatabase>
|
||||||
const base::FilePath& path) {
|
CrashReportDatabase::InitializeWithoutCreating(const base::FilePath& path) {
|
||||||
return InitializeInternal(path, false);
|
return InitializeInternal(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ class CrashReportDatabaseTest : public testing::Test {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ScopedTempDir temp_dir_;
|
ScopedTempDir temp_dir_;
|
||||||
scoped_ptr<CrashReportDatabase> db_;
|
std::unique_ptr<CrashReportDatabase> db_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CrashReportDatabaseTest);
|
DISALLOW_COPY_AND_ASSIGN(CrashReportDatabaseTest);
|
||||||
};
|
};
|
||||||
|
@ -191,8 +191,8 @@ class Metadata {
|
|||||||
//! handle.
|
//! handle.
|
||||||
~Metadata();
|
~Metadata();
|
||||||
|
|
||||||
static scoped_ptr<Metadata> Create(const base::FilePath& metadata_file,
|
static std::unique_ptr<Metadata> Create(const base::FilePath& metadata_file,
|
||||||
const base::FilePath& report_dir);
|
const base::FilePath& report_dir);
|
||||||
|
|
||||||
//! \brief Adds a new report to the set.
|
//! \brief Adds a new report to the set.
|
||||||
//!
|
//!
|
||||||
@ -282,8 +282,8 @@ Metadata::~Metadata() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<Metadata> Metadata::Create(const base::FilePath& metadata_file,
|
std::unique_ptr<Metadata> Metadata::Create(const base::FilePath& metadata_file,
|
||||||
const base::FilePath& report_dir) {
|
const base::FilePath& report_dir) {
|
||||||
// It is important that dwShareMode be non-zero so that concurrent access to
|
// It is important that dwShareMode be non-zero so that concurrent access to
|
||||||
// this file results in a successful open. This allows us to get to LockFileEx
|
// this file results in a successful open. This allows us to get to LockFileEx
|
||||||
// which then blocks to guard access.
|
// which then blocks to guard access.
|
||||||
@ -295,7 +295,7 @@ scoped_ptr<Metadata> Metadata::Create(const base::FilePath& metadata_file,
|
|||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
nullptr);
|
nullptr);
|
||||||
if (handle == kInvalidFileHandle)
|
if (handle == kInvalidFileHandle)
|
||||||
return scoped_ptr<Metadata>();
|
return std::unique_ptr<Metadata>();
|
||||||
// Not actually async, LockFileEx requires the Offset fields.
|
// Not actually async, LockFileEx requires the Offset fields.
|
||||||
OVERLAPPED overlapped = {0};
|
OVERLAPPED overlapped = {0};
|
||||||
if (!LockFileEx(handle,
|
if (!LockFileEx(handle,
|
||||||
@ -305,10 +305,10 @@ scoped_ptr<Metadata> Metadata::Create(const base::FilePath& metadata_file,
|
|||||||
MAXDWORD,
|
MAXDWORD,
|
||||||
&overlapped)) {
|
&overlapped)) {
|
||||||
PLOG(ERROR) << "LockFileEx";
|
PLOG(ERROR) << "LockFileEx";
|
||||||
return scoped_ptr<Metadata>();
|
return std::unique_ptr<Metadata>();
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(new Metadata(handle, report_dir));
|
std::unique_ptr<Metadata> metadata(new Metadata(handle, report_dir));
|
||||||
// If Read() fails, for whatever reason (corruption, etc.) metadata will not
|
// If Read() fails, for whatever reason (corruption, etc.) metadata will not
|
||||||
// have been modified and will be in a clean empty state. We continue on and
|
// have been modified and will be in a clean empty state. We continue on and
|
||||||
// return an empty database to hopefully recover. This means that existing
|
// return an empty database to hopefully recover. This means that existing
|
||||||
@ -579,7 +579,7 @@ class CrashReportDatabaseWin : public CrashReportDatabase {
|
|||||||
OperationStatus DeleteReport(const UUID& uuid) override;
|
OperationStatus DeleteReport(const UUID& uuid) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<Metadata> AcquireMetadata();
|
std::unique_ptr<Metadata> AcquireMetadata();
|
||||||
|
|
||||||
base::FilePath base_dir_;
|
base::FilePath base_dir_;
|
||||||
Settings settings_;
|
Settings settings_;
|
||||||
@ -629,7 +629,7 @@ OperationStatus CrashReportDatabaseWin::PrepareNewCrashReport(
|
|||||||
NewReport** report) {
|
NewReport** report) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<NewReport> new_report(new NewReport());
|
std::unique_ptr<NewReport> new_report(new NewReport());
|
||||||
if (!new_report->uuid.InitializeWithNew())
|
if (!new_report->uuid.InitializeWithNew())
|
||||||
return kFileSystemError;
|
return kFileSystemError;
|
||||||
new_report->path = base_dir_.Append(kReportsDirectory)
|
new_report->path = base_dir_.Append(kReportsDirectory)
|
||||||
@ -651,11 +651,11 @@ OperationStatus CrashReportDatabaseWin::FinishedWritingCrashReport(
|
|||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
// Take ownership of the report.
|
// Take ownership of the report.
|
||||||
scoped_ptr<NewReport> scoped_report(report);
|
std::unique_ptr<NewReport> scoped_report(report);
|
||||||
// Take ownership of the file handle.
|
// Take ownership of the file handle.
|
||||||
ScopedFileHandle handle(report->handle);
|
ScopedFileHandle handle(report->handle);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
metadata->AddNewRecord(ReportDisk(scoped_report->uuid,
|
metadata->AddNewRecord(ReportDisk(scoped_report->uuid,
|
||||||
@ -671,7 +671,7 @@ OperationStatus CrashReportDatabaseWin::ErrorWritingCrashReport(
|
|||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
// Take ownership of the report.
|
// Take ownership of the report.
|
||||||
scoped_ptr<NewReport> scoped_report(report);
|
std::unique_ptr<NewReport> scoped_report(report);
|
||||||
|
|
||||||
// Close the outstanding handle.
|
// Close the outstanding handle.
|
||||||
LoggingCloseFile(report->handle);
|
LoggingCloseFile(report->handle);
|
||||||
@ -691,7 +691,7 @@ OperationStatus CrashReportDatabaseWin::LookUpCrashReport(const UUID& uuid,
|
|||||||
Report* report) {
|
Report* report) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
// Find and return a copy of the matching report.
|
// Find and return a copy of the matching report.
|
||||||
@ -706,7 +706,7 @@ OperationStatus CrashReportDatabaseWin::GetPendingReports(
|
|||||||
std::vector<Report>* reports) {
|
std::vector<Report>* reports) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
return metadata ? metadata->FindReports(ReportState::kPending, reports)
|
return metadata ? metadata->FindReports(ReportState::kPending, reports)
|
||||||
: kDatabaseError;
|
: kDatabaseError;
|
||||||
}
|
}
|
||||||
@ -715,7 +715,7 @@ OperationStatus CrashReportDatabaseWin::GetCompletedReports(
|
|||||||
std::vector<Report>* reports) {
|
std::vector<Report>* reports) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
return metadata ? metadata->FindReports(ReportState::kCompleted, reports)
|
return metadata ? metadata->FindReports(ReportState::kCompleted, reports)
|
||||||
: kDatabaseError;
|
: kDatabaseError;
|
||||||
}
|
}
|
||||||
@ -725,7 +725,7 @@ OperationStatus CrashReportDatabaseWin::GetReportForUploading(
|
|||||||
const Report** report) {
|
const Report** report) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
// TODO(scottmg): After returning this report to the client, there is no way
|
// TODO(scottmg): After returning this report to the client, there is no way
|
||||||
@ -757,8 +757,8 @@ OperationStatus CrashReportDatabaseWin::RecordUploadAttempt(
|
|||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
// Take ownership, allocated in GetReportForUploading.
|
// Take ownership, allocated in GetReportForUploading.
|
||||||
scoped_ptr<const Report> upload_report(report);
|
std::unique_ptr<const Report> upload_report(report);
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
ReportDisk* report_disk;
|
ReportDisk* report_disk;
|
||||||
@ -785,7 +785,7 @@ OperationStatus CrashReportDatabaseWin::RecordUploadAttempt(
|
|||||||
OperationStatus CrashReportDatabaseWin::DeleteReport(const UUID& uuid) {
|
OperationStatus CrashReportDatabaseWin::DeleteReport(const UUID& uuid) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
|
|
||||||
@ -805,7 +805,7 @@ OperationStatus CrashReportDatabaseWin::DeleteReport(const UUID& uuid) {
|
|||||||
OperationStatus CrashReportDatabaseWin::SkipReportUpload(const UUID& uuid) {
|
OperationStatus CrashReportDatabaseWin::SkipReportUpload(const UUID& uuid) {
|
||||||
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
INITIALIZATION_STATE_DCHECK_VALID(initialized_);
|
||||||
|
|
||||||
scoped_ptr<Metadata> metadata(AcquireMetadata());
|
std::unique_ptr<Metadata> metadata(AcquireMetadata());
|
||||||
if (!metadata)
|
if (!metadata)
|
||||||
return kDatabaseError;
|
return kDatabaseError;
|
||||||
ReportDisk* report_disk;
|
ReportDisk* report_disk;
|
||||||
@ -816,31 +816,32 @@ OperationStatus CrashReportDatabaseWin::SkipReportUpload(const UUID& uuid) {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<Metadata> CrashReportDatabaseWin::AcquireMetadata() {
|
std::unique_ptr<Metadata> CrashReportDatabaseWin::AcquireMetadata() {
|
||||||
base::FilePath metadata_file = base_dir_.Append(kMetadataFileName);
|
base::FilePath metadata_file = base_dir_.Append(kMetadataFileName);
|
||||||
return Metadata::Create(metadata_file, base_dir_.Append(kReportsDirectory));
|
return Metadata::Create(metadata_file, base_dir_.Append(kReportsDirectory));
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<CrashReportDatabase> InitializeInternal(
|
std::unique_ptr<CrashReportDatabase> InitializeInternal(
|
||||||
const base::FilePath& path, bool may_create) {
|
const base::FilePath& path,
|
||||||
scoped_ptr<CrashReportDatabaseWin> database_win(
|
bool may_create) {
|
||||||
|
std::unique_ptr<CrashReportDatabaseWin> database_win(
|
||||||
new CrashReportDatabaseWin(path));
|
new CrashReportDatabaseWin(path));
|
||||||
return database_win->Initialize(may_create)
|
return database_win->Initialize(may_create)
|
||||||
? std::move(database_win)
|
? std::move(database_win)
|
||||||
: scoped_ptr<CrashReportDatabaseWin>();
|
: std::unique_ptr<CrashReportDatabaseWin>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
|
std::unique_ptr<CrashReportDatabase> CrashReportDatabase::Initialize(
|
||||||
const base::FilePath& path) {
|
const base::FilePath& path) {
|
||||||
return InitializeInternal(path, true);
|
return InitializeInternal(path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<CrashReportDatabase> CrashReportDatabase::InitializeWithoutCreating(
|
std::unique_ptr<CrashReportDatabase>
|
||||||
const base::FilePath& path) {
|
CrashReportDatabase::InitializeWithoutCreating(const base::FilePath& path) {
|
||||||
return InitializeInternal(path, false);
|
return InitializeInternal(path, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
@ -146,7 +147,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface {
|
|||||||
DCHECK_EQ(right_type,
|
DCHECK_EQ(right_type,
|
||||||
implicit_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND));
|
implicit_cast<mach_msg_type_name_t>(MACH_MSG_TYPE_PORT_SEND));
|
||||||
|
|
||||||
scoped_ptr<HandlerStarter> handler_restarter;
|
std::unique_ptr<HandlerStarter> handler_restarter;
|
||||||
if (restartable) {
|
if (restartable) {
|
||||||
handler_restarter.reset(new HandlerStarter());
|
handler_restarter.reset(new HandlerStarter());
|
||||||
if (!handler_restarter->notify_port_.is_valid()) {
|
if (!handler_restarter->notify_port_.is_valid()) {
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/atomicops.h"
|
#include "base/atomicops.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/scoped_generic.h"
|
#include "base/scoped_generic.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
@ -255,7 +256,7 @@ bool CrashpadClient::StartHandler(
|
|||||||
startup_info.StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
startup_info.StartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
|
||||||
|
|
||||||
std::vector<HANDLE> handle_list;
|
std::vector<HANDLE> handle_list;
|
||||||
scoped_ptr<uint8_t[]> proc_thread_attribute_list_storage;
|
std::unique_ptr<uint8_t[]> proc_thread_attribute_list_storage;
|
||||||
ScopedProcThreadAttributeList proc_thread_attribute_list_owner;
|
ScopedProcThreadAttributeList proc_thread_attribute_list_owner;
|
||||||
|
|
||||||
static const auto initialize_proc_thread_attribute_list =
|
static const auto initialize_proc_thread_attribute_list =
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -66,11 +67,13 @@ void PruneCrashReportDatabase(CrashReportDatabase* database,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<PruneCondition> PruneCondition::GetDefault() {
|
std::unique_ptr<PruneCondition> PruneCondition::GetDefault() {
|
||||||
// DatabaseSizePruneCondition must be the LHS so that it is always evaluated,
|
// DatabaseSizePruneCondition must be the LHS so that it is always evaluated,
|
||||||
// due to the short-circuting behavior of BinaryPruneCondition.
|
// due to the short-circuting behavior of BinaryPruneCondition.
|
||||||
return make_scoped_ptr(new BinaryPruneCondition(BinaryPruneCondition::OR,
|
return base::WrapUnique(
|
||||||
new DatabaseSizePruneCondition(1024 * 128), new AgePruneCondition(365)));
|
new BinaryPruneCondition(BinaryPruneCondition::OR,
|
||||||
|
new DatabaseSizePruneCondition(1024 * 128),
|
||||||
|
new AgePruneCondition(365)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const time_t kSecondsInDay = 60 * 60 * 24;
|
static const time_t kSecondsInDay = 60 * 60 * 24;
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "client/crash_report_database.h"
|
#include "client/crash_report_database.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -39,7 +40,7 @@ class PruneCondition;
|
|||||||
void PruneCrashReportDatabase(CrashReportDatabase* database,
|
void PruneCrashReportDatabase(CrashReportDatabase* database,
|
||||||
PruneCondition* condition);
|
PruneCondition* condition);
|
||||||
|
|
||||||
scoped_ptr<PruneCondition> GetDefaultDatabasePruneCondition();
|
std::unique_ptr<PruneCondition> GetDefaultDatabasePruneCondition();
|
||||||
|
|
||||||
//! \brief An abstract base class for evaluating crash reports for deletion.
|
//! \brief An abstract base class for evaluating crash reports for deletion.
|
||||||
//!
|
//!
|
||||||
@ -56,7 +57,7 @@ class PruneCondition {
|
|||||||
//! of 128 MB.
|
//! of 128 MB.
|
||||||
//!
|
//!
|
||||||
//! \return A PruneCondition for use with PruneCrashReportDatabase().
|
//! \return A PruneCondition for use with PruneCrashReportDatabase().
|
||||||
static scoped_ptr<PruneCondition> GetDefault();
|
static std::unique_ptr<PruneCondition> GetDefault();
|
||||||
|
|
||||||
virtual ~PruneCondition() {}
|
virtual ~PruneCondition() {}
|
||||||
|
|
||||||
@ -136,8 +137,8 @@ class BinaryPruneCondition final : public PruneCondition {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const Operator op_;
|
const Operator op_;
|
||||||
scoped_ptr<PruneCondition> lhs_;
|
std::unique_ptr<PruneCondition> lhs_;
|
||||||
scoped_ptr<PruneCondition> rhs_;
|
std::unique_ptr<PruneCondition> rhs_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BinaryPruneCondition);
|
DISALLOW_COPY_AND_ASSIGN(BinaryPruneCondition);
|
||||||
};
|
};
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "client/settings.h"
|
#include "client/settings.h"
|
||||||
@ -316,7 +316,7 @@ CrashReportUploadThread::UploadResult CrashReportUploadThread::UploadReport(
|
|||||||
report->file_path,
|
report->file_path,
|
||||||
"application/octet-stream");
|
"application/octet-stream");
|
||||||
|
|
||||||
scoped_ptr<HTTPTransport> http_transport(HTTPTransport::Create());
|
std::unique_ptr<HTTPTransport> http_transport(HTTPTransport::Create());
|
||||||
http_transport->SetURL(url_);
|
http_transport->SetURL(url_);
|
||||||
HTTPHeaders::value_type content_type =
|
HTTPHeaders::value_type content_type =
|
||||||
http_multipart_builder.GetContentType();
|
http_multipart_builder.GetContentType();
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
#ifndef CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_
|
#ifndef CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_
|
||||||
#define CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_
|
#define CRASHPAD_HANDLER_CRASH_REPORT_UPLOAD_THREAD_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "client/crash_report_database.h"
|
#include "client/crash_report_database.h"
|
||||||
#include "util/thread/worker_thread.h"
|
#include "util/thread/worker_thread.h"
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@ -26,7 +27,6 @@
|
|||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/files/scoped_file.h"
|
#include "base/files/scoped_file.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/scoped_generic.h"
|
#include "base/scoped_generic.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@ -386,7 +386,7 @@ int HandlerMain(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
#endif // OS_MACOSX
|
#endif // OS_MACOSX
|
||||||
|
|
||||||
scoped_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize(
|
std::unique_ptr<CrashReportDatabase> database(CrashReportDatabase::Initialize(
|
||||||
base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType(
|
base::FilePath(ToolSupport::CommandLineArgumentToFilePathStringType(
|
||||||
options.database))));
|
options.database))));
|
||||||
if (!database) {
|
if (!database) {
|
||||||
|
@ -22,7 +22,7 @@ namespace crashpad {
|
|||||||
|
|
||||||
PruneCrashReportThread::PruneCrashReportThread(
|
PruneCrashReportThread::PruneCrashReportThread(
|
||||||
CrashReportDatabase* database,
|
CrashReportDatabase* database,
|
||||||
scoped_ptr<PruneCondition> condition)
|
std::unique_ptr<PruneCondition> condition)
|
||||||
: thread_(60 * 60 * 24, this),
|
: thread_(60 * 60 * 24, this),
|
||||||
condition_(std::move(condition)),
|
condition_(std::move(condition)),
|
||||||
database_(database) {}
|
database_(database) {}
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
#ifndef CRASHPAD_HANDLER_PRUNE_CRASH_REPORTS_THREAD_H_
|
#ifndef CRASHPAD_HANDLER_PRUNE_CRASH_REPORTS_THREAD_H_
|
||||||
#define CRASHPAD_HANDLER_PRUNE_CRASH_REPORTS_THREAD_H_
|
#define CRASHPAD_HANDLER_PRUNE_CRASH_REPORTS_THREAD_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/thread/worker_thread.h"
|
#include "util/thread/worker_thread.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -38,7 +39,7 @@ class PruneCrashReportThread : public WorkerThread::Delegate {
|
|||||||
//! \param[in] condition The condition used to evaluate crash reports for
|
//! \param[in] condition The condition used to evaluate crash reports for
|
||||||
//! pruning.
|
//! pruning.
|
||||||
PruneCrashReportThread(CrashReportDatabase* database,
|
PruneCrashReportThread(CrashReportDatabase* database,
|
||||||
scoped_ptr<PruneCondition> condition);
|
std::unique_ptr<PruneCondition> condition);
|
||||||
~PruneCrashReportThread();
|
~PruneCrashReportThread();
|
||||||
|
|
||||||
//! \brief Starts a dedicated pruning thread.
|
//! \brief Starts a dedicated pruning thread.
|
||||||
@ -64,7 +65,7 @@ class PruneCrashReportThread : public WorkerThread::Delegate {
|
|||||||
void DoWork(const WorkerThread* thread) override;
|
void DoWork(const WorkerThread* thread) override;
|
||||||
|
|
||||||
WorkerThread thread_;
|
WorkerThread thread_;
|
||||||
scoped_ptr<PruneCondition> condition_;
|
std::unique_ptr<PruneCondition> condition_;
|
||||||
CrashReportDatabase* database_; // weak
|
CrashReportDatabase* database_; // weak
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(PruneCrashReportThread);
|
DISALLOW_COPY_AND_ASSIGN(PruneCrashReportThread);
|
||||||
|
@ -28,9 +28,9 @@ MinidumpContextWriter::~MinidumpContextWriter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<MinidumpContextWriter> MinidumpContextWriter::CreateFromSnapshot(
|
std::unique_ptr<MinidumpContextWriter>
|
||||||
const CPUContext* context_snapshot) {
|
MinidumpContextWriter::CreateFromSnapshot(const CPUContext* context_snapshot) {
|
||||||
scoped_ptr<MinidumpContextWriter> context;
|
std::unique_ptr<MinidumpContextWriter> context;
|
||||||
|
|
||||||
switch (context_snapshot->architecture) {
|
switch (context_snapshot->architecture) {
|
||||||
case kCPUArchitectureX86: {
|
case kCPUArchitectureX86: {
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_context.h"
|
#include "minidump/minidump_context.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ class MinidumpContextWriter : public internal::MinidumpWritable {
|
|||||||
//! context_snapshot. The returned object is initialized using the source
|
//! context_snapshot. The returned object is initialized using the source
|
||||||
//! data in \a context_snapshot. If \a context_snapshot is an unknown CPU
|
//! data in \a context_snapshot. If \a context_snapshot is an unknown CPU
|
||||||
//! type’s context, logs a message and returns `nullptr`.
|
//! type’s context, logs a message and returns `nullptr`.
|
||||||
static scoped_ptr<MinidumpContextWriter> CreateFromSnapshot(
|
static std::unique_ptr<MinidumpContextWriter> CreateFromSnapshot(
|
||||||
const CPUContext* context_snapshot);
|
const CPUContext* context_snapshot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -116,7 +116,7 @@ TEST(MinidumpContextWriter, CreateFromSnapshot_X86) {
|
|||||||
context_snapshot.x86 = &context_snapshot_x86;
|
context_snapshot.x86 = &context_snapshot_x86;
|
||||||
InitializeCPUContextX86(&context_snapshot, kSeed);
|
InitializeCPUContextX86(&context_snapshot, kSeed);
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context_writer =
|
std::unique_ptr<MinidumpContextWriter> context_writer =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(&context_snapshot);
|
MinidumpContextWriter::CreateFromSnapshot(&context_snapshot);
|
||||||
ASSERT_TRUE(context_writer);
|
ASSERT_TRUE(context_writer);
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ TEST(MinidumpContextWriter, CreateFromSnapshot_AMD64) {
|
|||||||
context_snapshot.x86_64 = &context_snapshot_x86_64;
|
context_snapshot.x86_64 = &context_snapshot_x86_64;
|
||||||
InitializeCPUContextX86_64(&context_snapshot, kSeed);
|
InitializeCPUContextX86_64(&context_snapshot, kSeed);
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context_writer =
|
std::unique_ptr<MinidumpContextWriter> context_writer =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(&context_snapshot);
|
MinidumpContextWriter::CreateFromSnapshot(&context_snapshot);
|
||||||
ASSERT_TRUE(context_writer);
|
ASSERT_TRUE(context_writer);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
@ -49,14 +50,14 @@ void MinidumpCrashpadInfoWriter::InitializeFromSnapshot(
|
|||||||
SetClientID(client_id);
|
SetClientID(client_id);
|
||||||
|
|
||||||
auto simple_annotations =
|
auto simple_annotations =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
simple_annotations->InitializeFromMap(
|
simple_annotations->InitializeFromMap(
|
||||||
process_snapshot->AnnotationsSimpleMap());
|
process_snapshot->AnnotationsSimpleMap());
|
||||||
if (simple_annotations->IsUseful()) {
|
if (simple_annotations->IsUseful()) {
|
||||||
SetSimpleAnnotations(std::move(simple_annotations));
|
SetSimpleAnnotations(std::move(simple_annotations));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
auto modules = base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
modules->InitializeFromSnapshot(process_snapshot->Modules());
|
||||||
|
|
||||||
if (modules->IsUseful()) {
|
if (modules->IsUseful()) {
|
||||||
@ -77,14 +78,14 @@ void MinidumpCrashpadInfoWriter::SetClientID(const UUID& client_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpCrashpadInfoWriter::SetSimpleAnnotations(
|
void MinidumpCrashpadInfoWriter::SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
simple_annotations_ = std::move(simple_annotations);
|
simple_annotations_ = std::move(simple_annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpCrashpadInfoWriter::SetModuleList(
|
void MinidumpCrashpadInfoWriter::SetModuleList(
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) {
|
std::unique_ptr<MinidumpModuleCrashpadInfoListWriter> module_list) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
module_list_ = std::move(module_list);
|
module_list_ = std::move(module_list);
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
@ -69,7 +69,7 @@ class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetSimpleAnnotations(
|
void SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations);
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations);
|
||||||
|
|
||||||
//! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the
|
//! \brief Arranges for MinidumpCrashpadInfo::module_list to point to the
|
||||||
//! MinidumpModuleCrashpadInfoList object to be written by \a
|
//! MinidumpModuleCrashpadInfoList object to be written by \a
|
||||||
@ -80,7 +80,7 @@ class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetModuleList(
|
void SetModuleList(
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list);
|
std::unique_ptr<MinidumpModuleCrashpadInfoListWriter> module_list);
|
||||||
|
|
||||||
//! \brief Determines whether the object is useful.
|
//! \brief Determines whether the object is useful.
|
||||||
//!
|
//!
|
||||||
@ -103,8 +103,8 @@ class MinidumpCrashpadInfoWriter final : public internal::MinidumpStreamWriter {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MinidumpCrashpadInfo crashpad_info_;
|
MinidumpCrashpadInfo crashpad_info_;
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_;
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_;
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoListWriter> module_list_;
|
std::unique_ptr<MinidumpModuleCrashpadInfoListWriter> module_list_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpCrashpadInfoWriter);
|
||||||
};
|
};
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
@ -65,7 +66,8 @@ void GetCrashpadInfoStream(
|
|||||||
|
|
||||||
TEST(MinidumpCrashpadInfoWriter, Empty) {
|
TEST(MinidumpCrashpadInfoWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info_writer =
|
||||||
|
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
EXPECT_FALSE(crashpad_info_writer->IsUseful());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
minidump_file_writer.AddStream(std::move(crashpad_info_writer));
|
||||||
@ -89,7 +91,8 @@ TEST(MinidumpCrashpadInfoWriter, Empty) {
|
|||||||
|
|
||||||
TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info_writer =
|
||||||
|
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
|
|
||||||
UUID report_id;
|
UUID report_id;
|
||||||
ASSERT_TRUE(
|
ASSERT_TRUE(
|
||||||
@ -124,7 +127,8 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) {
|
|||||||
|
|
||||||
TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info_writer =
|
||||||
|
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
|
|
||||||
const char kKey[] =
|
const char kKey[] =
|
||||||
"a thing that provides a means of gaining access to or understanding "
|
"a thing that provides a means of gaining access to or understanding "
|
||||||
@ -133,9 +137,9 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) {
|
|||||||
"the numerical amount denoted by an algebraic term; a magnitude, "
|
"the numerical amount denoted by an algebraic term; a magnitude, "
|
||||||
"quantity, or number";
|
"quantity, or number";
|
||||||
auto simple_string_dictionary_writer =
|
auto simple_string_dictionary_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
auto simple_string_dictionary_entry_writer =
|
auto simple_string_dictionary_entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(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(
|
||||||
std::move(simple_string_dictionary_entry_writer));
|
std::move(simple_string_dictionary_entry_writer));
|
||||||
@ -173,11 +177,12 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) {
|
|||||||
const uint32_t kMinidumpModuleListIndex = 3;
|
const uint32_t kMinidumpModuleListIndex = 3;
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info_writer =
|
||||||
|
base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
module_list_writer->AddModule(std::move(module_writer),
|
module_list_writer->AddModule(std::move(module_writer),
|
||||||
kMinidumpModuleListIndex);
|
kMinidumpModuleListIndex);
|
||||||
crashpad_info_writer->SetModuleList(std::move(module_list_writer));
|
crashpad_info_writer->SetModuleList(std::move(module_list_writer));
|
||||||
@ -231,12 +236,12 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) {
|
|||||||
|
|
||||||
// Test with a useless module, one that doesn’t carry anything that would
|
// Test with a useless module, one that doesn’t carry anything that would
|
||||||
// require MinidumpCrashpadInfo or any child object.
|
// require MinidumpCrashpadInfo or any child object.
|
||||||
auto process_snapshot = make_scoped_ptr(new TestProcessSnapshot());
|
auto process_snapshot = base::WrapUnique(new TestProcessSnapshot());
|
||||||
|
|
||||||
auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot());
|
auto module_snapshot = base::WrapUnique(new TestModuleSnapshot());
|
||||||
process_snapshot->AddModule(std::move(module_snapshot));
|
process_snapshot->AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
auto info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto info_writer = base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
info_writer->InitializeFromSnapshot(process_snapshot.get());
|
||||||
EXPECT_FALSE(info_writer->IsUseful());
|
EXPECT_FALSE(info_writer->IsUseful());
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ void MinidumpExceptionWriter::InitializeFromSnapshot(
|
|||||||
SetExceptionAddress(exception_snapshot->ExceptionAddress());
|
SetExceptionAddress(exception_snapshot->ExceptionAddress());
|
||||||
SetExceptionInformation(exception_snapshot->Codes());
|
SetExceptionInformation(exception_snapshot->Codes());
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context =
|
std::unique_ptr<MinidumpContextWriter> context =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context());
|
MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context());
|
||||||
SetContext(std::move(context));
|
SetContext(std::move(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpExceptionWriter::SetContext(
|
void MinidumpExceptionWriter::SetContext(
|
||||||
scoped_ptr<MinidumpContextWriter> context) {
|
std::unique_ptr<MinidumpContextWriter> context) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
context_ = std::move(context);
|
context_ = std::move(context);
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_thread_id_map.h"
|
#include "minidump/minidump_thread_id_map.h"
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class MinidumpExceptionWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//! overall tree of internal::MinidumpWritable objects.
|
//! overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetContext(scoped_ptr<MinidumpContextWriter> context);
|
void SetContext(std::unique_ptr<MinidumpContextWriter> context);
|
||||||
|
|
||||||
//! \brief Sets MINIDUMP_EXCEPTION_STREAM::ThreadId.
|
//! \brief Sets MINIDUMP_EXCEPTION_STREAM::ThreadId.
|
||||||
void SetThreadID(uint32_t thread_id) { exception_.ThreadId = thread_id; }
|
void SetThreadID(uint32_t thread_id) { exception_.ThreadId = thread_id; }
|
||||||
@ -116,7 +116,7 @@ class MinidumpExceptionWriter final : public internal::MinidumpStreamWriter {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MINIDUMP_EXCEPTION_STREAM exception_;
|
MINIDUMP_EXCEPTION_STREAM exception_;
|
||||||
scoped_ptr<MinidumpContextWriter> context_;
|
std::unique_ptr<MinidumpContextWriter> context_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpExceptionWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpExceptionWriter);
|
||||||
};
|
};
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_context.h"
|
#include "minidump/minidump_context.h"
|
||||||
#include "minidump/minidump_context_writer.h"
|
#include "minidump/minidump_context_writer.h"
|
||||||
@ -93,11 +94,11 @@ void ExpectExceptionStream(const MINIDUMP_EXCEPTION_STREAM* expected,
|
|||||||
|
|
||||||
TEST(MinidumpExceptionWriter, Minimal) {
|
TEST(MinidumpExceptionWriter, Minimal) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||||
|
|
||||||
const uint32_t kSeed = 100;
|
const uint32_t kSeed = 100;
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
exception_writer->SetContext(std::move(context_x86_writer));
|
exception_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
@ -125,7 +126,7 @@ TEST(MinidumpExceptionWriter, Minimal) {
|
|||||||
|
|
||||||
TEST(MinidumpExceptionWriter, Standard) {
|
TEST(MinidumpExceptionWriter, Standard) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||||
|
|
||||||
const uint32_t kSeed = 200;
|
const uint32_t kSeed = 200;
|
||||||
const uint32_t kThreadID = 1;
|
const uint32_t kThreadID = 1;
|
||||||
@ -137,7 +138,7 @@ TEST(MinidumpExceptionWriter, Standard) {
|
|||||||
const uint64_t kExceptionInformation1 = 7;
|
const uint64_t kExceptionInformation1 = 7;
|
||||||
const uint64_t kExceptionInformation2 = 7;
|
const uint64_t kExceptionInformation2 = 7;
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
exception_writer->SetContext(std::move(context_x86_writer));
|
exception_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
@ -229,7 +230,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
|||||||
MinidumpThreadIDMap thread_id_map;
|
MinidumpThreadIDMap thread_id_map;
|
||||||
thread_id_map[kThreadID] = expect_exception.ThreadId;
|
thread_id_map[kThreadID] = expect_exception.ThreadId;
|
||||||
|
|
||||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||||
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
@ -253,7 +254,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) {
|
|||||||
|
|
||||||
TEST(MinidumpExceptionWriterDeathTest, NoContext) {
|
TEST(MinidumpExceptionWriterDeathTest, NoContext) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter());
|
auto exception_writer = base::WrapUnique(new MinidumpExceptionWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(exception_writer));
|
minidump_file_writer.AddStream(std::move(exception_writer));
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
#include "minidump/minidump_handle_writer.h"
|
#include "minidump/minidump_handle_writer.h"
|
||||||
@ -71,16 +72,16 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
|||||||
SetTimestamp(snapshot_time.tv_sec);
|
SetTimestamp(snapshot_time.tv_sec);
|
||||||
|
|
||||||
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 = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
system_info->InitializeFromSnapshot(system_snapshot);
|
system_info->InitializeFromSnapshot(system_snapshot);
|
||||||
AddStream(std::move(system_info));
|
AddStream(std::move(system_info));
|
||||||
|
|
||||||
auto misc_info = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
misc_info->InitializeFromSnapshot(process_snapshot);
|
misc_info->InitializeFromSnapshot(process_snapshot);
|
||||||
AddStream(std::move(misc_info));
|
AddStream(std::move(misc_info));
|
||||||
|
|
||||||
auto memory_list = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
auto thread_list = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
thread_list->SetMemoryListWriter(memory_list.get());
|
thread_list->SetMemoryListWriter(memory_list.get());
|
||||||
MinidumpThreadIDMap thread_id_map;
|
MinidumpThreadIDMap thread_id_map;
|
||||||
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
thread_list->InitializeFromSnapshot(process_snapshot->Threads(),
|
||||||
@ -89,18 +90,18 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
|||||||
|
|
||||||
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 = base::WrapUnique(new MinidumpExceptionWriter());
|
||||||
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
exception->InitializeFromSnapshot(exception_snapshot, thread_id_map);
|
||||||
AddStream(std::move(exception));
|
AddStream(std::move(exception));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto module_list = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
module_list->InitializeFromSnapshot(process_snapshot->Modules());
|
||||||
AddStream(std::move(module_list));
|
AddStream(std::move(module_list));
|
||||||
|
|
||||||
for (const auto& module : process_snapshot->Modules()) {
|
for (const auto& module : process_snapshot->Modules()) {
|
||||||
for (const UserMinidumpStream* stream : module->CustomMinidumpStreams()) {
|
for (const UserMinidumpStream* stream : module->CustomMinidumpStreams()) {
|
||||||
auto user_stream = make_scoped_ptr(new MinidumpUserStreamWriter());
|
auto user_stream = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||||
user_stream->InitializeFromSnapshot(stream);
|
user_stream->InitializeFromSnapshot(stream);
|
||||||
AddStream(std::move(user_stream));
|
AddStream(std::move(user_stream));
|
||||||
}
|
}
|
||||||
@ -109,12 +110,12 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
|||||||
auto unloaded_modules = process_snapshot->UnloadedModules();
|
auto unloaded_modules = process_snapshot->UnloadedModules();
|
||||||
if (!unloaded_modules.empty()) {
|
if (!unloaded_modules.empty()) {
|
||||||
auto unloaded_module_list =
|
auto unloaded_module_list =
|
||||||
make_scoped_ptr(new MinidumpUnloadedModuleListWriter());
|
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||||
unloaded_module_list->InitializeFromSnapshot(unloaded_modules);
|
unloaded_module_list->InitializeFromSnapshot(unloaded_modules);
|
||||||
AddStream(std::move(unloaded_module_list));
|
AddStream(std::move(unloaded_module_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter());
|
auto crashpad_info = base::WrapUnique(new MinidumpCrashpadInfoWriter());
|
||||||
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
crashpad_info->InitializeFromSnapshot(process_snapshot);
|
||||||
|
|
||||||
// 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
|
||||||
@ -126,14 +127,15 @@ void MinidumpFileWriter::InitializeFromSnapshot(
|
|||||||
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
std::vector<const MemoryMapRegionSnapshot*> memory_map_snapshot =
|
||||||
process_snapshot->MemoryMap();
|
process_snapshot->MemoryMap();
|
||||||
if (!memory_map_snapshot.empty()) {
|
if (!memory_map_snapshot.empty()) {
|
||||||
auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
auto memory_info_list =
|
||||||
|
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||||
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
memory_info_list->InitializeFromSnapshot(memory_map_snapshot);
|
||||||
AddStream(std::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 = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||||
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
handle_data_writer->InitializeFromSnapshot(handles_snapshot);
|
||||||
AddStream(std::move(handle_data_writer));
|
AddStream(std::move(handle_data_writer));
|
||||||
}
|
}
|
||||||
@ -152,7 +154,7 @@ void MinidumpFileWriter::SetTimestamp(time_t timestamp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpFileWriter::AddStream(
|
void MinidumpFileWriter::AddStream(
|
||||||
scoped_ptr<internal::MinidumpStreamWriter> stream) {
|
std::unique_ptr<internal::MinidumpStreamWriter> stream) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
MinidumpStreamType stream_type = stream->StreamType();
|
MinidumpStreamType stream_type = stream->StreamType();
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -88,7 +88,7 @@ class MinidumpFileWriter final : public internal::MinidumpWritable {
|
|||||||
//! streams with the same stream type.
|
//! streams with the same stream type.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddStream(scoped_ptr<internal::MinidumpStreamWriter> stream);
|
void AddStream(std::unique_ptr<internal::MinidumpStreamWriter> stream);
|
||||||
|
|
||||||
// MinidumpWritable:
|
// MinidumpWritable:
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -96,7 +97,7 @@ TEST(MinidumpFileWriter, OneStream) {
|
|||||||
const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
|
const MinidumpStreamType kStreamType = static_cast<MinidumpStreamType>(0x4d);
|
||||||
const uint8_t kStreamValue = 0x5a;
|
const uint8_t kStreamValue = 0x5a;
|
||||||
auto stream =
|
auto stream =
|
||||||
make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
base::WrapUnique(new TestStream(kStreamType, kStreamSize, kStreamValue));
|
||||||
minidump_file.AddStream(std::move(stream));
|
minidump_file.AddStream(std::move(stream));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
@ -134,7 +135,7 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
|||||||
const size_t kStream0Size = 5;
|
const size_t kStream0Size = 5;
|
||||||
const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d);
|
const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x6d);
|
||||||
const uint8_t kStream0Value = 0x5a;
|
const uint8_t kStream0Value = 0x5a;
|
||||||
auto stream0 = make_scoped_ptr(
|
auto stream0 = base::WrapUnique(
|
||||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||||
minidump_file.AddStream(std::move(stream0));
|
minidump_file.AddStream(std::move(stream0));
|
||||||
|
|
||||||
@ -144,14 +145,14 @@ TEST(MinidumpFileWriter, ThreeStreams) {
|
|||||||
const size_t kStream1Size = 3;
|
const size_t kStream1Size = 3;
|
||||||
const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
|
const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
|
||||||
const uint8_t kStream1Value = 0xa5;
|
const uint8_t kStream1Value = 0xa5;
|
||||||
auto stream1 = make_scoped_ptr(
|
auto stream1 = base::WrapUnique(
|
||||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||||
minidump_file.AddStream(std::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 = base::WrapUnique(
|
||||||
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
new TestStream(kStream2Type, kStream2Size, kStream2Value));
|
||||||
minidump_file.AddStream(std::move(stream2));
|
minidump_file.AddStream(std::move(stream2));
|
||||||
|
|
||||||
@ -219,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 = base::WrapUnique(new TestStream(kStreamType, kStreamSize, 0));
|
||||||
minidump_file.AddStream(std::move(stream));
|
minidump_file.AddStream(std::move(stream));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
@ -249,12 +250,12 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) {
|
|||||||
TestProcessSnapshot process_snapshot;
|
TestProcessSnapshot process_snapshot;
|
||||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||||
|
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = base::WrapUnique(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(std::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
auto peb_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||||
const uint64_t kPebAddress = 0x07f90000;
|
const uint64_t kPebAddress = 0x07f90000;
|
||||||
peb_snapshot->SetAddress(kPebAddress);
|
peb_snapshot->SetAddress(kPebAddress);
|
||||||
const size_t kPebSize = 0x280;
|
const size_t kPebSize = 0x280;
|
||||||
@ -313,16 +314,16 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
|||||||
TestProcessSnapshot process_snapshot;
|
TestProcessSnapshot process_snapshot;
|
||||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||||
|
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = base::WrapUnique(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(std::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
auto thread_snapshot = base::WrapUnique(new TestThreadSnapshot());
|
||||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||||
process_snapshot.AddThread(std::move(thread_snapshot));
|
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||||
|
|
||||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
auto exception_snapshot = base::WrapUnique(new TestExceptionSnapshot());
|
||||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||||
process_snapshot.SetException(std::move(exception_snapshot));
|
process_snapshot.SetException(std::move(exception_snapshot));
|
||||||
|
|
||||||
@ -330,7 +331,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) {
|
|||||||
// 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 = base::WrapUnique(new TestModuleSnapshot());
|
||||||
process_snapshot.AddModule(std::move(module_snapshot));
|
process_snapshot.AddModule(std::move(module_snapshot));
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
@ -377,22 +378,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) {
|
|||||||
TestProcessSnapshot process_snapshot;
|
TestProcessSnapshot process_snapshot;
|
||||||
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
process_snapshot.SetSnapshotTime(kSnapshotTimeval);
|
||||||
|
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = base::WrapUnique(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(std::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot());
|
auto thread_snapshot = base::WrapUnique(new TestThreadSnapshot());
|
||||||
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5);
|
||||||
process_snapshot.AddThread(std::move(thread_snapshot));
|
process_snapshot.AddThread(std::move(thread_snapshot));
|
||||||
|
|
||||||
auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot());
|
auto exception_snapshot = base::WrapUnique(new TestExceptionSnapshot());
|
||||||
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11);
|
||||||
process_snapshot.SetException(std::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 = base::WrapUnique(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(std::move(module_snapshot));
|
process_snapshot.AddModule(std::move(module_snapshot));
|
||||||
@ -444,7 +445,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
|||||||
const size_t kStream0Size = 5;
|
const size_t kStream0Size = 5;
|
||||||
const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d);
|
const MinidumpStreamType kStream0Type = static_cast<MinidumpStreamType>(0x4d);
|
||||||
const uint8_t kStream0Value = 0x5a;
|
const uint8_t kStream0Value = 0x5a;
|
||||||
auto stream0 = make_scoped_ptr(
|
auto stream0 = base::WrapUnique(
|
||||||
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
new TestStream(kStream0Type, kStream0Size, kStream0Value));
|
||||||
minidump_file.AddStream(std::move(stream0));
|
minidump_file.AddStream(std::move(stream0));
|
||||||
|
|
||||||
@ -452,7 +453,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) {
|
|||||||
const size_t kStream1Size = 3;
|
const size_t kStream1Size = 3;
|
||||||
const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
|
const MinidumpStreamType kStream1Type = static_cast<MinidumpStreamType>(0x4d);
|
||||||
const uint8_t kStream1Value = 0xa5;
|
const uint8_t kStream1Value = 0xa5;
|
||||||
auto stream1 = make_scoped_ptr(
|
auto stream1 = base::WrapUnique(
|
||||||
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
new TestStream(kStream1Type, kStream1Size, kStream1Value));
|
||||||
ASSERT_DEATH_CHECK(minidump_file.AddStream(std::move(stream1)),
|
ASSERT_DEATH_CHECK(minidump_file.AddStream(std::move(stream1)),
|
||||||
"already present");
|
"already present");
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
@ -57,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 = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||||
minidump_file_writer.AddStream(std::move(handle_data_writer));
|
minidump_file_writer.AddStream(std::move(handle_data_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
@ -76,7 +77,7 @@ TEST(MinidumpHandleDataWriter, Empty) {
|
|||||||
|
|
||||||
TEST(MinidumpHandleDataWriter, OneHandle) {
|
TEST(MinidumpHandleDataWriter, OneHandle) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||||
|
|
||||||
HandleSnapshot handle_snapshot;
|
HandleSnapshot handle_snapshot;
|
||||||
handle_snapshot.handle = 0x1234;
|
handle_snapshot.handle = 0x1234;
|
||||||
@ -125,7 +126,7 @@ TEST(MinidumpHandleDataWriter, OneHandle) {
|
|||||||
|
|
||||||
TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
TEST(MinidumpHandleDataWriter, RepeatedTypeName) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter());
|
auto handle_data_writer = base::WrapUnique(new MinidumpHandleDataWriter());
|
||||||
|
|
||||||
HandleSnapshot handle_snapshot;
|
HandleSnapshot handle_snapshot;
|
||||||
handle_snapshot.handle = 0x1234;
|
handle_snapshot.handle = 0x1234;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||||
@ -58,7 +59,7 @@ void GetMemoryInfoListStream(
|
|||||||
TEST(MinidumpMemoryInfoWriter, Empty) {
|
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());
|
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||||
minidump_file_writer.AddStream(std::move(memory_info_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_info_list_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
@ -78,9 +79,9 @@ TEST(MinidumpMemoryInfoWriter, Empty) {
|
|||||||
TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
TEST(MinidumpMemoryInfoWriter, OneRegion) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_info_list_writer =
|
auto memory_info_list_writer =
|
||||||
make_scoped_ptr(new MinidumpMemoryInfoListWriter());
|
base::WrapUnique(new MinidumpMemoryInfoListWriter());
|
||||||
|
|
||||||
auto memory_map_region = make_scoped_ptr(new TestMemoryMapRegionSnapshot());
|
auto memory_map_region = base::WrapUnique(new TestMemoryMapRegionSnapshot());
|
||||||
|
|
||||||
MINIDUMP_MEMORY_INFO mmi = {0};
|
MINIDUMP_MEMORY_INFO mmi = {0};
|
||||||
mmi.BaseAddress = 0x12340000;
|
mmi.BaseAddress = 0x12340000;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
@ -81,9 +82,9 @@ class SnapshotMinidumpMemoryWriter final : public MinidumpMemoryWriter,
|
|||||||
MinidumpMemoryWriter::~MinidumpMemoryWriter() {
|
MinidumpMemoryWriter::~MinidumpMemoryWriter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<MinidumpMemoryWriter> MinidumpMemoryWriter::CreateFromSnapshot(
|
std::unique_ptr<MinidumpMemoryWriter> MinidumpMemoryWriter::CreateFromSnapshot(
|
||||||
const MemorySnapshot* memory_snapshot) {
|
const MemorySnapshot* memory_snapshot) {
|
||||||
return make_scoped_ptr(new SnapshotMinidumpMemoryWriter(memory_snapshot));
|
return base::WrapUnique(new SnapshotMinidumpMemoryWriter(memory_snapshot));
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIDUMP_MEMORY_DESCRIPTOR*
|
const MINIDUMP_MEMORY_DESCRIPTOR*
|
||||||
@ -177,14 +178,14 @@ void MinidumpMemoryListWriter::AddFromSnapshot(
|
|||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
for (const MemorySnapshot* memory_snapshot : memory_snapshots) {
|
for (const MemorySnapshot* memory_snapshot : memory_snapshots) {
|
||||||
scoped_ptr<MinidumpMemoryWriter> memory =
|
std::unique_ptr<MinidumpMemoryWriter> memory =
|
||||||
MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot);
|
MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot);
|
||||||
AddMemory(std::move(memory));
|
AddMemory(std::move(memory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpMemoryListWriter::AddMemory(
|
void MinidumpMemoryListWriter::AddMemory(
|
||||||
scoped_ptr<MinidumpMemoryWriter> memory_writer) {
|
std::unique_ptr<MinidumpMemoryWriter> memory_writer) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
AddExtraMemory(memory_writer.get());
|
AddExtraMemory(memory_writer.get());
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
@ -52,7 +52,7 @@ class MinidumpMemoryWriter : public internal::MinidumpWritable {
|
|||||||
//!
|
//!
|
||||||
//! \return An object of a MinidumpMemoryWriter subclass initialized using the
|
//! \return An object of a MinidumpMemoryWriter subclass initialized using the
|
||||||
//! source data in \a memory_snapshot.
|
//! source data in \a memory_snapshot.
|
||||||
static scoped_ptr<MinidumpMemoryWriter> CreateFromSnapshot(
|
static std::unique_ptr<MinidumpMemoryWriter> CreateFromSnapshot(
|
||||||
const MemorySnapshot* memory_snapshot);
|
const MemorySnapshot* memory_snapshot);
|
||||||
|
|
||||||
//! \brief Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this
|
//! \brief Returns a MINIDUMP_MEMORY_DESCRIPTOR referencing the data that this
|
||||||
@ -152,7 +152,7 @@ class MinidumpMemoryListWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//! the overall tree of internal::MinidumpWritable objects.
|
//! the overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddMemory(scoped_ptr<MinidumpMemoryWriter> memory_writer);
|
void AddMemory(std::unique_ptr<MinidumpMemoryWriter> memory_writer);
|
||||||
|
|
||||||
//! \brief Adds a MinidumpMemoryWriter that’s a child of another
|
//! \brief Adds a MinidumpMemoryWriter that’s a child of another
|
||||||
//! internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST.
|
//! internal::MinidumpWritable object to the MINIDUMP_MEMORY_LIST.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
@ -76,7 +77,7 @@ void GetMemoryListStream(const std::string& file_contents,
|
|||||||
|
|
||||||
TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
minidump_file_writer.AddStream(std::move(memory_list_writer));
|
||||||
|
|
||||||
@ -96,13 +97,13 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) {
|
|||||||
|
|
||||||
TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
|
|
||||||
const uint64_t kBaseAddress = 0xfedcba9876543210;
|
const uint64_t kBaseAddress = 0xfedcba9876543210;
|
||||||
const uint64_t kSize = 0x1000;
|
const uint64_t kSize = 0x1000;
|
||||||
const uint8_t kValue = 'm';
|
const uint8_t kValue = 'm';
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue));
|
||||||
memory_list_writer->AddMemory(std::move(memory_writer));
|
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ TEST(MinidumpMemoryWriter, OneMemoryRegion) {
|
|||||||
|
|
||||||
TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
|
|
||||||
const uint64_t kBaseAddress0 = 0xc0ffee;
|
const uint64_t kBaseAddress0 = 0xc0ffee;
|
||||||
const uint64_t kSize0 = 0x0100;
|
const uint64_t kSize0 = 0x0100;
|
||||||
@ -140,10 +141,10 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) {
|
|||||||
const uint64_t kSize1 = 0x0200;
|
const uint64_t kSize1 = 0x0200;
|
||||||
const uint8_t kValue1 = '!';
|
const uint8_t kValue1 = '!';
|
||||||
|
|
||||||
auto memory_writer_0 = make_scoped_ptr(
|
auto memory_writer_0 = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0));
|
||||||
memory_list_writer->AddMemory(std::move(memory_writer_0));
|
memory_list_writer->AddMemory(std::move(memory_writer_0));
|
||||||
auto memory_writer_1 = make_scoped_ptr(
|
auto memory_writer_1 = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||||
memory_list_writer->AddMemory(std::move(memory_writer_1));
|
memory_list_writer->AddMemory(std::move(memory_writer_1));
|
||||||
|
|
||||||
@ -241,9 +242,9 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
|||||||
const size_t kSize0 = 0x0400;
|
const size_t kSize0 = 0x0400;
|
||||||
const uint8_t kValue0 = '1';
|
const uint8_t kValue0 = '1';
|
||||||
auto test_memory_stream =
|
auto test_memory_stream =
|
||||||
make_scoped_ptr(new TestMemoryStream(kBaseAddress0, kSize0, kValue0));
|
base::WrapUnique(new TestMemoryStream(kBaseAddress0, kSize0, kValue0));
|
||||||
|
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
memory_list_writer->AddExtraMemory(test_memory_stream->memory());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(test_memory_stream));
|
minidump_file_writer.AddStream(std::move(test_memory_stream));
|
||||||
@ -252,7 +253,7 @@ TEST(MinidumpMemoryWriter, ExtraMemory) {
|
|||||||
const size_t kSize1 = 0x0400;
|
const size_t kSize1 = 0x0400;
|
||||||
const uint8_t kValue1 = 'm';
|
const uint8_t kValue1 = 'm';
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1));
|
||||||
memory_list_writer->AddMemory(std::move(memory_writer));
|
memory_list_writer->AddMemory(std::move(memory_writer));
|
||||||
|
|
||||||
@ -330,7 +331,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) {
|
|||||||
memory_snapshots.push_back(memory_snapshot);
|
memory_snapshots.push_back(memory_snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
memory_list_writer->AddFromSnapshot(memory_snapshots);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
|
@ -16,12 +16,13 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -165,7 +166,7 @@ void ExpectMiscInfoEqual<MINIDUMP_MISC_INFO_4>(
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, Empty) {
|
TEST(MinidumpMiscInfoWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
minidump_file_writer.AddStream(std::move(misc_info_writer));
|
||||||
|
|
||||||
@ -182,7 +183,7 @@ TEST(MinidumpMiscInfoWriter, Empty) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProcessId) {
|
TEST(MinidumpMiscInfoWriter, ProcessId) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProcessId = 12345;
|
const uint32_t kProcessId = 12345;
|
||||||
|
|
||||||
@ -205,7 +206,7 @@ TEST(MinidumpMiscInfoWriter, ProcessId) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const time_t kProcessCreateTime = 0x15252f00;
|
const time_t kProcessCreateTime = 0x15252f00;
|
||||||
const uint32_t kProcessUserTime = 10;
|
const uint32_t kProcessUserTime = 10;
|
||||||
@ -233,7 +234,7 @@ TEST(MinidumpMiscInfoWriter, ProcessTimes) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProcessorMaxMhz = 2800;
|
const uint32_t kProcessorMaxMhz = 2800;
|
||||||
const uint32_t kProcessorCurrentMhz = 2300;
|
const uint32_t kProcessorCurrentMhz = 2300;
|
||||||
@ -268,7 +269,7 @@ TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProcessIntegrityLevel = 0x2000;
|
const uint32_t kProcessIntegrityLevel = 0x2000;
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProcessExecuteFlags = 0x13579bdf;
|
const uint32_t kProcessExecuteFlags = 0x13579bdf;
|
||||||
|
|
||||||
@ -314,7 +315,7 @@ TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProtectedProcess = 1;
|
const uint32_t kProtectedProcess = 1;
|
||||||
|
|
||||||
@ -337,7 +338,7 @@ TEST(MinidumpMiscInfoWriter, ProtectedProcess) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, TimeZone) {
|
TEST(MinidumpMiscInfoWriter, TimeZone) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kTimeZoneId = 2;
|
const uint32_t kTimeZoneId = 2;
|
||||||
const int32_t kBias = 300;
|
const int32_t kBias = 300;
|
||||||
@ -394,7 +395,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
|||||||
// to the widths of their fields.
|
// to the widths of their fields.
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kTimeZoneId = 2;
|
const uint32_t kTimeZoneId = 2;
|
||||||
const int32_t kBias = 300;
|
const int32_t kBias = 300;
|
||||||
@ -452,7 +453,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, BuildStrings) {
|
TEST(MinidumpMiscInfoWriter, BuildStrings) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const char kBuildString[] = "build string";
|
const char kBuildString[] = "build string";
|
||||||
const char kDebugBuildString[] = "debug build string";
|
const char kDebugBuildString[] = "debug build string";
|
||||||
@ -487,7 +488,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
|||||||
// widths of their fields.
|
// widths of their fields.
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
MINIDUMP_MISC_INFO_4 tmp;
|
MINIDUMP_MISC_INFO_4 tmp;
|
||||||
ALLOW_UNUSED_LOCAL(tmp);
|
ALLOW_UNUSED_LOCAL(tmp);
|
||||||
@ -521,7 +522,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) {
|
|||||||
|
|
||||||
TEST(MinidumpMiscInfoWriter, Everything) {
|
TEST(MinidumpMiscInfoWriter, Everything) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
|
|
||||||
const uint32_t kProcessId = 12345;
|
const uint32_t kProcessId = 12345;
|
||||||
const time_t kProcessCreateTime = 0x15252f00;
|
const time_t kProcessCreateTime = 0x15252f00;
|
||||||
@ -686,7 +687,7 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
|||||||
process_snapshot.SetProcessStartTime(kStartTime);
|
process_snapshot.SetProcessStartTime(kStartTime);
|
||||||
process_snapshot.SetProcessCPUTimes(kUserCPUTime, kSystemCPUTime);
|
process_snapshot.SetProcessCPUTimes(kUserCPUTime, kSystemCPUTime);
|
||||||
|
|
||||||
auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot());
|
auto system_snapshot = base::WrapUnique(new TestSystemSnapshot());
|
||||||
const uint64_t kHzPerMHz = static_cast<uint64_t>(1E6);
|
const uint64_t kHzPerMHz = static_cast<uint64_t>(1E6);
|
||||||
system_snapshot->SetCPUFrequency(
|
system_snapshot->SetCPUFrequency(
|
||||||
expect_misc_info.ProcessorCurrentMhz * kHzPerMHz,
|
expect_misc_info.ProcessorCurrentMhz * kHzPerMHz,
|
||||||
@ -702,7 +703,7 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) {
|
|||||||
|
|
||||||
process_snapshot.SetSystem(std::move(system_snapshot));
|
process_snapshot.SetSystem(std::move(system_snapshot));
|
||||||
|
|
||||||
auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter());
|
auto misc_info_writer = base::WrapUnique(new MinidumpMiscInfoWriter());
|
||||||
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
misc_info_writer->InitializeFromSnapshot(&process_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
@ -41,14 +42,14 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
|||||||
DCHECK(!list_annotations_);
|
DCHECK(!list_annotations_);
|
||||||
DCHECK(!simple_annotations_);
|
DCHECK(!simple_annotations_);
|
||||||
|
|
||||||
auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
auto list_annotations = base::WrapUnique(new MinidumpUTF8StringListWriter());
|
||||||
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector());
|
||||||
if (list_annotations->IsUseful()) {
|
if (list_annotations->IsUseful()) {
|
||||||
SetListAnnotations(std::move(list_annotations));
|
SetListAnnotations(std::move(list_annotations));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto simple_annotations =
|
auto simple_annotations =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
simple_annotations->InitializeFromMap(
|
simple_annotations->InitializeFromMap(
|
||||||
module_snapshot->AnnotationsSimpleMap());
|
module_snapshot->AnnotationsSimpleMap());
|
||||||
if (simple_annotations->IsUseful()) {
|
if (simple_annotations->IsUseful()) {
|
||||||
@ -57,14 +58,14 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleCrashpadInfoWriter::SetListAnnotations(
|
void MinidumpModuleCrashpadInfoWriter::SetListAnnotations(
|
||||||
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations) {
|
std::unique_ptr<MinidumpUTF8StringListWriter> list_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
list_annotations_ = std::move(list_annotations);
|
list_annotations_ = std::move(list_annotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
|
void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
simple_annotations_ = std::move(simple_annotations);
|
simple_annotations_ = std::move(simple_annotations);
|
||||||
@ -141,7 +142,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot(
|
|||||||
for (size_t index = 0; index < count; ++index) {
|
for (size_t index = 0; index < count; ++index) {
|
||||||
const ModuleSnapshot* module_snapshot = module_snapshots[index];
|
const ModuleSnapshot* module_snapshot = module_snapshots[index];
|
||||||
|
|
||||||
auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
module->InitializeFromSnapshot(module_snapshot);
|
module->InitializeFromSnapshot(module_snapshot);
|
||||||
if (module->IsUseful()) {
|
if (module->IsUseful()) {
|
||||||
AddModule(std::move(module), index);
|
AddModule(std::move(module), index);
|
||||||
@ -150,7 +151,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleCrashpadInfoListWriter::AddModule(
|
void MinidumpModuleCrashpadInfoListWriter::AddModule(
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
|
std::unique_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
|
||||||
size_t minidump_module_list_index) {
|
size_t minidump_module_list_index) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
DCHECK_EQ(module_crashpad_infos_.size(), module_crashpad_info_links_.size());
|
DCHECK_EQ(module_crashpad_infos_.size(), module_crashpad_info_links_.size());
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_string_writer.h"
|
#include "minidump/minidump_string_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -62,7 +62,7 @@ class MinidumpModuleCrashpadInfoWriter final
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetListAnnotations(
|
void SetListAnnotations(
|
||||||
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations);
|
std::unique_ptr<MinidumpUTF8StringListWriter> list_annotations);
|
||||||
|
|
||||||
//! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to
|
//! \brief Arranges for MinidumpModuleCrashpadInfo::simple_annotations to
|
||||||
//! point to the MinidumpSimpleStringDictionaryWriter object to be written
|
//! point to the MinidumpSimpleStringDictionaryWriter object to be written
|
||||||
@ -73,7 +73,7 @@ class MinidumpModuleCrashpadInfoWriter final
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetSimpleAnnotations(
|
void SetSimpleAnnotations(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations);
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations);
|
||||||
|
|
||||||
//! \brief Determines whether the object is useful.
|
//! \brief Determines whether the object is useful.
|
||||||
//!
|
//!
|
||||||
@ -93,8 +93,8 @@ class MinidumpModuleCrashpadInfoWriter final
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MinidumpModuleCrashpadInfo module_;
|
MinidumpModuleCrashpadInfo module_;
|
||||||
scoped_ptr<MinidumpUTF8StringListWriter> list_annotations_;
|
std::unique_ptr<MinidumpUTF8StringListWriter> list_annotations_;
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_;
|
std::unique_ptr<MinidumpSimpleStringDictionaryWriter> simple_annotations_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleCrashpadInfoWriter);
|
||||||
};
|
};
|
||||||
@ -134,7 +134,7 @@ class MinidumpModuleCrashpadInfoListWriter final
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddModule(
|
void AddModule(
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
|
std::unique_ptr<MinidumpModuleCrashpadInfoWriter> module_crashpad_info,
|
||||||
size_t minidump_module_list_index);
|
size_t minidump_module_list_index);
|
||||||
|
|
||||||
//! \brief Determines whether the object is useful.
|
//! \brief Determines whether the object is useful.
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#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"
|
||||||
@ -60,7 +61,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyList) {
|
|||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
EXPECT_FALSE(module_list_writer->IsUseful());
|
EXPECT_FALSE(module_list_writer->IsUseful());
|
||||||
|
|
||||||
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
EXPECT_TRUE(module_list_writer->WriteEverything(&string_file));
|
||||||
@ -76,8 +77,8 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) {
|
|||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(module_writer->IsUseful());
|
EXPECT_FALSE(module_writer->IsUseful());
|
||||||
module_list_writer->AddModule(std::move(module_writer), 0);
|
module_list_writer->AddModule(std::move(module_writer), 0);
|
||||||
|
|
||||||
@ -116,16 +117,17 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) {
|
|||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
|
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter());
|
auto string_list_writer =
|
||||||
|
base::WrapUnique(new MinidumpUTF8StringListWriter());
|
||||||
string_list_writer->InitializeFromVector(vector);
|
string_list_writer->InitializeFromVector(vector);
|
||||||
module_writer->SetListAnnotations(std::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());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
auto simple_string_dictionary_entry_writer =
|
auto simple_string_dictionary_entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(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(
|
||||||
std::move(simple_string_dictionary_entry_writer));
|
std::move(simple_string_dictionary_entry_writer));
|
||||||
@ -205,14 +207,14 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
|||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
|
|
||||||
auto module_writer_0 =
|
auto module_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
auto simple_string_dictionary_writer_0 =
|
auto simple_string_dictionary_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
auto simple_string_dictionary_entry_writer_0 =
|
auto simple_string_dictionary_entry_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(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(
|
||||||
std::move(simple_string_dictionary_entry_writer_0));
|
std::move(simple_string_dictionary_entry_writer_0));
|
||||||
@ -223,22 +225,22 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) {
|
|||||||
kMinidumpModuleListIndex0);
|
kMinidumpModuleListIndex0);
|
||||||
|
|
||||||
auto module_writer_1 =
|
auto module_writer_1 =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
EXPECT_FALSE(module_writer_1->IsUseful());
|
EXPECT_FALSE(module_writer_1->IsUseful());
|
||||||
module_list_writer->AddModule(std::move(module_writer_1),
|
module_list_writer->AddModule(std::move(module_writer_1),
|
||||||
kMinidumpModuleListIndex1);
|
kMinidumpModuleListIndex1);
|
||||||
|
|
||||||
auto module_writer_2 =
|
auto module_writer_2 =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoWriter());
|
||||||
auto simple_string_dictionary_writer_2 =
|
auto simple_string_dictionary_writer_2 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryWriter());
|
||||||
auto simple_string_dictionary_entry_writer_2a =
|
auto simple_string_dictionary_entry_writer_2a =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(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(
|
||||||
std::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());
|
base::WrapUnique(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(
|
||||||
std::move(simple_string_dictionary_entry_writer_2b));
|
std::move(simple_string_dictionary_entry_writer_2b));
|
||||||
@ -374,7 +376,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, InitializeFromSnapshot) {
|
|||||||
module_snapshots.push_back(&module_snapshot_3);
|
module_snapshots.push_back(&module_snapshot_3);
|
||||||
|
|
||||||
auto module_list_writer =
|
auto module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter());
|
base::WrapUnique(new MinidumpModuleCrashpadInfoListWriter());
|
||||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||||
EXPECT_TRUE(module_list_writer->IsUseful());
|
EXPECT_TRUE(module_list_writer->IsUseful());
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
#include "minidump/minidump_string_writer.h"
|
#include "minidump/minidump_string_writer.h"
|
||||||
#include "minidump/minidump_writer_util.h"
|
#include "minidump/minidump_writer_util.h"
|
||||||
@ -241,7 +242,7 @@ void MinidumpModuleWriter::InitializeFromSnapshot(
|
|||||||
SetFileTypeAndSubtype(file_type, VFT2_UNKNOWN);
|
SetFileTypeAndSubtype(file_type, VFT2_UNKNOWN);
|
||||||
|
|
||||||
auto codeview_record =
|
auto codeview_record =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
base::WrapUnique(new MinidumpModuleCodeViewRecordPDB70Writer());
|
||||||
codeview_record->InitializeFromSnapshot(module_snapshot);
|
codeview_record->InitializeFromSnapshot(module_snapshot);
|
||||||
SetCodeViewRecord(std::move(codeview_record));
|
SetCodeViewRecord(std::move(codeview_record));
|
||||||
}
|
}
|
||||||
@ -262,14 +263,14 @@ void MinidumpModuleWriter::SetName(const std::string& name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleWriter::SetCodeViewRecord(
|
void MinidumpModuleWriter::SetCodeViewRecord(
|
||||||
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
|
std::unique_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
codeview_record_ = std::move(codeview_record);
|
codeview_record_ = std::move(codeview_record);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleWriter::SetMiscDebugRecord(
|
void MinidumpModuleWriter::SetMiscDebugRecord(
|
||||||
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
|
std::unique_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
misc_debug_record_ = std::move(misc_debug_record);
|
misc_debug_record_ = std::move(misc_debug_record);
|
||||||
@ -382,14 +383,14 @@ void MinidumpModuleListWriter::InitializeFromSnapshot(
|
|||||||
DCHECK(modules_.empty());
|
DCHECK(modules_.empty());
|
||||||
|
|
||||||
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
for (const ModuleSnapshot* module_snapshot : module_snapshots) {
|
||||||
auto module = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module->InitializeFromSnapshot(module_snapshot);
|
module->InitializeFromSnapshot(module_snapshot);
|
||||||
AddModule(std::move(module));
|
AddModule(std::move(module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpModuleListWriter::AddModule(
|
void MinidumpModuleListWriter::AddModule(
|
||||||
scoped_ptr<MinidumpModuleWriter> module) {
|
std::unique_ptr<MinidumpModuleWriter> module) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
modules_.push_back(module.release());
|
modules_.push_back(module.release());
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
@ -218,7 +218,7 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetCodeViewRecord(
|
void SetCodeViewRecord(
|
||||||
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record);
|
std::unique_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record);
|
||||||
|
|
||||||
//! \brief Arranges for MINIDUMP_MODULE::MiscRecord to point to an
|
//! \brief Arranges for MINIDUMP_MODULE::MiscRecord to point to an
|
||||||
//! IMAGE_DEBUG_MISC object to be written by \a misc_debug_record.
|
//! IMAGE_DEBUG_MISC object to be written by \a misc_debug_record.
|
||||||
@ -228,7 +228,7 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetMiscDebugRecord(
|
void SetMiscDebugRecord(
|
||||||
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record);
|
std::unique_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record);
|
||||||
|
|
||||||
//! \brief Sets IMAGE_DEBUG_MISC::BaseOfImage.
|
//! \brief Sets IMAGE_DEBUG_MISC::BaseOfImage.
|
||||||
void SetImageBaseAddress(uint64_t image_base_address) {
|
void SetImageBaseAddress(uint64_t image_base_address) {
|
||||||
@ -298,9 +298,9 @@ class MinidumpModuleWriter final : public internal::MinidumpWritable {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MINIDUMP_MODULE module_;
|
MINIDUMP_MODULE module_;
|
||||||
scoped_ptr<internal::MinidumpUTF16StringWriter> name_;
|
std::unique_ptr<internal::MinidumpUTF16StringWriter> name_;
|
||||||
scoped_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record_;
|
std::unique_ptr<MinidumpModuleCodeViewRecordWriter> codeview_record_;
|
||||||
scoped_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record_;
|
std::unique_ptr<MinidumpModuleMiscDebugRecordWriter> misc_debug_record_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleWriter);
|
||||||
};
|
};
|
||||||
@ -329,7 +329,7 @@ class MinidumpModuleListWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//! overall tree of internal::MinidumpWritable objects.
|
//! overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddModule(scoped_ptr<MinidumpModuleWriter> module);
|
void AddModule(std::unique_ptr<MinidumpModuleWriter> module);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// MinidumpWritable:
|
// MinidumpWritable:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
@ -64,7 +65,7 @@ void GetModuleListStream(const std::string& file_contents,
|
|||||||
|
|
||||||
TEST(MinidumpModuleWriter, EmptyModuleList) {
|
TEST(MinidumpModuleWriter, EmptyModuleList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
@ -267,11 +268,11 @@ void ExpectModule(const MINIDUMP_MODULE* expected,
|
|||||||
|
|
||||||
TEST(MinidumpModuleWriter, EmptyModule) {
|
TEST(MinidumpModuleWriter, EmptyModule) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName[] = "test_executable";
|
const char kModuleName[] = "test_executable";
|
||||||
|
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_writer->SetName(kModuleName);
|
module_writer->SetName(kModuleName);
|
||||||
|
|
||||||
module_list_writer->AddModule(std::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
@ -306,7 +307,7 @@ TEST(MinidumpModuleWriter, EmptyModule) {
|
|||||||
|
|
||||||
TEST(MinidumpModuleWriter, OneModule) {
|
TEST(MinidumpModuleWriter, OneModule) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName[] = "statically_linked";
|
const char kModuleName[] = "statically_linked";
|
||||||
const uint64_t kModuleBase = 0x10da69000;
|
const uint64_t kModuleBase = 0x10da69000;
|
||||||
@ -335,7 +336,7 @@ TEST(MinidumpModuleWriter, OneModule) {
|
|||||||
const char kDebugName[] = "statical.dbg";
|
const char kDebugName[] = "statical.dbg";
|
||||||
const bool kDebugUTF16 = false;
|
const bool kDebugUTF16 = false;
|
||||||
|
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_writer->SetName(kModuleName);
|
module_writer->SetName(kModuleName);
|
||||||
module_writer->SetImageBaseAddress(kModuleBase);
|
module_writer->SetImageBaseAddress(kModuleBase);
|
||||||
module_writer->SetImageSize(kModuleSize);
|
module_writer->SetImageSize(kModuleSize);
|
||||||
@ -354,13 +355,13 @@ TEST(MinidumpModuleWriter, OneModule) {
|
|||||||
module_writer->SetFileTypeAndSubtype(kFileType, kFileSubtype);
|
module_writer->SetFileTypeAndSubtype(kFileType, kFileSubtype);
|
||||||
|
|
||||||
auto codeview_pdb70_writer =
|
auto codeview_pdb70_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
base::WrapUnique(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(std::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());
|
base::WrapUnique(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(std::move(misc_debug_writer));
|
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||||
@ -415,7 +416,7 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
|||||||
// alternatives, a PDB 2.0 link as the CodeView record and an IMAGE_DEBUG_MISC
|
// alternatives, a PDB 2.0 link as the CodeView record and an IMAGE_DEBUG_MISC
|
||||||
// record with UTF-16 data.
|
// record with UTF-16 data.
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName[] = "dinosaur";
|
const char kModuleName[] = "dinosaur";
|
||||||
const char kPDBName[] = "d1n05.pdb";
|
const char kPDBName[] = "d1n05.pdb";
|
||||||
@ -425,17 +426,17 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) {
|
|||||||
const char kDebugName[] = "d1n05.dbg";
|
const char kDebugName[] = "d1n05.dbg";
|
||||||
const bool kDebugUTF16 = true;
|
const bool kDebugUTF16 = true;
|
||||||
|
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_writer->SetName(kModuleName);
|
module_writer->SetName(kModuleName);
|
||||||
|
|
||||||
auto codeview_pdb20_writer =
|
auto codeview_pdb20_writer =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
base::WrapUnique(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(std::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());
|
base::WrapUnique(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(std::move(misc_debug_writer));
|
module_writer->SetMiscDebugRecord(std::move(misc_debug_writer));
|
||||||
@ -476,7 +477,7 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
|||||||
// its CodeView record, one with no CodeView record, and one with a PDB 2.0
|
// its CodeView record, one with no CodeView record, and one with a PDB 2.0
|
||||||
// link as its CodeView record.
|
// link as its CodeView record.
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName0[] = "main";
|
const char kModuleName0[] = "main";
|
||||||
const uint64_t kModuleBase0 = 0x100101000;
|
const uint64_t kModuleBase0 = 0x100101000;
|
||||||
@ -500,33 +501,33 @@ TEST(MinidumpModuleWriter, ThreeModules) {
|
|||||||
const time_t kPDBTimestamp2 = 0x386d4380;
|
const time_t kPDBTimestamp2 = 0x386d4380;
|
||||||
const uint32_t kPDBAge2 = 2;
|
const uint32_t kPDBAge2 = 2;
|
||||||
|
|
||||||
auto module_writer_0 = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer_0 = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_writer_0->SetName(kModuleName0);
|
module_writer_0->SetName(kModuleName0);
|
||||||
module_writer_0->SetImageBaseAddress(kModuleBase0);
|
module_writer_0->SetImageBaseAddress(kModuleBase0);
|
||||||
module_writer_0->SetImageSize(kModuleSize0);
|
module_writer_0->SetImageSize(kModuleSize0);
|
||||||
|
|
||||||
auto codeview_pdb70_writer_0 =
|
auto codeview_pdb70_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer());
|
base::WrapUnique(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(std::move(codeview_pdb70_writer_0));
|
module_writer_0->SetCodeViewRecord(std::move(codeview_pdb70_writer_0));
|
||||||
|
|
||||||
module_list_writer->AddModule(std::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 = base::WrapUnique(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(std::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 = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_writer_2->SetName(kModuleName2);
|
module_writer_2->SetName(kModuleName2);
|
||||||
module_writer_2->SetImageBaseAddress(kModuleBase2);
|
module_writer_2->SetImageBaseAddress(kModuleBase2);
|
||||||
module_writer_2->SetImageSize(kModuleSize2);
|
module_writer_2->SetImageSize(kModuleSize2);
|
||||||
|
|
||||||
auto codeview_pdb70_writer_2 =
|
auto codeview_pdb70_writer_2 =
|
||||||
make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer());
|
base::WrapUnique(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(std::move(codeview_pdb70_writer_2));
|
module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2));
|
||||||
@ -722,7 +723,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
|||||||
module_snapshots.push_back(module_snapshot);
|
module_snapshots.push_back(module_snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
module_list_writer->InitializeFromSnapshot(module_snapshots);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
@ -755,8 +756,8 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) {
|
|||||||
|
|
||||||
TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
|
TEST(MinidumpModuleWriterDeathTest, NoModuleName) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter());
|
auto module_list_writer = base::WrapUnique(new MinidumpModuleListWriter());
|
||||||
auto module_writer = make_scoped_ptr(new MinidumpModuleWriter());
|
auto module_writer = base::WrapUnique(new MinidumpModuleWriter());
|
||||||
module_list_writer->AddModule(std::move(module_writer));
|
module_list_writer->AddModule(std::move(module_writer));
|
||||||
minidump_file_writer.AddStream(std::move(module_list_writer));
|
minidump_file_writer.AddStream(std::move(module_list_writer));
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ MinidumpRVAListWriter::MinidumpRVAListWriter()
|
|||||||
MinidumpRVAListWriter::~MinidumpRVAListWriter() {
|
MinidumpRVAListWriter::~MinidumpRVAListWriter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpRVAListWriter::AddChild(scoped_ptr<MinidumpWritable> child) {
|
void MinidumpRVAListWriter::AddChild(std::unique_ptr<MinidumpWritable> child) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
children_.push_back(child.release());
|
children_.push_back(child.release());
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
@ -47,7 +47,7 @@ class MinidumpRVAListWriter : public MinidumpWritable {
|
|||||||
//! MinidumpWritable subclass, and call this method with that argument.
|
//! MinidumpWritable subclass, and call this method with that argument.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddChild(scoped_ptr<MinidumpWritable> child);
|
void AddChild(std::unique_ptr<MinidumpWritable> child);
|
||||||
|
|
||||||
//! \brief Returns `true` if no child objects have been added by AddChild(),
|
//! \brief Returns `true` if no child objects have been added by AddChild(),
|
||||||
//! and `false` if child objects are present.
|
//! and `false` if child objects are present.
|
||||||
@ -66,7 +66,7 @@ class MinidumpRVAListWriter : public MinidumpWritable {
|
|||||||
bool WriteObject(FileWriterInterface* file_writer) override;
|
bool WriteObject(FileWriterInterface* file_writer) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<MinidumpRVAList> rva_list_base_;
|
std::unique_ptr<MinidumpRVAList> rva_list_base_;
|
||||||
PointerVector<MinidumpWritable> children_;
|
PointerVector<MinidumpWritable> children_;
|
||||||
std::vector<RVA> child_rvas_;
|
std::vector<RVA> child_rvas_;
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
@ -33,7 +34,7 @@ class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter {
|
|||||||
~TestMinidumpRVAListWriter() override {}
|
~TestMinidumpRVAListWriter() override {}
|
||||||
|
|
||||||
void AddChild(uint32_t value) {
|
void AddChild(uint32_t value) {
|
||||||
auto child = make_scoped_ptr(new TestUInt32MinidumpWritable(value));
|
auto child = base::WrapUnique(new TestUInt32MinidumpWritable(value));
|
||||||
MinidumpRVAListWriter::AddChild(std::move(child));
|
MinidumpRVAListWriter::AddChild(std::move(child));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
@ -109,14 +110,14 @@ void MinidumpSimpleStringDictionaryWriter::InitializeFromMap(
|
|||||||
|
|
||||||
for (const auto& iterator : map) {
|
for (const auto& iterator : map) {
|
||||||
auto entry =
|
auto entry =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry->SetKeyValue(iterator.first, iterator.second);
|
entry->SetKeyValue(iterator.first, iterator.second);
|
||||||
AddEntry(std::move(entry));
|
AddEntry(std::move(entry));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpSimpleStringDictionaryWriter::AddEntry(
|
void MinidumpSimpleStringDictionaryWriter::AddEntry(
|
||||||
scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry) {
|
std::unique_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
const std::string& key = entry->Key();
|
const std::string& key = entry->Key();
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_string_writer.h"
|
#include "minidump/minidump_string_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -112,7 +112,8 @@ class MinidumpSimpleStringDictionaryWriter final
|
|||||||
//! replace the previous one.
|
//! replace the previous one.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddEntry(scoped_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry);
|
void AddEntry(
|
||||||
|
std::unique_ptr<MinidumpSimpleStringDictionaryEntryWriter> entry);
|
||||||
|
|
||||||
//! \brief Determines whether the object is useful.
|
//! \brief Determines whether the object is useful.
|
||||||
//!
|
//!
|
||||||
@ -135,7 +136,8 @@ class MinidumpSimpleStringDictionaryWriter final
|
|||||||
// This object owns the MinidumpSimpleStringDictionaryEntryWriter objects.
|
// This object owns the MinidumpSimpleStringDictionaryEntryWriter objects.
|
||||||
std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> entries_;
|
std::map<std::string, MinidumpSimpleStringDictionaryEntryWriter*> entries_;
|
||||||
|
|
||||||
scoped_ptr<MinidumpSimpleStringDictionary> simple_string_dictionary_base_;
|
std::unique_ptr<MinidumpSimpleStringDictionary>
|
||||||
|
simple_string_dictionary_base_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpSimpleStringDictionaryWriter);
|
||||||
};
|
};
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#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"
|
||||||
@ -64,7 +65,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) {
|
|||||||
|
|
||||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||||
auto entry_writer =
|
auto entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
dictionary_writer.AddEntry(std::move(entry_writer));
|
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||||
|
|
||||||
EXPECT_TRUE(dictionary_writer.IsUseful());
|
EXPECT_TRUE(dictionary_writer.IsUseful());
|
||||||
@ -97,7 +98,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) {
|
|||||||
|
|
||||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||||
auto entry_writer =
|
auto entry_writer =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer->SetKeyValue(kKey, kValue);
|
entry_writer->SetKeyValue(kKey, kValue);
|
||||||
dictionary_writer.AddEntry(std::move(entry_writer));
|
dictionary_writer.AddEntry(std::move(entry_writer));
|
||||||
|
|
||||||
@ -135,15 +136,15 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) {
|
|||||||
|
|
||||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||||
auto entry_writer_0 =
|
auto entry_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
entry_writer_0->SetKeyValue(kKey0, kValue0);
|
||||||
dictionary_writer.AddEntry(std::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());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
entry_writer_1->SetKeyValue(kKey1, kValue1);
|
||||||
dictionary_writer.AddEntry(std::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());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
entry_writer_2->SetKeyValue(kKey2, kValue2);
|
||||||
dictionary_writer.AddEntry(std::move(entry_writer_2));
|
dictionary_writer.AddEntry(std::move(entry_writer_2));
|
||||||
|
|
||||||
@ -203,11 +204,11 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) {
|
|||||||
|
|
||||||
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
MinidumpSimpleStringDictionaryWriter dictionary_writer;
|
||||||
auto entry_writer_0 =
|
auto entry_writer_0 =
|
||||||
make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_0->SetKeyValue(kKey, kValue0);
|
entry_writer_0->SetKeyValue(kKey, kValue0);
|
||||||
dictionary_writer.AddEntry(std::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());
|
base::WrapUnique(new MinidumpSimpleStringDictionaryEntryWriter());
|
||||||
entry_writer_1->SetKeyValue(kKey, kValue1);
|
entry_writer_1->SetKeyValue(kKey, kValue1);
|
||||||
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
dictionary_writer.AddEntry(std::move(entry_writer_1));
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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/numeric/safe_assignment.h"
|
#include "util/numeric/safe_assignment.h"
|
||||||
@ -119,7 +120,7 @@ void MinidumpStringListWriter<MinidumpStringWriterType>::InitializeFromVector(
|
|||||||
template <typename MinidumpStringWriterType>
|
template <typename MinidumpStringWriterType>
|
||||||
void MinidumpStringListWriter<MinidumpStringWriterType>::AddStringUTF8(
|
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 = base::WrapUnique(new MinidumpStringWriterType());
|
||||||
string_writer->SetUTF8(string_utf8);
|
string_writer->SetUTF8(string_utf8);
|
||||||
AddChild(std::move(string_writer));
|
AddChild(std::move(string_writer));
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_rva_list_writer.h"
|
#include "minidump/minidump_rva_list_writer.h"
|
||||||
@ -77,7 +77,7 @@ class MinidumpStringWriter : public MinidumpWritable {
|
|||||||
const StringType& string() const { return string_; }
|
const StringType& string() const { return string_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<MinidumpStringType> string_base_;
|
std::unique_ptr<MinidumpStringType> string_base_;
|
||||||
StringType string_;
|
StringType string_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpStringWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpStringWriter);
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_extensions.h"
|
#include "minidump/minidump_extensions.h"
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -187,7 +187,7 @@ class MinidumpSystemInfoWriter final : public internal::MinidumpStreamWriter {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MINIDUMP_SYSTEM_INFO system_info_;
|
MINIDUMP_SYSTEM_INFO system_info_;
|
||||||
scoped_ptr<internal::MinidumpUTF16StringWriter> csd_version_;
|
std::unique_ptr<internal::MinidumpUTF16StringWriter> csd_version_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpSystemInfoWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpSystemInfoWriter);
|
||||||
};
|
};
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||||
@ -77,7 +78,7 @@ void GetSystemInfoStream(const std::string& file_contents,
|
|||||||
|
|
||||||
TEST(MinidumpSystemInfoWriter, Empty) {
|
TEST(MinidumpSystemInfoWriter, Empty) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
|
|
||||||
system_info_writer->SetCSDVersion(std::string());
|
system_info_writer->SetCSDVersion(std::string());
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ TEST(MinidumpSystemInfoWriter, Empty) {
|
|||||||
|
|
||||||
TEST(MinidumpSystemInfoWriter, X86_Win) {
|
TEST(MinidumpSystemInfoWriter, X86_Win) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
|
|
||||||
const MinidumpCPUArchitecture kCPUArchitecture = kMinidumpCPUArchitectureX86;
|
const MinidumpCPUArchitecture kCPUArchitecture = kMinidumpCPUArchitectureX86;
|
||||||
const uint16_t kCPULevel = 0x0010;
|
const uint16_t kCPULevel = 0x0010;
|
||||||
@ -187,7 +188,7 @@ TEST(MinidumpSystemInfoWriter, X86_Win) {
|
|||||||
|
|
||||||
TEST(MinidumpSystemInfoWriter, AMD64_Mac) {
|
TEST(MinidumpSystemInfoWriter, AMD64_Mac) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
|
|
||||||
const MinidumpCPUArchitecture kCPUArchitecture =
|
const MinidumpCPUArchitecture kCPUArchitecture =
|
||||||
kMinidumpCPUArchitectureAMD64;
|
kMinidumpCPUArchitectureAMD64;
|
||||||
@ -244,7 +245,7 @@ TEST(MinidumpSystemInfoWriter, X86_CPUVendorFromRegisters) {
|
|||||||
// This test exercises SetCPUX86Vendor() to set the vendor from register
|
// This test exercises SetCPUX86Vendor() to set the vendor from register
|
||||||
// values.
|
// values.
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
|
|
||||||
const MinidumpCPUArchitecture kCPUArchitecture = kMinidumpCPUArchitectureX86;
|
const MinidumpCPUArchitecture kCPUArchitecture = kMinidumpCPUArchitectureX86;
|
||||||
const uint32_t kCPUVendor[] = {'uneG', 'Ieni', 'letn'};
|
const uint32_t kCPUVendor[] = {'uneG', 'Ieni', 'letn'};
|
||||||
@ -330,7 +331,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) {
|
|||||||
expect_system_info.BuildNumber,
|
expect_system_info.BuildNumber,
|
||||||
kOSVersionBuild);
|
kOSVersionBuild);
|
||||||
|
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
@ -425,7 +426,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) {
|
|||||||
kOSVersionBuild);
|
kOSVersionBuild);
|
||||||
system_snapshot.SetNXEnabled(true);
|
system_snapshot.SetNXEnabled(true);
|
||||||
|
|
||||||
auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter());
|
auto system_info_writer = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
system_info_writer->InitializeFromSnapshot(&system_snapshot);
|
||||||
|
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
@ -466,7 +467,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 = base::WrapUnique(new MinidumpSystemInfoWriter());
|
||||||
minidump_file_writer.AddStream(std::move(system_info_writer));
|
minidump_file_writer.AddStream(std::move(system_info_writer));
|
||||||
|
|
||||||
StringFile string_file;
|
StringFile string_file;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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"
|
||||||
@ -50,12 +51,12 @@ void MinidumpThreadWriter::InitializeFromSnapshot(
|
|||||||
|
|
||||||
const MemorySnapshot* stack_snapshot = thread_snapshot->Stack();
|
const MemorySnapshot* stack_snapshot = thread_snapshot->Stack();
|
||||||
if (stack_snapshot && stack_snapshot->Size() > 0) {
|
if (stack_snapshot && stack_snapshot->Size() > 0) {
|
||||||
scoped_ptr<MinidumpMemoryWriter> stack =
|
std::unique_ptr<MinidumpMemoryWriter> stack =
|
||||||
MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
|
MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot);
|
||||||
SetStack(std::move(stack));
|
SetStack(std::move(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<MinidumpContextWriter> context =
|
std::unique_ptr<MinidumpContextWriter> context =
|
||||||
MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
|
MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context());
|
||||||
SetContext(std::move(context));
|
SetContext(std::move(context));
|
||||||
}
|
}
|
||||||
@ -66,14 +67,15 @@ const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const {
|
|||||||
return &thread_;
|
return &thread_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpThreadWriter::SetStack(scoped_ptr<MinidumpMemoryWriter> stack) {
|
void MinidumpThreadWriter::SetStack(
|
||||||
|
std::unique_ptr<MinidumpMemoryWriter> stack) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
stack_ = std::move(stack);
|
stack_ = std::move(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpThreadWriter::SetContext(
|
void MinidumpThreadWriter::SetContext(
|
||||||
scoped_ptr<MinidumpContextWriter> context) {
|
std::unique_ptr<MinidumpContextWriter> context) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
context_ = std::move(context);
|
context_ = std::move(context);
|
||||||
@ -146,7 +148,7 @@ void MinidumpThreadListWriter::InitializeFromSnapshot(
|
|||||||
BuildMinidumpThreadIDMap(thread_snapshots, thread_id_map);
|
BuildMinidumpThreadIDMap(thread_snapshots, thread_id_map);
|
||||||
|
|
||||||
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
for (const ThreadSnapshot* thread_snapshot : thread_snapshots) {
|
||||||
auto thread = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
thread->InitializeFromSnapshot(thread_snapshot, thread_id_map);
|
||||||
AddThread(std::move(thread));
|
AddThread(std::move(thread));
|
||||||
}
|
}
|
||||||
@ -166,7 +168,7 @@ void MinidumpThreadListWriter::SetMemoryListWriter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpThreadListWriter::AddThread(
|
void MinidumpThreadListWriter::AddThread(
|
||||||
scoped_ptr<MinidumpThreadWriter> thread) {
|
std::unique_ptr<MinidumpThreadWriter> thread) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
if (memory_list_writer_) {
|
if (memory_list_writer_) {
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_thread_id_map.h"
|
#include "minidump/minidump_thread_id_map.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -89,7 +89,7 @@ class MinidumpThreadWriter final : public internal::MinidumpWritable {
|
|||||||
//! overall tree of internal::MinidumpWritable objects.
|
//! overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetStack(scoped_ptr<MinidumpMemoryWriter> stack);
|
void SetStack(std::unique_ptr<MinidumpMemoryWriter> stack);
|
||||||
|
|
||||||
//! \brief Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU
|
//! \brief Arranges for MINIDUMP_THREAD::ThreadContext to point to the CPU
|
||||||
//! context to be written by \a context.
|
//! context to be written by \a context.
|
||||||
@ -100,7 +100,7 @@ class MinidumpThreadWriter final : public internal::MinidumpWritable {
|
|||||||
//! overall tree of internal::MinidumpWritable objects.
|
//! overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void SetContext(scoped_ptr<MinidumpContextWriter> context);
|
void SetContext(std::unique_ptr<MinidumpContextWriter> context);
|
||||||
|
|
||||||
//! \brief Sets MINIDUMP_THREAD::ThreadId.
|
//! \brief Sets MINIDUMP_THREAD::ThreadId.
|
||||||
void SetThreadID(uint32_t thread_id) { thread_.ThreadId = thread_id; }
|
void SetThreadID(uint32_t thread_id) { thread_.ThreadId = thread_id; }
|
||||||
@ -130,8 +130,8 @@ class MinidumpThreadWriter final : public internal::MinidumpWritable {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MINIDUMP_THREAD thread_;
|
MINIDUMP_THREAD thread_;
|
||||||
scoped_ptr<MinidumpMemoryWriter> stack_;
|
std::unique_ptr<MinidumpMemoryWriter> stack_;
|
||||||
scoped_ptr<MinidumpContextWriter> context_;
|
std::unique_ptr<MinidumpContextWriter> context_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpThreadWriter);
|
||||||
};
|
};
|
||||||
@ -190,7 +190,7 @@ class MinidumpThreadListWriter final : public internal::MinidumpStreamWriter {
|
|||||||
//! overall tree of internal::MinidumpWritable objects.
|
//! overall tree of internal::MinidumpWritable objects.
|
||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddThread(scoped_ptr<MinidumpThreadWriter> thread);
|
void AddThread(std::unique_ptr<MinidumpThreadWriter> thread);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// MinidumpWritable:
|
// MinidumpWritable:
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_context_writer.h"
|
#include "minidump/minidump_context_writer.h"
|
||||||
@ -78,7 +79,7 @@ void GetThreadListStream(const std::string& file_contents,
|
|||||||
|
|
||||||
TEST(MinidumpThreadWriter, EmptyThreadList) {
|
TEST(MinidumpThreadWriter, EmptyThreadList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
|
|
||||||
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ void ExpectThread(const MINIDUMP_THREAD* expected,
|
|||||||
|
|
||||||
TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
|
|
||||||
const uint32_t kThreadID = 0x11111111;
|
const uint32_t kThreadID = 0x11111111;
|
||||||
const uint32_t kSuspendCount = 1;
|
const uint32_t kSuspendCount = 1;
|
||||||
@ -148,14 +149,14 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
|||||||
const uint64_t kTEB = 0x55555555;
|
const uint64_t kTEB = 0x55555555;
|
||||||
const uint32_t kSeed = 123;
|
const uint32_t kSeed = 123;
|
||||||
|
|
||||||
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread_writer->SetThreadID(kThreadID);
|
thread_writer->SetThreadID(kThreadID);
|
||||||
thread_writer->SetSuspendCount(kSuspendCount);
|
thread_writer->SetSuspendCount(kSuspendCount);
|
||||||
thread_writer->SetPriorityClass(kPriorityClass);
|
thread_writer->SetPriorityClass(kPriorityClass);
|
||||||
thread_writer->SetPriority(kPriority);
|
thread_writer->SetPriority(kPriority);
|
||||||
thread_writer->SetTEB(kTEB);
|
thread_writer->SetTEB(kTEB);
|
||||||
|
|
||||||
auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer());
|
auto context_x86_writer = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
InitializeMinidumpContextX86(context_x86_writer->context(), kSeed);
|
||||||
thread_writer->SetContext(std::move(context_x86_writer));
|
thread_writer->SetContext(std::move(context_x86_writer));
|
||||||
|
|
||||||
@ -198,7 +199,7 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) {
|
|||||||
|
|
||||||
TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
|
|
||||||
const uint32_t kThreadID = 0x22222222;
|
const uint32_t kThreadID = 0x22222222;
|
||||||
const uint32_t kSuspendCount = 2;
|
const uint32_t kSuspendCount = 2;
|
||||||
@ -210,19 +211,22 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
|||||||
const uint8_t kMemoryValue = 99;
|
const uint8_t kMemoryValue = 99;
|
||||||
const uint32_t kSeed = 456;
|
const uint32_t kSeed = 456;
|
||||||
|
|
||||||
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread_writer->SetThreadID(kThreadID);
|
thread_writer->SetThreadID(kThreadID);
|
||||||
thread_writer->SetSuspendCount(kSuspendCount);
|
thread_writer->SetSuspendCount(kSuspendCount);
|
||||||
thread_writer->SetPriorityClass(kPriorityClass);
|
thread_writer->SetPriorityClass(kPriorityClass);
|
||||||
thread_writer->SetPriority(kPriority);
|
thread_writer->SetPriority(kPriority);
|
||||||
thread_writer->SetTEB(kTEB);
|
thread_writer->SetTEB(kTEB);
|
||||||
|
|
||||||
auto memory_writer = make_scoped_ptr(
|
auto memory_writer = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue));
|
||||||
thread_writer->SetStack(std::move(memory_writer));
|
thread_writer->SetStack(std::move(memory_writer));
|
||||||
|
|
||||||
MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned.
|
// Object allocated on heap may not be aligned.
|
||||||
auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer());
|
MSVC_PUSH_DISABLE_WARNING(4316);
|
||||||
|
auto context_amd64_writer =
|
||||||
|
base::WrapUnique(new MinidumpContextAMD64Writer());
|
||||||
|
MSVC_POP_WARNING(); // C4316.
|
||||||
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed);
|
||||||
thread_writer->SetContext(std::move(context_amd64_writer));
|
thread_writer->SetContext(std::move(context_amd64_writer));
|
||||||
|
|
||||||
@ -274,8 +278,8 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) {
|
|||||||
|
|
||||||
TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
||||||
|
|
||||||
const uint32_t kThreadID0 = 1111111;
|
const uint32_t kThreadID0 = 1111111;
|
||||||
@ -288,18 +292,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
|||||||
const uint8_t kMemoryValue0 = 11;
|
const uint8_t kMemoryValue0 = 11;
|
||||||
const uint32_t kSeed0 = 1;
|
const uint32_t kSeed0 = 1;
|
||||||
|
|
||||||
auto thread_writer_0 = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer_0 = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread_writer_0->SetThreadID(kThreadID0);
|
thread_writer_0->SetThreadID(kThreadID0);
|
||||||
thread_writer_0->SetSuspendCount(kSuspendCount0);
|
thread_writer_0->SetSuspendCount(kSuspendCount0);
|
||||||
thread_writer_0->SetPriorityClass(kPriorityClass0);
|
thread_writer_0->SetPriorityClass(kPriorityClass0);
|
||||||
thread_writer_0->SetPriority(kPriority0);
|
thread_writer_0->SetPriority(kPriority0);
|
||||||
thread_writer_0->SetTEB(kTEB0);
|
thread_writer_0->SetTEB(kTEB0);
|
||||||
|
|
||||||
auto memory_writer_0 = make_scoped_ptr(
|
auto memory_writer_0 = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0));
|
||||||
thread_writer_0->SetStack(std::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 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0);
|
||||||
thread_writer_0->SetContext(std::move(context_x86_writer_0));
|
thread_writer_0->SetContext(std::move(context_x86_writer_0));
|
||||||
|
|
||||||
@ -315,18 +319,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
|||||||
const uint8_t kMemoryValue1 = 22;
|
const uint8_t kMemoryValue1 = 22;
|
||||||
const uint32_t kSeed1 = 2;
|
const uint32_t kSeed1 = 2;
|
||||||
|
|
||||||
auto thread_writer_1 = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer_1 = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread_writer_1->SetThreadID(kThreadID1);
|
thread_writer_1->SetThreadID(kThreadID1);
|
||||||
thread_writer_1->SetSuspendCount(kSuspendCount1);
|
thread_writer_1->SetSuspendCount(kSuspendCount1);
|
||||||
thread_writer_1->SetPriorityClass(kPriorityClass1);
|
thread_writer_1->SetPriorityClass(kPriorityClass1);
|
||||||
thread_writer_1->SetPriority(kPriority1);
|
thread_writer_1->SetPriority(kPriority1);
|
||||||
thread_writer_1->SetTEB(kTEB1);
|
thread_writer_1->SetTEB(kTEB1);
|
||||||
|
|
||||||
auto memory_writer_1 = make_scoped_ptr(
|
auto memory_writer_1 = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1));
|
||||||
thread_writer_1->SetStack(std::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 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1);
|
||||||
thread_writer_1->SetContext(std::move(context_x86_writer_1));
|
thread_writer_1->SetContext(std::move(context_x86_writer_1));
|
||||||
|
|
||||||
@ -342,18 +346,18 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) {
|
|||||||
const uint8_t kMemoryValue2 = 33;
|
const uint8_t kMemoryValue2 = 33;
|
||||||
const uint32_t kSeed2 = 3;
|
const uint32_t kSeed2 = 3;
|
||||||
|
|
||||||
auto thread_writer_2 = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer_2 = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
thread_writer_2->SetThreadID(kThreadID2);
|
thread_writer_2->SetThreadID(kThreadID2);
|
||||||
thread_writer_2->SetSuspendCount(kSuspendCount2);
|
thread_writer_2->SetSuspendCount(kSuspendCount2);
|
||||||
thread_writer_2->SetPriorityClass(kPriorityClass2);
|
thread_writer_2->SetPriorityClass(kPriorityClass2);
|
||||||
thread_writer_2->SetPriority(kPriority2);
|
thread_writer_2->SetPriority(kPriority2);
|
||||||
thread_writer_2->SetTEB(kTEB2);
|
thread_writer_2->SetTEB(kTEB2);
|
||||||
|
|
||||||
auto memory_writer_2 = make_scoped_ptr(
|
auto memory_writer_2 = base::WrapUnique(
|
||||||
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2));
|
||||||
thread_writer_2->SetStack(std::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 = base::WrapUnique(new MinidumpContextX86Writer());
|
||||||
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2);
|
||||||
thread_writer_2->SetContext(std::move(context_x86_writer_2));
|
thread_writer_2->SetContext(std::move(context_x86_writer_2));
|
||||||
|
|
||||||
@ -592,7 +596,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
|||||||
thread_snapshot->SetThreadSpecificDataAddress(expect_threads[index].Teb);
|
thread_snapshot->SetThreadSpecificDataAddress(expect_threads[index].Teb);
|
||||||
|
|
||||||
if (expect_threads[index].Stack.Memory.DataSize) {
|
if (expect_threads[index].Stack.Memory.DataSize) {
|
||||||
auto memory_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
auto memory_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||||
memory_snapshot->SetAddress(
|
memory_snapshot->SetAddress(
|
||||||
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);
|
||||||
@ -603,7 +607,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
|||||||
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
Traits::InitializeCPUContext(thread_snapshot->MutableContext(),
|
||||||
context_seeds[index]);
|
context_seeds[index]);
|
||||||
|
|
||||||
auto teb_snapshot = make_scoped_ptr(new TestMemorySnapshot());
|
auto teb_snapshot = base::WrapUnique(new TestMemorySnapshot());
|
||||||
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));
|
||||||
@ -612,8 +616,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) {
|
|||||||
thread_snapshots.push_back(thread_snapshot);
|
thread_snapshots.push_back(thread_snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter());
|
auto memory_list_writer = base::WrapUnique(new MinidumpMemoryListWriter());
|
||||||
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
thread_list_writer->SetMemoryListWriter(memory_list_writer.get());
|
||||||
MinidumpThreadIDMap thread_id_map;
|
MinidumpThreadIDMap thread_id_map;
|
||||||
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map);
|
||||||
@ -693,9 +697,9 @@ TEST(MinidumpThreadWriter, InitializeFromSnapshot_ThreadIDCollision) {
|
|||||||
|
|
||||||
TEST(MinidumpThreadWriterDeathTest, NoContext) {
|
TEST(MinidumpThreadWriterDeathTest, NoContext) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter());
|
auto thread_list_writer = base::WrapUnique(new MinidumpThreadListWriter());
|
||||||
|
|
||||||
auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter());
|
auto thread_writer = base::WrapUnique(new MinidumpThreadWriter());
|
||||||
|
|
||||||
thread_list_writer->AddThread(std::move(thread_writer));
|
thread_list_writer->AddThread(std::move(thread_writer));
|
||||||
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
minidump_file_writer.AddStream(std::move(thread_list_writer));
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.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/numeric/in_range_cast.h"
|
#include "util/numeric/in_range_cast.h"
|
||||||
@ -123,14 +124,14 @@ void MinidumpUnloadedModuleListWriter::InitializeFromSnapshot(
|
|||||||
DCHECK(unloaded_modules_.empty());
|
DCHECK(unloaded_modules_.empty());
|
||||||
|
|
||||||
for (auto unloaded_module_snapshot : unloaded_module_snapshots) {
|
for (auto unloaded_module_snapshot : unloaded_module_snapshots) {
|
||||||
auto unloaded_module = make_scoped_ptr(new MinidumpUnloadedModuleWriter());
|
auto unloaded_module = base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||||
unloaded_module->InitializeFromSnapshot(unloaded_module_snapshot);
|
unloaded_module->InitializeFromSnapshot(unloaded_module_snapshot);
|
||||||
AddUnloadedModule(std::move(unloaded_module));
|
AddUnloadedModule(std::move(unloaded_module));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MinidumpUnloadedModuleListWriter::AddUnloadedModule(
|
void MinidumpUnloadedModuleListWriter::AddUnloadedModule(
|
||||||
scoped_ptr<MinidumpUnloadedModuleWriter> unloaded_module) {
|
std::unique_ptr<MinidumpUnloadedModuleWriter> unloaded_module) {
|
||||||
DCHECK_EQ(state(), kStateMutable);
|
DCHECK_EQ(state(), kStateMutable);
|
||||||
|
|
||||||
unloaded_modules_.push_back(unloaded_module.release());
|
unloaded_modules_.push_back(unloaded_module.release());
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "minidump/minidump_stream_writer.h"
|
#include "minidump/minidump_stream_writer.h"
|
||||||
#include "minidump/minidump_string_writer.h"
|
#include "minidump/minidump_string_writer.h"
|
||||||
#include "minidump/minidump_writable.h"
|
#include "minidump/minidump_writable.h"
|
||||||
@ -96,7 +96,7 @@ class MinidumpUnloadedModuleWriter final : public internal::MinidumpWritable {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
MINIDUMP_UNLOADED_MODULE unloaded_module_;
|
MINIDUMP_UNLOADED_MODULE unloaded_module_;
|
||||||
scoped_ptr<internal::MinidumpUTF16StringWriter> name_;
|
std::unique_ptr<internal::MinidumpUTF16StringWriter> name_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(MinidumpUnloadedModuleWriter);
|
DISALLOW_COPY_AND_ASSIGN(MinidumpUnloadedModuleWriter);
|
||||||
};
|
};
|
||||||
@ -130,7 +130,7 @@ class MinidumpUnloadedModuleListWriter final
|
|||||||
//!
|
//!
|
||||||
//! \note Valid in #kStateMutable.
|
//! \note Valid in #kStateMutable.
|
||||||
void AddUnloadedModule(
|
void AddUnloadedModule(
|
||||||
scoped_ptr<MinidumpUnloadedModuleWriter> unloaded_module);
|
std::unique_ptr<MinidumpUnloadedModuleWriter> unloaded_module);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// MinidumpWritable:
|
// MinidumpWritable:
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include "minidump/minidump_unloaded_module_writer.h"
|
#include "minidump/minidump_unloaded_module_writer.h"
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
@ -71,12 +72,12 @@ void GetUnloadedModuleListStream(
|
|||||||
TEST(MinidumpUnloadedModuleWriter, EmptyModule) {
|
TEST(MinidumpUnloadedModuleWriter, EmptyModule) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto unloaded_module_list_writer =
|
auto unloaded_module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpUnloadedModuleListWriter());
|
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName[] = "test_dll";
|
const char kModuleName[] = "test_dll";
|
||||||
|
|
||||||
auto unloaded_module_writer =
|
auto unloaded_module_writer =
|
||||||
make_scoped_ptr(new MinidumpUnloadedModuleWriter());
|
base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||||
unloaded_module_writer->SetName(kModuleName);
|
unloaded_module_writer->SetName(kModuleName);
|
||||||
|
|
||||||
unloaded_module_list_writer->AddUnloadedModule(
|
unloaded_module_list_writer->AddUnloadedModule(
|
||||||
@ -109,7 +110,7 @@ TEST(MinidumpUnloadedModuleWriter, EmptyModule) {
|
|||||||
TEST(MinidumpUnloadedModuleWriter, OneModule) {
|
TEST(MinidumpUnloadedModuleWriter, OneModule) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto unloaded_module_list_writer =
|
auto unloaded_module_list_writer =
|
||||||
make_scoped_ptr(new MinidumpUnloadedModuleListWriter());
|
base::WrapUnique(new MinidumpUnloadedModuleListWriter());
|
||||||
|
|
||||||
const char kModuleName[] = "statically_linked";
|
const char kModuleName[] = "statically_linked";
|
||||||
const uint64_t kModuleBase = 0x10da69000;
|
const uint64_t kModuleBase = 0x10da69000;
|
||||||
@ -118,7 +119,7 @@ TEST(MinidumpUnloadedModuleWriter, OneModule) {
|
|||||||
const time_t kTimestamp = 0x386d4380;
|
const time_t kTimestamp = 0x386d4380;
|
||||||
|
|
||||||
auto unloaded_module_writer =
|
auto unloaded_module_writer =
|
||||||
make_scoped_ptr(new MinidumpUnloadedModuleWriter());
|
base::WrapUnique(new MinidumpUnloadedModuleWriter());
|
||||||
unloaded_module_writer->SetName(kModuleName);
|
unloaded_module_writer->SetName(kModuleName);
|
||||||
unloaded_module_writer->SetImageBaseAddress(kModuleBase);
|
unloaded_module_writer->SetImageBaseAddress(kModuleBase);
|
||||||
unloaded_module_writer->SetImageSize(kModuleSize);
|
unloaded_module_writer->SetImageSize(kModuleSize);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
#include "minidump/test/minidump_file_writer_test_util.h"
|
#include "minidump/test/minidump_file_writer_test_util.h"
|
||||||
@ -51,9 +52,10 @@ void GetUserStream(const std::string& file_contents,
|
|||||||
|
|
||||||
TEST(MinidumpUserStreamWriter, NoData) {
|
TEST(MinidumpUserStreamWriter, NoData) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto user_stream_writer = make_scoped_ptr(new MinidumpUserStreamWriter());
|
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||||
const uint32_t kTestStreamId = 0x123456;
|
const uint32_t kTestStreamId = 0x123456;
|
||||||
auto stream = make_scoped_ptr(new UserMinidumpStream(kTestStreamId, nullptr));
|
auto stream =
|
||||||
|
base::WrapUnique(new UserMinidumpStream(kTestStreamId, nullptr));
|
||||||
user_stream_writer->InitializeFromSnapshot(stream.get());
|
user_stream_writer->InitializeFromSnapshot(stream.get());
|
||||||
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
||||||
|
|
||||||
@ -71,7 +73,7 @@ TEST(MinidumpUserStreamWriter, NoData) {
|
|||||||
|
|
||||||
TEST(MinidumpUserStreamWriter, OneStream) {
|
TEST(MinidumpUserStreamWriter, OneStream) {
|
||||||
MinidumpFileWriter minidump_file_writer;
|
MinidumpFileWriter minidump_file_writer;
|
||||||
auto user_stream_writer = make_scoped_ptr(new MinidumpUserStreamWriter());
|
auto user_stream_writer = base::WrapUnique(new MinidumpUserStreamWriter());
|
||||||
const uint32_t kTestStreamId = 0x123456;
|
const uint32_t kTestStreamId = 0x123456;
|
||||||
|
|
||||||
TestMemorySnapshot* test_data = new TestMemorySnapshot();
|
TestMemorySnapshot* test_data = new TestMemorySnapshot();
|
||||||
@ -80,7 +82,7 @@ TEST(MinidumpUserStreamWriter, OneStream) {
|
|||||||
test_data->SetSize(kStreamSize);
|
test_data->SetSize(kStreamSize);
|
||||||
test_data->SetValue('c');
|
test_data->SetValue('c');
|
||||||
auto stream =
|
auto stream =
|
||||||
make_scoped_ptr(new UserMinidumpStream(kTestStreamId, test_data));
|
base::WrapUnique(new UserMinidumpStream(kTestStreamId, test_data));
|
||||||
user_stream_writer->InitializeFromSnapshot(stream.get());
|
user_stream_writer->InitializeFromSnapshot(stream.get());
|
||||||
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
minidump_file_writer.AddStream(std::move(user_stream_writer));
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/memory_snapshot.h"
|
#include "snapshot/memory_snapshot.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -112,7 +112,7 @@ void CaptureMemory::PointedToByMemoryRange(const MemorySnapshot& memory,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<uint8_t[]> buffer(new uint8_t[memory.Size()]);
|
std::unique_ptr<uint8_t[]> buffer(new uint8_t[memory.Size()]);
|
||||||
if (!delegate->ReadMemory(memory.Address(), memory.Size(), buffer.get())) {
|
if (!delegate->ReadMemory(memory.Address(), memory.Size(), buffer.get())) {
|
||||||
LOG(ERROR) << "ReadMemory";
|
LOG(ERROR) << "ReadMemory";
|
||||||
return;
|
return;
|
||||||
|
@ -20,10 +20,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/mac/process_types.h"
|
#include "snapshot/mac/process_types.h"
|
||||||
#include "util/misc/initialization_state_dcheck.h"
|
#include "util/misc/initialization_state_dcheck.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
@ -326,16 +326,16 @@ class MachOImageReader {
|
|||||||
mach_vm_size_t size_;
|
mach_vm_size_t size_;
|
||||||
mach_vm_size_t slide_;
|
mach_vm_size_t slide_;
|
||||||
uint64_t source_version_;
|
uint64_t source_version_;
|
||||||
scoped_ptr<process_types::symtab_command> symtab_command_;
|
std::unique_ptr<process_types::symtab_command> symtab_command_;
|
||||||
scoped_ptr<process_types::dysymtab_command> dysymtab_command_;
|
std::unique_ptr<process_types::dysymtab_command> dysymtab_command_;
|
||||||
|
|
||||||
// symbol_table_ (and symbol_table_initialized_) are mutable in order to
|
// symbol_table_ (and symbol_table_initialized_) are mutable in order to
|
||||||
// maintain LookUpExternalDefinedSymbol() as a const interface while allowing
|
// maintain LookUpExternalDefinedSymbol() as a const interface while allowing
|
||||||
// lazy initialization via InitializeSymbolTable(). This is logical
|
// lazy initialization via InitializeSymbolTable(). This is logical
|
||||||
// const-ness, not physical const-ness.
|
// const-ness, not physical const-ness.
|
||||||
mutable scoped_ptr<MachOImageSymbolTableReader> symbol_table_;
|
mutable std::unique_ptr<MachOImageSymbolTableReader> symbol_table_;
|
||||||
|
|
||||||
scoped_ptr<process_types::dylib_command> id_dylib_command_;
|
std::unique_ptr<process_types::dylib_command> id_dylib_command_;
|
||||||
ProcessReader* process_reader_; // weak
|
ProcessReader* process_reader_; // weak
|
||||||
uint32_t file_type_;
|
uint32_t file_type_;
|
||||||
InitializationStateDcheck initialized_;
|
InitializationStateDcheck initialized_;
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#include <mach-o/nlist.h>
|
#include <mach-o/nlist.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "util/mac/checked_mach_address_range.h"
|
#include "util/mac/checked_mach_address_range.h"
|
||||||
#include "util/mach/task_memory.h"
|
#include "util/mach/task_memory.h"
|
||||||
@ -100,7 +100,7 @@ class MachOImageSymbolTableReaderInitializer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<process_types::nlist[]> symbols(
|
std::unique_ptr<process_types::nlist[]> symbols(
|
||||||
new process_types::nlist[symtab_command->nsyms]);
|
new process_types::nlist[symtab_command->nsyms]);
|
||||||
if (!process_types::nlist::ReadArrayInto(
|
if (!process_types::nlist::ReadArrayInto(
|
||||||
process_reader_, symtab_address, symbol_count, &symbols[0])) {
|
process_reader_, symtab_address, symbol_count, &symbols[0])) {
|
||||||
@ -108,7 +108,7 @@ class MachOImageSymbolTableReaderInitializer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<TaskMemory::MappedMemory> string_table;
|
std::unique_ptr<TaskMemory::MappedMemory> string_table;
|
||||||
for (size_t symbol_index = 0; symbol_index < symbol_count; ++symbol_index) {
|
for (size_t symbol_index = 0; symbol_index < symbol_count; ++symbol_index) {
|
||||||
const process_types::nlist& symbol = symbols[symbol_index];
|
const process_types::nlist& symbol = symbols[symbol_index];
|
||||||
std::string symbol_info = base::StringPrintf(", symbol index %zu%s",
|
std::string symbol_info = base::StringPrintf(", symbol index %zu%s",
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
|
|
||||||
#include "snapshot/mac/memory_snapshot_mac.h"
|
#include "snapshot/mac/memory_snapshot_mac.h"
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include <memory>
|
||||||
|
|
||||||
#include "util/mach/task_memory.h"
|
#include "util/mach/task_memory.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -58,7 +59,7 @@ bool MemorySnapshotMac::Read(Delegate* delegate) const {
|
|||||||
return delegate->MemorySnapshotDelegateRead(nullptr, size_);
|
return delegate->MemorySnapshotDelegateRead(nullptr, size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<uint8_t[]> buffer(new uint8_t[size_]);
|
std::unique_ptr<uint8_t[]> buffer(new uint8_t[size_]);
|
||||||
if (!process_reader_->Memory()->Read(address_, size_, buffer.get())) {
|
if (!process_reader_->Memory()->Read(address_, size_, buffer.get())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -429,7 +429,7 @@ void ProcessReader::InitializeModules() {
|
|||||||
// Proceed anyway with an empty module name.
|
// Proceed anyway with an empty module name.
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<MachOImageReader> reader(new MachOImageReader());
|
std::unique_ptr<MachOImageReader> reader(new MachOImageReader());
|
||||||
if (!reader->Initialize(this, image_info.imageLoadAddress, module.name)) {
|
if (!reader->Initialize(this, image_info.imageLoadAddress, module.name)) {
|
||||||
reader.reset();
|
reader.reset();
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ void ProcessReader::InitializeModules() {
|
|||||||
}
|
}
|
||||||
std::string module_name = !module.name.empty() ? module.name : "(dyld)";
|
std::string module_name = !module.name.empty() ? module.name : "(dyld)";
|
||||||
|
|
||||||
scoped_ptr<MachOImageReader> reader(new MachOImageReader());
|
std::unique_ptr<MachOImageReader> reader(new MachOImageReader());
|
||||||
if (!reader->Initialize(
|
if (!reader->Initialize(
|
||||||
this, all_image_infos.dyldImageLoadAddress, module_name)) {
|
this, all_image_infos.dyldImageLoadAddress, module_name)) {
|
||||||
reader.reset();
|
reader.reset();
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "util/mach/task_memory.h"
|
#include "util/mach/task_memory.h"
|
||||||
#include "util/misc/initialization_state_dcheck.h"
|
#include "util/misc/initialization_state_dcheck.h"
|
||||||
@ -220,7 +220,7 @@ class ProcessReader {
|
|||||||
std::vector<Thread> threads_; // owns send rights
|
std::vector<Thread> threads_; // owns send rights
|
||||||
std::vector<Module> modules_;
|
std::vector<Module> modules_;
|
||||||
PointerVector<MachOImageReader> module_readers_;
|
PointerVector<MachOImageReader> module_readers_;
|
||||||
scoped_ptr<TaskMemory> task_memory_;
|
std::unique_ptr<TaskMemory> task_memory_;
|
||||||
task_t task_; // weak
|
task_t task_; // weak
|
||||||
InitializationStateDcheck initialized_;
|
InitializationStateDcheck initialized_;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "snapshot/mac/process_snapshot_mac.h"
|
#include "snapshot/mac/process_snapshot_mac.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.h"
|
||||||
#include "util/misc/tri_state.h"
|
#include "util/misc/tri_state.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -220,7 +221,7 @@ void ProcessSnapshotMac::InitializeThreads() {
|
|||||||
process_reader_.Threads();
|
process_reader_.Threads();
|
||||||
for (const ProcessReader::Thread& process_reader_thread :
|
for (const ProcessReader::Thread& process_reader_thread :
|
||||||
process_reader_threads) {
|
process_reader_threads) {
|
||||||
auto thread = make_scoped_ptr(new internal::ThreadSnapshotMac());
|
auto thread = base::WrapUnique(new internal::ThreadSnapshotMac());
|
||||||
if (thread->Initialize(&process_reader_, process_reader_thread)) {
|
if (thread->Initialize(&process_reader_, process_reader_thread)) {
|
||||||
threads_.push_back(thread.release());
|
threads_.push_back(thread.release());
|
||||||
}
|
}
|
||||||
@ -232,7 +233,7 @@ void ProcessSnapshotMac::InitializeModules() {
|
|||||||
process_reader_.Modules();
|
process_reader_.Modules();
|
||||||
for (const ProcessReader::Module& process_reader_module :
|
for (const ProcessReader::Module& process_reader_module :
|
||||||
process_reader_modules) {
|
process_reader_modules) {
|
||||||
auto module = make_scoped_ptr(new internal::ModuleSnapshotMac());
|
auto module = base::WrapUnique(new internal::ModuleSnapshotMac());
|
||||||
if (module->Initialize(&process_reader_, process_reader_module)) {
|
if (module->Initialize(&process_reader_, process_reader_module)) {
|
||||||
modules_.push_back(module.release());
|
modules_.push_back(module.release());
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "client/crashpad_info.h"
|
#include "client/crashpad_info.h"
|
||||||
#include "snapshot/crashpad_info_client_options.h"
|
#include "snapshot/crashpad_info_client_options.h"
|
||||||
#include "snapshot/exception_snapshot.h"
|
#include "snapshot/exception_snapshot.h"
|
||||||
@ -143,7 +143,7 @@ class ProcessSnapshotMac final : public ProcessSnapshot {
|
|||||||
internal::SystemSnapshotMac system_;
|
internal::SystemSnapshotMac system_;
|
||||||
PointerVector<internal::ThreadSnapshotMac> threads_;
|
PointerVector<internal::ThreadSnapshotMac> threads_;
|
||||||
PointerVector<internal::ModuleSnapshotMac> modules_;
|
PointerVector<internal::ModuleSnapshotMac> modules_;
|
||||||
scoped_ptr<internal::ExceptionSnapshotMac> exception_;
|
std::unique_ptr<internal::ExceptionSnapshotMac> exception_;
|
||||||
ProcessReader process_reader_;
|
ProcessReader process_reader_;
|
||||||
UUID report_id_;
|
UUID report_id_;
|
||||||
UUID client_id_;
|
UUID client_id_;
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/mac/process_types/internal.h"
|
#include "snapshot/mac/process_types/internal.h"
|
||||||
#include "util/mach/task_memory.h"
|
#include "util/mach/task_memory.h"
|
||||||
|
|
||||||
@ -210,7 +211,7 @@ inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) {
|
|||||||
address, sizeof(struct_name<Traits>[count]), specific); \
|
address, sizeof(struct_name<Traits>[count]), specific); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
} /* namespace internal */ \
|
} /* namespace internal */ \
|
||||||
\
|
\
|
||||||
/* static */ \
|
/* static */ \
|
||||||
bool struct_name::ReadArrayInto(ProcessReader* process_reader, \
|
bool struct_name::ReadArrayInto(ProcessReader* process_reader, \
|
||||||
@ -235,7 +236,7 @@ inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) {
|
|||||||
mach_vm_address_t address, \
|
mach_vm_address_t address, \
|
||||||
size_t count, \
|
size_t count, \
|
||||||
struct_name* generic) { \
|
struct_name* generic) { \
|
||||||
scoped_ptr<T[]> specific(new T[count]); \
|
std::unique_ptr<T[]> specific(new T[count]); \
|
||||||
if (!T::ReadArrayInto(process_reader, address, count, &specific[0])) { \
|
if (!T::ReadArrayInto(process_reader, address, count, &specific[0])) { \
|
||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
@ -244,8 +245,8 @@ inline void Assign<uuid_t, uuid_t>(uuid_t* destination, const uuid_t& source) {
|
|||||||
} \
|
} \
|
||||||
return true; \
|
return true; \
|
||||||
} \
|
} \
|
||||||
} /* namespace process_types */ \
|
} /* namespace process_types */ \
|
||||||
} /* namespace crashpad */
|
} /* namespace crashpad */
|
||||||
|
|
||||||
#define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...)
|
#define PROCESS_TYPE_STRUCT_MEMBER(member_type, member_name, ...)
|
||||||
|
|
||||||
|
@ -14,11 +14,12 @@
|
|||||||
|
|
||||||
#include "snapshot/minidump/process_snapshot_minidump.h"
|
#include "snapshot/minidump/process_snapshot_minidump.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/ptr_util.h"
|
||||||
#include "util/file/file_io.h"
|
|
||||||
#include "snapshot/minidump/minidump_simple_string_dictionary_reader.h"
|
#include "snapshot/minidump/minidump_simple_string_dictionary_reader.h"
|
||||||
|
#include "util/file/file_io.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
@ -277,7 +278,7 @@ bool ProcessSnapshotMinidump::InitializeModules() {
|
|||||||
? &module_crashpad_info_it->second
|
? &module_crashpad_info_it->second
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
auto module = make_scoped_ptr(new internal::ModuleSnapshotMinidump());
|
auto module = base::WrapUnique(new internal::ModuleSnapshotMinidump());
|
||||||
if (!module->Initialize(
|
if (!module->Initialize(
|
||||||
file_reader_, module_rva, module_crashpad_info_location)) {
|
file_reader_, module_rva, module_crashpad_info_location)) {
|
||||||
return false;
|
return false;
|
||||||
@ -325,7 +326,7 @@ bool ProcessSnapshotMinidump::InitializeModulesCrashpadInfo(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<MinidumpModuleCrashpadInfoLink[]> minidump_links(
|
std::unique_ptr<MinidumpModuleCrashpadInfoLink[]> minidump_links(
|
||||||
new MinidumpModuleCrashpadInfoLink[crashpad_module_count]);
|
new MinidumpModuleCrashpadInfoLink[crashpad_module_count]);
|
||||||
if (!file_reader_->ReadExactly(
|
if (!file_reader_->ReadExactly(
|
||||||
&minidump_links[0],
|
&minidump_links[0],
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include <memory>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "util/file/string_file.h"
|
#include "util/file/string_file.h"
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "snapshot/memory_snapshot.h"
|
||||||
#include "util/misc/uuid.h"
|
#include "util/misc/uuid.h"
|
||||||
#include "util/numeric/checked_range.h"
|
#include "util/numeric/checked_range.h"
|
||||||
#include "snapshot/memory_snapshot.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class UserMinidumpStream {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//! \brief The memory representing the custom minidump stream.
|
//! \brief The memory representing the custom minidump stream.
|
||||||
scoped_ptr<MemorySnapshot> memory_;
|
std::unique_ptr<MemorySnapshot> memory_;
|
||||||
|
|
||||||
//! \brief The stream type that the minidump stream will be tagged with.
|
//! \brief The stream type that the minidump stream will be tagged with.
|
||||||
uint32_t stream_type_;
|
uint32_t stream_type_;
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/cpu_context.h"
|
#include "snapshot/cpu_context.h"
|
||||||
#include "snapshot/exception_snapshot.h"
|
#include "snapshot/exception_snapshot.h"
|
||||||
#include "util/stdlib/pointer_container.h"
|
#include "util/stdlib/pointer_container.h"
|
||||||
@ -59,7 +59,7 @@ class TestExceptionSnapshot final : public ExceptionSnapshot {
|
|||||||
exception_address_ = exception_address;
|
exception_address_ = exception_address;
|
||||||
}
|
}
|
||||||
void SetCodes(const std::vector<uint64_t>& codes) { codes_ = codes; }
|
void SetCodes(const std::vector<uint64_t>& codes) { codes_ = codes; }
|
||||||
void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) {
|
void AddExtraMemory(std::unique_ptr<MemorySnapshot> extra_memory) {
|
||||||
extra_memory_.push_back(extra_memory.release());
|
extra_memory_.push_back(extra_memory.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/exception_snapshot.h"
|
#include "snapshot/exception_snapshot.h"
|
||||||
#include "snapshot/memory_map_region_snapshot.h"
|
#include "snapshot/memory_map_region_snapshot.h"
|
||||||
#include "snapshot/memory_snapshot.h"
|
#include "snapshot/memory_snapshot.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(std::unique_ptr<SystemSnapshot> system) {
|
||||||
system_ = std::move(system);
|
system_ = std::move(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
|||||||
//!
|
//!
|
||||||
//! \param[in] thread The thread snapshot that will be included in Threads().
|
//! \param[in] thread The thread snapshot that will be included in Threads().
|
||||||
//! The TestProcessSnapshot object takes ownership of \a thread.
|
//! The TestProcessSnapshot object takes ownership of \a thread.
|
||||||
void AddThread(scoped_ptr<ThreadSnapshot> thread) {
|
void AddThread(std::unique_ptr<ThreadSnapshot> thread) {
|
||||||
threads_.push_back(thread.release());
|
threads_.push_back(thread.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
|||||||
//!
|
//!
|
||||||
//! \param[in] module The module snapshot that will be included in Modules().
|
//! \param[in] module The module snapshot that will be included in Modules().
|
||||||
//! The TestProcessSnapshot object takes ownership of \a module.
|
//! The TestProcessSnapshot object takes ownership of \a module.
|
||||||
void AddModule(scoped_ptr<ModuleSnapshot> module) {
|
void AddModule(std::unique_ptr<ModuleSnapshot> module) {
|
||||||
modules_.push_back(module.release());
|
modules_.push_back(module.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,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(std::unique_ptr<ExceptionSnapshot> exception) {
|
||||||
exception_ = std::move(exception);
|
exception_ = std::move(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
|||||||
//! \param[in] region The memory map region snapshot that will be included in
|
//! \param[in] region The memory map region snapshot that will be included in
|
||||||
//! MemoryMap(). The TestProcessSnapshot object takes ownership of \a
|
//! MemoryMap(). The TestProcessSnapshot object takes ownership of \a
|
||||||
//! region.
|
//! region.
|
||||||
void AddMemoryMapRegion(scoped_ptr<MemoryMapRegionSnapshot> region) {
|
void AddMemoryMapRegion(std::unique_ptr<MemoryMapRegionSnapshot> region) {
|
||||||
memory_map_.push_back(region.release());
|
memory_map_.push_back(region.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
|||||||
//! \param[in] extra_memory The memory snapshot that will be included in
|
//! \param[in] extra_memory The memory snapshot that will be included in
|
||||||
//! ExtraMemory(). The TestProcessSnapshot object takes ownership of \a
|
//! ExtraMemory(). The TestProcessSnapshot object takes ownership of \a
|
||||||
//! extra_memory.
|
//! extra_memory.
|
||||||
void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) {
|
void AddExtraMemory(std::unique_ptr<MemorySnapshot> extra_memory) {
|
||||||
extra_memory_.push_back(extra_memory.release());
|
extra_memory_.push_back(extra_memory.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,11 +165,11 @@ class TestProcessSnapshot final : public ProcessSnapshot {
|
|||||||
UUID report_id_;
|
UUID report_id_;
|
||||||
UUID client_id_;
|
UUID client_id_;
|
||||||
std::map<std::string, std::string> annotations_simple_map_;
|
std::map<std::string, std::string> annotations_simple_map_;
|
||||||
scoped_ptr<SystemSnapshot> system_;
|
std::unique_ptr<SystemSnapshot> system_;
|
||||||
PointerVector<ThreadSnapshot> threads_;
|
PointerVector<ThreadSnapshot> threads_;
|
||||||
PointerVector<ModuleSnapshot> modules_;
|
PointerVector<ModuleSnapshot> modules_;
|
||||||
std::vector<UnloadedModuleSnapshot> unloaded_modules_;
|
std::vector<UnloadedModuleSnapshot> unloaded_modules_;
|
||||||
scoped_ptr<ExceptionSnapshot> exception_;
|
std::unique_ptr<ExceptionSnapshot> exception_;
|
||||||
PointerVector<MemoryMapRegionSnapshot> memory_map_;
|
PointerVector<MemoryMapRegionSnapshot> memory_map_;
|
||||||
std::vector<HandleSnapshot> handles_;
|
std::vector<HandleSnapshot> handles_;
|
||||||
PointerVector<MemorySnapshot> extra_memory_;
|
PointerVector<MemorySnapshot> extra_memory_;
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#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"
|
||||||
@ -56,7 +56,9 @@ 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) { stack_ = std::move(stack); }
|
void SetStack(std::unique_ptr<MemorySnapshot> stack) {
|
||||||
|
stack_ = std::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; }
|
||||||
@ -70,7 +72,7 @@ class TestThreadSnapshot final : public ThreadSnapshot {
|
|||||||
//! \param[in] extra_memory The memory snapshot that will be included in
|
//! \param[in] extra_memory The memory snapshot that will be included in
|
||||||
//! ExtraMemory(). The TestThreadSnapshot object takes ownership of \a
|
//! ExtraMemory(). The TestThreadSnapshot object takes ownership of \a
|
||||||
//! extra_memory.
|
//! extra_memory.
|
||||||
void AddExtraMemory(scoped_ptr<MemorySnapshot> extra_memory) {
|
void AddExtraMemory(std::unique_ptr<MemorySnapshot> extra_memory) {
|
||||||
extra_memory_.push_back(extra_memory.release());
|
extra_memory_.push_back(extra_memory.release());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +92,7 @@ class TestThreadSnapshot final : public ThreadSnapshot {
|
|||||||
CPUContextX86_64 x86_64;
|
CPUContextX86_64 x86_64;
|
||||||
} context_union_;
|
} context_union_;
|
||||||
CPUContext context_;
|
CPUContext context_;
|
||||||
scoped_ptr<MemorySnapshot> stack_;
|
std::unique_ptr<MemorySnapshot> stack_;
|
||||||
uint64_t thread_id_;
|
uint64_t thread_id_;
|
||||||
int suspend_count_;
|
int suspend_count_;
|
||||||
int priority_;
|
int priority_;
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "snapshot/win/memory_snapshot_win.h"
|
#include "snapshot/win/memory_snapshot_win.h"
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -59,7 +60,7 @@ bool MemorySnapshotWin::Read(Delegate* delegate) const {
|
|||||||
return delegate->MemorySnapshotDelegateRead(nullptr, size_);
|
return delegate->MemorySnapshotDelegateRead(nullptr, size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<uint8_t[]> buffer(new uint8_t[size_]);
|
std::unique_ptr<uint8_t[]> buffer(new uint8_t[size_]);
|
||||||
if (!process_reader_->ReadMemory(address_, size_, buffer.get())) {
|
if (!process_reader_->ReadMemory(address_, size_, buffer.get())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ void ModuleSnapshotWin::GetCrashpadUserMinidumpStreams(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (list_entry.size != 0) {
|
if (list_entry.size != 0) {
|
||||||
scoped_ptr<internal::MemorySnapshotWin> memory(
|
std::unique_ptr<internal::MemorySnapshotWin> memory(
|
||||||
new internal::MemorySnapshotWin());
|
new internal::MemorySnapshotWin());
|
||||||
memory->Initialize(
|
memory->Initialize(
|
||||||
process_reader_, list_entry.base_address, list_entry.size);
|
process_reader_, list_entry.base_address, list_entry.size);
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "snapshot/crashpad_info_client_options.h"
|
#include "snapshot/crashpad_info_client_options.h"
|
||||||
#include "snapshot/module_snapshot.h"
|
#include "snapshot/module_snapshot.h"
|
||||||
#include "snapshot/win/process_reader_win.h"
|
#include "snapshot/win/process_reader_win.h"
|
||||||
@ -109,7 +109,7 @@ class ModuleSnapshotWin final : public ModuleSnapshot {
|
|||||||
std::wstring name_;
|
std::wstring name_;
|
||||||
std::string pdb_name_;
|
std::string pdb_name_;
|
||||||
UUID uuid_;
|
UUID uuid_;
|
||||||
scoped_ptr<PEImageReader> pe_image_reader_;
|
std::unique_ptr<PEImageReader> pe_image_reader_;
|
||||||
ProcessReaderWin* process_reader_; // weak
|
ProcessReaderWin* process_reader_; // weak
|
||||||
time_t timestamp_;
|
time_t timestamp_;
|
||||||
uint32_t age_;
|
uint32_t age_;
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "client/crashpad_info.h"
|
#include "client/crashpad_info.h"
|
||||||
#include "snapshot/win/pe_image_resource_reader.h"
|
#include "snapshot/win/pe_image_resource_reader.h"
|
||||||
#include "util/misc/pdb_structures.h"
|
#include "util/misc/pdb_structures.h"
|
||||||
@ -146,7 +147,7 @@ bool PEImageReader::DebugDirectoryInformation(UUID* uuid,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<char[]> data(new char[debug_directory.SizeOfData]);
|
std::unique_ptr<char[]> data(new char[debug_directory.SizeOfData]);
|
||||||
if (!module_subrange_reader_.ReadMemory(
|
if (!module_subrange_reader_.ReadMemory(
|
||||||
Address() + debug_directory.AddressOfRawData,
|
Address() + debug_directory.AddressOfRawData,
|
||||||
debug_directory.SizeOfData,
|
debug_directory.SizeOfData,
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#include "snapshot/win/pe_image_resource_reader.h"
|
#include "snapshot/win/pe_image_resource_reader.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ bool PEImageResourceReader::ReadResourceDirectory(
|
|||||||
|
|
||||||
// resource_directory is optional, but it’s still needed locally even if the
|
// resource_directory is optional, but it’s still needed locally even if the
|
||||||
// caller isn’t interested in it.
|
// caller isn’t interested in it.
|
||||||
scoped_ptr<IMAGE_RESOURCE_DIRECTORY> local_resource_directory;
|
std::unique_ptr<IMAGE_RESOURCE_DIRECTORY> local_resource_directory;
|
||||||
if (!resource_directory) {
|
if (!resource_directory) {
|
||||||
local_resource_directory.reset(new IMAGE_RESOURCE_DIRECTORY);
|
local_resource_directory.reset(new IMAGE_RESOURCE_DIRECTORY);
|
||||||
resource_directory = local_resource_directory.get();
|
resource_directory = local_resource_directory.get();
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <winternl.h>
|
#include <winternl.h>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include <memory>
|
||||||
|
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "util/win/capture_context.h"
|
#include "util/win/capture_context.h"
|
||||||
@ -54,7 +55,7 @@ process_types::SYSTEM_PROCESS_INFORMATION<Traits>* NextProcess(
|
|||||||
template <class Traits>
|
template <class Traits>
|
||||||
process_types::SYSTEM_PROCESS_INFORMATION<Traits>* GetProcessInformation(
|
process_types::SYSTEM_PROCESS_INFORMATION<Traits>* GetProcessInformation(
|
||||||
HANDLE process_handle,
|
HANDLE process_handle,
|
||||||
scoped_ptr<uint8_t[]>* buffer) {
|
std::unique_ptr<uint8_t[]>* buffer) {
|
||||||
ULONG buffer_size = 16384;
|
ULONG buffer_size = 16384;
|
||||||
buffer->reset(new uint8_t[buffer_size]);
|
buffer->reset(new uint8_t[buffer_size]);
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
@ -329,7 +330,7 @@ template <class Traits>
|
|||||||
void ProcessReaderWin::ReadThreadData(bool is_64_reading_32) {
|
void ProcessReaderWin::ReadThreadData(bool is_64_reading_32) {
|
||||||
DCHECK(threads_.empty());
|
DCHECK(threads_.empty());
|
||||||
|
|
||||||
scoped_ptr<uint8_t[]> buffer;
|
std::unique_ptr<uint8_t[]> buffer;
|
||||||
process_types::SYSTEM_PROCESS_INFORMATION<Traits>* process_information =
|
process_types::SYSTEM_PROCESS_INFORMATION<Traits>* process_information =
|
||||||
GetProcessInformation<Traits>(process_, &buffer);
|
GetProcessInformation<Traits>(process_, &buffer);
|
||||||
if (!process_information)
|
if (!process_information)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/ptr_util.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 "snapshot/win/memory_snapshot_win.h"
|
#include "snapshot/win/memory_snapshot_win.h"
|
||||||
@ -238,7 +239,7 @@ void ProcessSnapshotWin::InitializeThreads(
|
|||||||
process_reader_.Threads();
|
process_reader_.Threads();
|
||||||
for (const ProcessReaderWin::Thread& process_reader_thread :
|
for (const ProcessReaderWin::Thread& process_reader_thread :
|
||||||
process_reader_threads) {
|
process_reader_threads) {
|
||||||
auto thread = make_scoped_ptr(new internal::ThreadSnapshotWin());
|
auto thread = base::WrapUnique(new internal::ThreadSnapshotWin());
|
||||||
uint32_t* budget_remaining_pointer = nullptr;
|
uint32_t* budget_remaining_pointer = nullptr;
|
||||||
uint32_t budget_remaining = indirectly_referenced_memory_cap;
|
uint32_t budget_remaining = indirectly_referenced_memory_cap;
|
||||||
if (gather_indirectly_referenced_memory)
|
if (gather_indirectly_referenced_memory)
|
||||||
@ -256,7 +257,7 @@ void ProcessSnapshotWin::InitializeModules() {
|
|||||||
process_reader_.Modules();
|
process_reader_.Modules();
|
||||||
for (const ProcessInfo::Module& process_reader_module :
|
for (const ProcessInfo::Module& process_reader_module :
|
||||||
process_reader_modules) {
|
process_reader_modules) {
|
||||||
auto module = make_scoped_ptr(new internal::ModuleSnapshotWin());
|
auto module = base::WrapUnique(new internal::ModuleSnapshotWin());
|
||||||
if (module->Initialize(&process_reader_, process_reader_module)) {
|
if (module->Initialize(&process_reader_, process_reader_module)) {
|
||||||
modules_.push_back(module.release());
|
modules_.push_back(module.release());
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "client/crashpad_info.h"
|
#include "client/crashpad_info.h"
|
||||||
#include "snapshot/crashpad_info_client_options.h"
|
#include "snapshot/crashpad_info_client_options.h"
|
||||||
#include "snapshot/exception_snapshot.h"
|
#include "snapshot/exception_snapshot.h"
|
||||||
@ -190,7 +190,7 @@ class ProcessSnapshotWin final : public ProcessSnapshot {
|
|||||||
PointerVector<internal::ThreadSnapshotWin> threads_;
|
PointerVector<internal::ThreadSnapshotWin> threads_;
|
||||||
PointerVector<internal::ModuleSnapshotWin> modules_;
|
PointerVector<internal::ModuleSnapshotWin> modules_;
|
||||||
std::vector<UnloadedModuleSnapshot> unloaded_modules_;
|
std::vector<UnloadedModuleSnapshot> unloaded_modules_;
|
||||||
scoped_ptr<internal::ExceptionSnapshotWin> exception_;
|
std::unique_ptr<internal::ExceptionSnapshotWin> exception_;
|
||||||
PointerVector<internal::MemoryMapRegionSnapshotWin> memory_map_;
|
PointerVector<internal::MemoryMapRegionSnapshotWin> memory_map_;
|
||||||
ProcessReaderWin process_reader_;
|
ProcessReaderWin process_reader_;
|
||||||
UUID report_id_;
|
UUID report_id_;
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#include <bsm/libbsm.h>
|
#include <bsm/libbsm.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/scoped_mach_port.h"
|
#include "base/mac/scoped_mach_port.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "test/errors.h"
|
#include "test/errors.h"
|
||||||
#include "test/mac/mach_errors.h"
|
#include "test/mac/mach_errors.h"
|
||||||
@ -75,7 +75,7 @@ MachMultiprocess::MachMultiprocess() : Multiprocess(), info_(nullptr) {
|
|||||||
|
|
||||||
void MachMultiprocess::Run() {
|
void MachMultiprocess::Run() {
|
||||||
ASSERT_EQ(nullptr, info_);
|
ASSERT_EQ(nullptr, info_);
|
||||||
scoped_ptr<internal::MachMultiprocessInfo> info(
|
std::unique_ptr<internal::MachMultiprocessInfo> info(
|
||||||
new internal::MachMultiprocessInfo);
|
new internal::MachMultiprocessInfo);
|
||||||
base::AutoReset<internal::MachMultiprocessInfo*> reset_info(&info_,
|
base::AutoReset<internal::MachMultiprocessInfo*> reset_info(&info_,
|
||||||
info.get());
|
info.get());
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/auto_reset.h"
|
#include "base/auto_reset.h"
|
||||||
#include "base/files/scoped_file.h"
|
#include "base/files/scoped_file.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -61,7 +61,8 @@ Multiprocess::Multiprocess()
|
|||||||
|
|
||||||
void Multiprocess::Run() {
|
void Multiprocess::Run() {
|
||||||
ASSERT_EQ(nullptr, info_);
|
ASSERT_EQ(nullptr, info_);
|
||||||
scoped_ptr<internal::MultiprocessInfo> info(new internal::MultiprocessInfo);
|
std::unique_ptr<internal::MultiprocessInfo> info(
|
||||||
|
new internal::MultiprocessInfo);
|
||||||
base::AutoReset<internal::MultiprocessInfo*> reset_info(&info_, info.get());
|
base::AutoReset<internal::MultiprocessInfo*> reset_info(&info_, info.get());
|
||||||
|
|
||||||
ASSERT_NO_FATAL_FAILURE(PreFork());
|
ASSERT_NO_FATAL_FAILURE(PreFork());
|
||||||
|
@ -165,20 +165,20 @@ bool WinChildProcess::IsChildProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
std::unique_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
||||||
// Make pipes for child-to-parent and parent-to-child communication.
|
// Make pipes for child-to-parent and parent-to-child communication.
|
||||||
scoped_ptr<Handles> handles_for_parent(new Handles);
|
std::unique_ptr<Handles> handles_for_parent(new Handles);
|
||||||
ScopedFileHANDLE read_for_child;
|
ScopedFileHANDLE read_for_child;
|
||||||
ScopedFileHANDLE write_for_child;
|
ScopedFileHANDLE write_for_child;
|
||||||
|
|
||||||
if (!CreateInheritablePipe(
|
if (!CreateInheritablePipe(
|
||||||
&handles_for_parent->read, false, &write_for_child, true)) {
|
&handles_for_parent->read, false, &write_for_child, true)) {
|
||||||
return scoped_ptr<Handles>();
|
return std::unique_ptr<Handles>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CreateInheritablePipe(
|
if (!CreateInheritablePipe(
|
||||||
&read_for_child, true, &handles_for_parent->write, false)) {
|
&read_for_child, true, &handles_for_parent->write, false)) {
|
||||||
return scoped_ptr<Handles>();
|
return std::unique_ptr<Handles>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a command line for the child process that tells it only to run the
|
// Build a command line for the child process that tells it only to run the
|
||||||
@ -197,7 +197,7 @@ scoped_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
|||||||
// Command-line buffer cannot be constant, per CreateProcess signature.
|
// Command-line buffer cannot be constant, per CreateProcess signature.
|
||||||
handles_for_parent->process = LaunchCommandLine(&command_line[0]);
|
handles_for_parent->process = LaunchCommandLine(&command_line[0]);
|
||||||
if (!handles_for_parent->process.is_valid())
|
if (!handles_for_parent->process.is_valid())
|
||||||
return scoped_ptr<Handles>();
|
return std::unique_ptr<Handles>();
|
||||||
|
|
||||||
// Block until the child process has launched. CreateProcess() returns
|
// Block until the child process has launched. CreateProcess() returns
|
||||||
// immediately, and test code expects process initialization to have
|
// immediately, and test code expects process initialization to have
|
||||||
@ -205,12 +205,12 @@ scoped_ptr<WinChildProcess::Handles> WinChildProcess::Launch() {
|
|||||||
char c;
|
char c;
|
||||||
if (!LoggingReadFile(handles_for_parent->read.get(), &c, sizeof(c))) {
|
if (!LoggingReadFile(handles_for_parent->read.get(), &c, sizeof(c))) {
|
||||||
ADD_FAILURE() << "LoggedReadFile";
|
ADD_FAILURE() << "LoggedReadFile";
|
||||||
return scoped_ptr<Handles>();
|
return std::unique_ptr<Handles>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c != ' ') {
|
if (c != ' ') {
|
||||||
ADD_FAILURE() << "invalid data read from child";
|
ADD_FAILURE() << "invalid data read from child";
|
||||||
return scoped_ptr<Handles>();
|
return std::unique_ptr<Handles>();
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(handles_for_parent);
|
return std::move(handles_for_parent);
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
#ifndef CRASHPAD_TEST_WIN_WIN_CHILD_PROCESS_H_
|
#ifndef CRASHPAD_TEST_WIN_WIN_CHILD_PROCESS_H_
|
||||||
#define CRASHPAD_TEST_WIN_WIN_CHILD_PROCESS_H_
|
#define CRASHPAD_TEST_WIN_WIN_CHILD_PROCESS_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/win/scoped_handle.h"
|
#include "util/win/scoped_handle.h"
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ class WinChildProcess {
|
|||||||
//! \brief Launches a child process and returns the Handles for that process.
|
//! \brief Launches a child process and returns the Handles for that process.
|
||||||
//! The process is guaranteed to be executing by the time this method
|
//! The process is guaranteed to be executing by the time this method
|
||||||
//! returns. Returns null and logs a GTest failure in case of failure.
|
//! returns. Returns null and logs a GTest failure in case of failure.
|
||||||
static scoped_ptr<Handles> Launch();
|
static std::unique_ptr<Handles> Launch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \brief Returns a handle to read from an anonymous pipe shared with the
|
//! \brief Returns a handle to read from an anonymous pipe shared with the
|
||||||
|
@ -59,7 +59,7 @@ class TestWinChildProcess final : public WinChildProcess {
|
|||||||
TEST(WinChildProcessTest, WinChildProcess) {
|
TEST(WinChildProcessTest, WinChildProcess) {
|
||||||
WinChildProcess::EntryPoint<TestWinChildProcess>();
|
WinChildProcess::EntryPoint<TestWinChildProcess>();
|
||||||
|
|
||||||
scoped_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch();
|
std::unique_ptr<WinChildProcess::Handles> handles = WinChildProcess::Launch();
|
||||||
WriteInt(handles->write.get(), 1);
|
WriteInt(handles->write.get(), 1);
|
||||||
ASSERT_EQ(1, ReadInt(handles->read.get()));
|
ASSERT_EQ(1, ReadInt(handles->read.get()));
|
||||||
}
|
}
|
||||||
@ -67,9 +67,12 @@ TEST(WinChildProcessTest, WinChildProcess) {
|
|||||||
TEST(WinChildProcessTest, MultipleChildren) {
|
TEST(WinChildProcessTest, MultipleChildren) {
|
||||||
WinChildProcess::EntryPoint<TestWinChildProcess>();
|
WinChildProcess::EntryPoint<TestWinChildProcess>();
|
||||||
|
|
||||||
scoped_ptr<WinChildProcess::Handles> handles_1 = WinChildProcess::Launch();
|
std::unique_ptr<WinChildProcess::Handles> handles_1 =
|
||||||
scoped_ptr<WinChildProcess::Handles> handles_2 = WinChildProcess::Launch();
|
WinChildProcess::Launch();
|
||||||
scoped_ptr<WinChildProcess::Handles> handles_3 = WinChildProcess::Launch();
|
std::unique_ptr<WinChildProcess::Handles> handles_2 =
|
||||||
|
WinChildProcess::Launch();
|
||||||
|
std::unique_ptr<WinChildProcess::Handles> handles_3 =
|
||||||
|
WinChildProcess::Launch();
|
||||||
|
|
||||||
WriteInt(handles_1->write.get(), 1);
|
WriteInt(handles_1->write.get(), 1);
|
||||||
WriteInt(handles_2->write.get(), 2);
|
WriteInt(handles_2->write.get(), 2);
|
||||||
|
@ -43,7 +43,7 @@ class WinMultiprocess {
|
|||||||
ASSERT_NO_FATAL_FAILURE(
|
ASSERT_NO_FATAL_FAILURE(
|
||||||
WinChildProcess::EntryPoint<ChildProcessHelper<T>>());
|
WinChildProcess::EntryPoint<ChildProcessHelper<T>>());
|
||||||
// If WinChildProcess::EntryPoint returns, we are in the parent process.
|
// If WinChildProcess::EntryPoint returns, we are in the parent process.
|
||||||
scoped_ptr<WinChildProcess::Handles> child_handles =
|
std::unique_ptr<WinChildProcess::Handles> child_handles =
|
||||||
WinChildProcess::Launch();
|
WinChildProcess::Launch();
|
||||||
ASSERT_TRUE(child_handles.get());
|
ASSERT_TRUE(child_handles.get());
|
||||||
T parent_process;
|
T parent_process;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -28,7 +29,6 @@
|
|||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/numerics/safe_conversions.h"
|
#include "base/numerics/safe_conversions.h"
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@ -424,7 +424,7 @@ int DatabaseUtilMain(int argc, char* argv[]) {
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<CrashReportDatabase> database;
|
std::unique_ptr<CrashReportDatabase> database;
|
||||||
base::FilePath database_path = base::FilePath(
|
base::FilePath database_path = base::FilePath(
|
||||||
ToolSupport::CommandLineArgumentToFilePathStringType(options.database));
|
ToolSupport::CommandLineArgumentToFilePathStringType(options.database));
|
||||||
if (options.create) {
|
if (options.create) {
|
||||||
@ -541,14 +541,14 @@ int DatabaseUtilMain(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const base::FilePath new_report_path : options.new_report_paths) {
|
for (const base::FilePath new_report_path : options.new_report_paths) {
|
||||||
scoped_ptr<FileReaderInterface> file_reader;
|
std::unique_ptr<FileReaderInterface> file_reader;
|
||||||
|
|
||||||
bool is_stdin = false;
|
bool is_stdin = false;
|
||||||
if (new_report_path.value() == FILE_PATH_LITERAL("-")) {
|
if (new_report_path.value() == FILE_PATH_LITERAL("-")) {
|
||||||
is_stdin = true;
|
is_stdin = true;
|
||||||
file_reader.reset(new WeakStdioFileReader(stdin));
|
file_reader.reset(new WeakStdioFileReader(stdin));
|
||||||
} else {
|
} else {
|
||||||
scoped_ptr<FileReader> file_path_reader(new FileReader());
|
std::unique_ptr<FileReader> file_path_reader(new FileReader());
|
||||||
if (!file_path_reader->Open(new_report_path)) {
|
if (!file_path_reader->Open(new_report_path)) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/stringprintf.h"
|
#include "base/strings/stringprintf.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "minidump/minidump_file_writer.h"
|
#include "minidump/minidump_file_writer.h"
|
||||||
@ -165,12 +165,12 @@ int GenerateDumpMain(int argc, char* argv[]) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
scoped_ptr<ScopedTaskSuspend> suspend;
|
std::unique_ptr<ScopedTaskSuspend> suspend;
|
||||||
if (options.suspend) {
|
if (options.suspend) {
|
||||||
suspend.reset(new ScopedTaskSuspend(task));
|
suspend.reset(new ScopedTaskSuspend(task));
|
||||||
}
|
}
|
||||||
#elif defined(OS_WIN)
|
#elif defined(OS_WIN)
|
||||||
scoped_ptr<ScopedProcessSuspend> suspend;
|
std::unique_ptr<ScopedProcessSuspend> suspend;
|
||||||
if (options.suspend) {
|
if (options.suspend) {
|
||||||
suspend.reset(new ScopedProcessSuspend(process.get()));
|
suspend.reset(new ScopedProcessSuspend(process.get()));
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ void ToolSupport::UsageHint(const std::string& me, const char* hint) {
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
int ToolSupport::Wmain(int argc, wchar_t* argv[], int (*entry)(int, char* [])) {
|
int ToolSupport::Wmain(int argc, wchar_t* argv[], int (*entry)(int, char* [])) {
|
||||||
scoped_ptr<char* []> argv_as_utf8(new char* [argc + 1]);
|
std::unique_ptr<char* []> argv_as_utf8(new char*[argc + 1]);
|
||||||
std::vector<std::string> storage;
|
std::vector<std::string> storage;
|
||||||
storage.reserve(argc);
|
storage.reserve(argc);
|
||||||
for (int i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
|
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/mach/mach_extensions.h"
|
#include "util/mach/mach_extensions.h"
|
||||||
#include "util/mach/mach_message_server.h"
|
#include "util/mach/mach_message_server.h"
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ class UniversalMachExcServer final : public MachMessageServer::Interface {
|
|||||||
mach_msg_size_t MachMessageServerReplySize() override;
|
mach_msg_size_t MachMessageServerReplySize() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
scoped_ptr<internal::UniversalMachExcServerImpl> impl_;
|
std::unique_ptr<internal::UniversalMachExcServerImpl> impl_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer);
|
DISALLOW_COPY_AND_ASSIGN(UniversalMachExcServer);
|
||||||
};
|
};
|
||||||
|
@ -68,7 +68,7 @@ TaskMemory::TaskMemory(task_t task) : task_(task) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TaskMemory::Read(mach_vm_address_t address, size_t size, void* buffer) {
|
bool TaskMemory::Read(mach_vm_address_t address, size_t size, void* buffer) {
|
||||||
scoped_ptr<MappedMemory> memory = ReadMapped(address, size);
|
std::unique_ptr<MappedMemory> memory = ReadMapped(address, size);
|
||||||
if (!memory) {
|
if (!memory) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -77,10 +77,11 @@ bool TaskMemory::Read(mach_vm_address_t address, size_t size, void* buffer) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<TaskMemory::MappedMemory> TaskMemory::ReadMapped(
|
std::unique_ptr<TaskMemory::MappedMemory> TaskMemory::ReadMapped(
|
||||||
mach_vm_address_t address, size_t size) {
|
mach_vm_address_t address,
|
||||||
|
size_t size) {
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
return scoped_ptr<MappedMemory>(new MappedMemory(0, 0, 0, 0));
|
return std::unique_ptr<MappedMemory>(new MappedMemory(0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
mach_vm_address_t region_address = mach_vm_trunc_page(address);
|
mach_vm_address_t region_address = mach_vm_trunc_page(address);
|
||||||
@ -94,11 +95,11 @@ scoped_ptr<TaskMemory::MappedMemory> TaskMemory::ReadMapped(
|
|||||||
if (kr != KERN_SUCCESS) {
|
if (kr != KERN_SUCCESS) {
|
||||||
MACH_LOG(WARNING, kr) << base::StringPrintf(
|
MACH_LOG(WARNING, kr) << base::StringPrintf(
|
||||||
"mach_vm_read(0x%llx, 0x%llx)", region_address, region_size);
|
"mach_vm_read(0x%llx, 0x%llx)", region_address, region_size);
|
||||||
return scoped_ptr<MappedMemory>();
|
return std::unique_ptr<MappedMemory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK_EQ(region_count, region_size);
|
DCHECK_EQ(region_count, region_size);
|
||||||
return scoped_ptr<MappedMemory>(
|
return std::unique_ptr<MappedMemory>(
|
||||||
new MappedMemory(region, region_size, address - region_address, size));
|
new MappedMemory(region, region_size, address - region_address, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +131,7 @@ bool TaskMemory::ReadCStringInternal(mach_vm_address_t address,
|
|||||||
do {
|
do {
|
||||||
mach_vm_size_t read_length =
|
mach_vm_size_t read_length =
|
||||||
std::min(size, PAGE_SIZE - (read_address % PAGE_SIZE));
|
std::min(size, PAGE_SIZE - (read_address % PAGE_SIZE));
|
||||||
scoped_ptr<MappedMemory> read_region =
|
std::unique_ptr<MappedMemory> read_region =
|
||||||
ReadMapped(read_address, read_length);
|
ReadMapped(read_address, read_length);
|
||||||
if (!read_region) {
|
if (!read_region) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/mac/scoped_mach_vm.h"
|
#include "base/mac/scoped_mach_vm.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
|
|
||||||
@ -123,7 +123,8 @@ class TaskMemory {
|
|||||||
//! \return On success, a MappedMemory object that provides access to the data
|
//! \return On success, a MappedMemory object that provides access to the data
|
||||||
//! requested. On faliure, `nullptr`, with a warning logged. Failures can
|
//! requested. On faliure, `nullptr`, with a warning logged. Failures can
|
||||||
//! occur, for example, when encountering unmapped or unreadable pages.
|
//! occur, for example, when encountering unmapped or unreadable pages.
|
||||||
scoped_ptr<MappedMemory> ReadMapped(mach_vm_address_t address, size_t size);
|
std::unique_ptr<MappedMemory> ReadMapped(mach_vm_address_t address,
|
||||||
|
size_t size);
|
||||||
|
|
||||||
//! \brief Reads a `NUL`-terminated C string from the target task into a
|
//! \brief Reads a `NUL`-terminated C string from the target task into a
|
||||||
//! string in the current task.
|
//! string in the current task.
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/mac/scoped_mach_port.h"
|
#include "base/mac/scoped_mach_port.h"
|
||||||
#include "base/mac/scoped_mach_vm.h"
|
#include "base/mac/scoped_mach_vm.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "test/mac/mach_errors.h"
|
#include "test/mac/mach_errors.h"
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ TEST(TaskMemory, ReadSelf) {
|
|||||||
|
|
||||||
// This tests using both the Read() and ReadMapped() interfaces.
|
// This tests using both the Read() and ReadMapped() interfaces.
|
||||||
std::string result(kSize, '\0');
|
std::string result(kSize, '\0');
|
||||||
scoped_ptr<TaskMemory::MappedMemory> mapped;
|
std::unique_ptr<TaskMemory::MappedMemory> mapped;
|
||||||
|
|
||||||
// Ensure that the entire region can be read.
|
// Ensure that the entire region can be read.
|
||||||
ASSERT_TRUE(memory.Read(address, kSize, &result[0]));
|
ASSERT_TRUE(memory.Read(address, kSize, &result[0]));
|
||||||
@ -129,7 +129,7 @@ TEST(TaskMemory, ReadSelfUnmapped) {
|
|||||||
EXPECT_TRUE(memory.Read(address + PAGE_SIZE - 1, 1, &result[0]));
|
EXPECT_TRUE(memory.Read(address + PAGE_SIZE - 1, 1, &result[0]));
|
||||||
|
|
||||||
// Do the same thing with the ReadMapped() interface.
|
// Do the same thing with the ReadMapped() interface.
|
||||||
scoped_ptr<TaskMemory::MappedMemory> mapped;
|
std::unique_ptr<TaskMemory::MappedMemory> mapped;
|
||||||
EXPECT_FALSE((mapped = memory.ReadMapped(address, kSize)));
|
EXPECT_FALSE((mapped = memory.ReadMapped(address, kSize)));
|
||||||
EXPECT_FALSE((mapped = memory.ReadMapped(address + 1, kSize - 1)));
|
EXPECT_FALSE((mapped = memory.ReadMapped(address + 1, kSize - 1)));
|
||||||
EXPECT_FALSE((mapped = memory.ReadMapped(address + PAGE_SIZE, 1)));
|
EXPECT_FALSE((mapped = memory.ReadMapped(address + PAGE_SIZE, 1)));
|
||||||
@ -458,7 +458,7 @@ TEST(TaskMemory, MappedMemoryDeallocates) {
|
|||||||
// nothing else should wind up mapped in the address.
|
// nothing else should wind up mapped in the address.
|
||||||
|
|
||||||
TaskMemory memory(mach_task_self());
|
TaskMemory memory(mach_task_self());
|
||||||
scoped_ptr<TaskMemory::MappedMemory> mapped;
|
std::unique_ptr<TaskMemory::MappedMemory> mapped;
|
||||||
|
|
||||||
static const char kTestBuffer[] = "hello!";
|
static const char kTestBuffer[] = "hello!";
|
||||||
mach_vm_address_t test_address =
|
mach_vm_address_t test_address =
|
||||||
@ -476,7 +476,7 @@ TEST(TaskMemory, MappedMemoryDeallocates) {
|
|||||||
// single page. This makes sure that the whole mapped region winds up being
|
// single page. This makes sure that the whole mapped region winds up being
|
||||||
// deallocated.
|
// deallocated.
|
||||||
const size_t kBigSize = 4 * PAGE_SIZE;
|
const size_t kBigSize = 4 * PAGE_SIZE;
|
||||||
scoped_ptr<char[]> big_buffer(new char[kBigSize]);
|
std::unique_ptr<char[]> big_buffer(new char[kBigSize]);
|
||||||
test_address = reinterpret_cast<mach_vm_address_t>(&big_buffer[0]);
|
test_address = reinterpret_cast<mach_vm_address_t>(&big_buffer[0]);
|
||||||
ASSERT_TRUE((mapped = memory.ReadMapped(test_address, kBigSize)));
|
ASSERT_TRUE((mapped = memory.ReadMapped(test_address, kBigSize)));
|
||||||
|
|
||||||
@ -495,7 +495,7 @@ TEST(TaskMemory, MappedMemoryDeallocates) {
|
|||||||
TEST(TaskMemory, MappedMemoryReadCString) {
|
TEST(TaskMemory, MappedMemoryReadCString) {
|
||||||
// This tests the behavior of TaskMemory::MappedMemory::ReadCString().
|
// This tests the behavior of TaskMemory::MappedMemory::ReadCString().
|
||||||
TaskMemory memory(mach_task_self());
|
TaskMemory memory(mach_task_self());
|
||||||
scoped_ptr<TaskMemory::MappedMemory> mapped;
|
std::unique_ptr<TaskMemory::MappedMemory> mapped;
|
||||||
|
|
||||||
static const char kTestBuffer[] = "0\0" "2\0" "45\0" "789";
|
static const char kTestBuffer[] = "0\0" "2\0" "45\0" "789";
|
||||||
const mach_vm_address_t kTestAddress =
|
const mach_vm_address_t kTestAddress =
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include <memory>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "util/file/file_io.h"
|
#include "util/file/file_io.h"
|
||||||
#include "util/net/http_body.h"
|
#include "util/net/http_body.h"
|
||||||
@ -29,7 +30,7 @@ std::string ReadStreamToString(HTTPBodyStream* stream) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string ReadStreamToString(HTTPBodyStream* stream, size_t buffer_size) {
|
std::string ReadStreamToString(HTTPBodyStream* stream, size_t buffer_size) {
|
||||||
scoped_ptr<uint8_t[]> buf(new uint8_t[buffer_size]);
|
std::unique_ptr<uint8_t[]> buf(new uint8_t[buffer_size]);
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
FileOperationResult bytes_read;
|
FileOperationResult bytes_read;
|
||||||
|
@ -149,7 +149,7 @@ void HTTPMultipartBuilder::SetFileAttachment(
|
|||||||
file_attachments_[key] = attachment;
|
file_attachments_[key] = attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
scoped_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() {
|
std::unique_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() {
|
||||||
// The objects inserted into this vector will be owned by the returned
|
// The objects inserted into this vector will be owned by the returned
|
||||||
// CompositeHTTPBodyStream. Take care to not early-return without deleting
|
// CompositeHTTPBodyStream. Take care to not early-return without deleting
|
||||||
// this memory.
|
// this memory.
|
||||||
@ -179,7 +179,7 @@ scoped_ptr<HTTPBodyStream> HTTPMultipartBuilder::GetBodyStream() {
|
|||||||
streams.push_back(
|
streams.push_back(
|
||||||
new StringHTTPBodyStream("--" + boundary_ + "--" + kCRLF));
|
new StringHTTPBodyStream("--" + boundary_ + "--" + kCRLF));
|
||||||
|
|
||||||
return scoped_ptr<HTTPBodyStream>(new CompositeHTTPBodyStream(streams));
|
return std::unique_ptr<HTTPBodyStream>(new CompositeHTTPBodyStream(streams));
|
||||||
}
|
}
|
||||||
|
|
||||||
HTTPHeaders::value_type HTTPMultipartBuilder::GetContentType() const {
|
HTTPHeaders::value_type HTTPMultipartBuilder::GetContentType() const {
|
||||||
|
@ -16,11 +16,11 @@
|
|||||||
#define CRASHPAD_UTIL_NET_HTTP_MULTIPART_BUILDER_H_
|
#define CRASHPAD_UTIL_NET_HTTP_MULTIPART_BUILDER_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/net/http_headers.h"
|
#include "util/net/http_headers.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -62,7 +62,7 @@ class HTTPMultipartBuilder {
|
|||||||
//! the builder.
|
//! the builder.
|
||||||
//!
|
//!
|
||||||
//! \return A caller-owned HTTPBodyStream object.
|
//! \return A caller-owned HTTPBodyStream object.
|
||||||
scoped_ptr<HTTPBodyStream> GetBodyStream();
|
std::unique_ptr<HTTPBodyStream> GetBodyStream();
|
||||||
|
|
||||||
//! \brief Gets the header pair for `"Content-Type"`.
|
//! \brief Gets the header pair for `"Content-Type"`.
|
||||||
HTTPHeaders::value_type GetContentType() const;
|
HTTPHeaders::value_type GetContentType() const;
|
||||||
|
@ -67,7 +67,7 @@ TEST(HTTPMultipartBuilder, ThreeStringFields) {
|
|||||||
const char kValue3[] = "More tests";
|
const char kValue3[] = "More tests";
|
||||||
builder.SetFormData(kKey3, kValue3);
|
builder.SetFormData(kKey3, kValue3);
|
||||||
|
|
||||||
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
std::unique_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
||||||
ASSERT_TRUE(body.get());
|
ASSERT_TRUE(body.get());
|
||||||
std::string contents = ReadStreamToString(body.get());
|
std::string contents = ReadStreamToString(body.get());
|
||||||
auto lines = SplitCRLF(contents);
|
auto lines = SplitCRLF(contents);
|
||||||
@ -116,7 +116,7 @@ TEST(HTTPMultipartBuilder, ThreeFileAttachments) {
|
|||||||
|
|
||||||
const char kFileContents[] = "This is a test.\n";
|
const char kFileContents[] = "This is a test.\n";
|
||||||
|
|
||||||
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
std::unique_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
||||||
ASSERT_TRUE(body.get());
|
ASSERT_TRUE(body.get());
|
||||||
std::string contents = ReadStreamToString(body.get());
|
std::string contents = ReadStreamToString(body.get());
|
||||||
auto lines = SplitCRLF(contents);
|
auto lines = SplitCRLF(contents);
|
||||||
@ -160,7 +160,7 @@ TEST(HTTPMultipartBuilder, OverwriteFormDataWithEscapedKey) {
|
|||||||
const char kKey[] = "a 100% \"silly\"\r\ntest";
|
const char kKey[] = "a 100% \"silly\"\r\ntest";
|
||||||
builder.SetFormData(kKey, "some dummy value");
|
builder.SetFormData(kKey, "some dummy value");
|
||||||
builder.SetFormData(kKey, "overwrite");
|
builder.SetFormData(kKey, "overwrite");
|
||||||
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
std::unique_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
||||||
ASSERT_TRUE(body.get());
|
ASSERT_TRUE(body.get());
|
||||||
std::string contents = ReadStreamToString(body.get());
|
std::string contents = ReadStreamToString(body.get());
|
||||||
auto lines = SplitCRLF(contents);
|
auto lines = SplitCRLF(contents);
|
||||||
@ -200,7 +200,7 @@ TEST(HTTPMultipartBuilder, OverwriteFileAttachment) {
|
|||||||
testdata_path.Append(FILE_PATH_LITERAL(
|
testdata_path.Append(FILE_PATH_LITERAL(
|
||||||
"ascii_http_body.txt")),
|
"ascii_http_body.txt")),
|
||||||
"text/plain");
|
"text/plain");
|
||||||
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
std::unique_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
||||||
ASSERT_TRUE(body.get());
|
ASSERT_TRUE(body.get());
|
||||||
std::string contents = ReadStreamToString(body.get());
|
std::string contents = ReadStreamToString(body.get());
|
||||||
auto lines = SplitCRLF(contents);
|
auto lines = SplitCRLF(contents);
|
||||||
@ -249,7 +249,7 @@ TEST(HTTPMultipartBuilder, SharedFormDataAndAttachmentKeyNamespace) {
|
|||||||
const char kValue2[] = "this is not a file";
|
const char kValue2[] = "this is not a file";
|
||||||
builder.SetFormData("minidump", kValue2);
|
builder.SetFormData("minidump", kValue2);
|
||||||
|
|
||||||
scoped_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
std::unique_ptr<HTTPBodyStream> body(builder.GetBodyStream());
|
||||||
ASSERT_TRUE(body.get());
|
ASSERT_TRUE(body.get());
|
||||||
std::string contents = ReadStreamToString(body.get());
|
std::string contents = ReadStreamToString(body.get());
|
||||||
auto lines = SplitCRLF(contents);
|
auto lines = SplitCRLF(contents);
|
||||||
|
@ -44,7 +44,7 @@ void HTTPTransport::SetHeader(const std::string& header,
|
|||||||
headers_[header] = value;
|
headers_[header] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTTPTransport::SetBodyStream(scoped_ptr<HTTPBodyStream> stream) {
|
void HTTPTransport::SetBodyStream(std::unique_ptr<HTTPBodyStream> stream) {
|
||||||
body_stream_ = std::move(stream);
|
body_stream_ = std::move(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
#ifndef CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_
|
#ifndef CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_
|
||||||
#define CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_
|
#define CRASHPAD_UTIL_NET_HTTP_TRANSPORT_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "util/net/http_headers.h"
|
#include "util/net/http_headers.h"
|
||||||
|
|
||||||
namespace crashpad {
|
namespace crashpad {
|
||||||
@ -40,7 +40,7 @@ class HTTPTransport {
|
|||||||
//! operating system.
|
//! operating system.
|
||||||
//!
|
//!
|
||||||
//! \return A new caller-owned HTTPTransport object.
|
//! \return A new caller-owned HTTPTransport object.
|
||||||
static scoped_ptr<HTTPTransport> Create();
|
static std::unique_ptr<HTTPTransport> Create();
|
||||||
|
|
||||||
//! \brief Sets URL to which the request will be made.
|
//! \brief Sets URL to which the request will be made.
|
||||||
//!
|
//!
|
||||||
@ -64,7 +64,7 @@ class HTTPTransport {
|
|||||||
//!
|
//!
|
||||||
//! \param[in] stream A HTTPBodyStream, of which this class will take
|
//! \param[in] stream A HTTPBodyStream, of which this class will take
|
||||||
//! ownership.
|
//! ownership.
|
||||||
void SetBodyStream(scoped_ptr<HTTPBodyStream> stream);
|
void SetBodyStream(std::unique_ptr<HTTPBodyStream> stream);
|
||||||
|
|
||||||
//! \brief Sets the timeout for the HTTP request. The default is 15 seconds.
|
//! \brief Sets the timeout for the HTTP request. The default is 15 seconds.
|
||||||
//!
|
//!
|
||||||
@ -95,7 +95,7 @@ class HTTPTransport {
|
|||||||
std::string url_;
|
std::string url_;
|
||||||
std::string method_;
|
std::string method_;
|
||||||
HTTPHeaders headers_;
|
HTTPHeaders headers_;
|
||||||
scoped_ptr<HTTPBodyStream> body_stream_;
|
std::unique_ptr<HTTPBodyStream> body_stream_;
|
||||||
double timeout_;
|
double timeout_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(HTTPTransport);
|
DISALLOW_COPY_AND_ASSIGN(HTTPTransport);
|
||||||
|
@ -227,8 +227,8 @@ bool HTTPTransportMac::ExecuteSynchronously(std::string* response_body) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<HTTPTransport> HTTPTransport::Create() {
|
std::unique_ptr<HTTPTransport> HTTPTransport::Create() {
|
||||||
return scoped_ptr<HTTPTransport>(new HTTPTransportMac());
|
return std::unique_ptr<HTTPTransport>(new HTTPTransportMac());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
@ -19,13 +19,13 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/format_macros.h"
|
#include "base/format_macros.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.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 "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
@ -48,7 +48,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
|||||||
void(*)(HTTPTransportTestFixture*, const std::string&);
|
void(*)(HTTPTransportTestFixture*, const std::string&);
|
||||||
|
|
||||||
HTTPTransportTestFixture(const HTTPHeaders& headers,
|
HTTPTransportTestFixture(const HTTPHeaders& headers,
|
||||||
scoped_ptr<HTTPBodyStream> body_stream,
|
std::unique_ptr<HTTPBodyStream> body_stream,
|
||||||
uint16_t http_response_code,
|
uint16_t http_response_code,
|
||||||
RequestValidator request_validator)
|
RequestValidator request_validator)
|
||||||
: MultiprocessExec(),
|
: MultiprocessExec(),
|
||||||
@ -98,7 +98,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
|||||||
random_string.size()));
|
random_string.size()));
|
||||||
|
|
||||||
// Now execute the HTTP request.
|
// Now execute the HTTP request.
|
||||||
scoped_ptr<HTTPTransport> transport(HTTPTransport::Create());
|
std::unique_ptr<HTTPTransport> transport(HTTPTransport::Create());
|
||||||
transport->SetMethod("POST");
|
transport->SetMethod("POST");
|
||||||
transport->SetURL(base::StringPrintf("http://127.0.0.1:%d/upload", port));
|
transport->SetURL(base::StringPrintf("http://127.0.0.1:%d/upload", port));
|
||||||
for (const auto& pair : headers_) {
|
for (const auto& pair : headers_) {
|
||||||
@ -131,7 +131,7 @@ class HTTPTransportTestFixture : public MultiprocessExec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HTTPHeaders headers_;
|
HTTPHeaders headers_;
|
||||||
scoped_ptr<HTTPBodyStream> body_stream_;
|
std::unique_ptr<HTTPBodyStream> body_stream_;
|
||||||
uint16_t response_code_;
|
uint16_t response_code_;
|
||||||
RequestValidator request_validator_;
|
RequestValidator request_validator_;
|
||||||
};
|
};
|
||||||
@ -266,7 +266,8 @@ void UnchunkedPlainText(HTTPTransportTestFixture* fixture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(HTTPTransport, UnchunkedPlainText) {
|
TEST(HTTPTransport, UnchunkedPlainText) {
|
||||||
scoped_ptr<HTTPBodyStream> body_stream(new StringHTTPBodyStream(kTextBody));
|
std::unique_ptr<HTTPBodyStream> body_stream(
|
||||||
|
new StringHTTPBodyStream(kTextBody));
|
||||||
|
|
||||||
HTTPHeaders headers;
|
HTTPHeaders headers;
|
||||||
headers[kContentType] = kTextPlain;
|
headers[kContentType] = kTextPlain;
|
||||||
@ -284,7 +285,7 @@ void RunUpload33k(bool has_content_length) {
|
|||||||
// Read().
|
// Read().
|
||||||
|
|
||||||
std::string request_string(33 * 1024, 'a');
|
std::string request_string(33 * 1024, 'a');
|
||||||
scoped_ptr<HTTPBodyStream> body_stream(
|
std::unique_ptr<HTTPBodyStream> body_stream(
|
||||||
new StringHTTPBodyStream(request_string));
|
new StringHTTPBodyStream(request_string));
|
||||||
|
|
||||||
HTTPHeaders headers;
|
HTTPHeaders headers;
|
||||||
|
@ -245,8 +245,8 @@ bool HTTPTransportWin::ExecuteSynchronously(std::string* response_body) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
scoped_ptr<HTTPTransport> HTTPTransport::Create() {
|
std::unique_ptr<HTTPTransport> HTTPTransport::Create() {
|
||||||
return scoped_ptr<HTTPTransportWin>(new HTTPTransportWin);
|
return std::unique_ptr<HTTPTransportWin>(new HTTPTransportWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace crashpad
|
} // namespace crashpad
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/scoped_ptr.h"
|
|
||||||
#include "base/posix/eintr_wrapper.h"
|
#include "base/posix/eintr_wrapper.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "util/misc/implicit_cast.h"
|
#include "util/misc/implicit_cast.h"
|
||||||
@ -73,7 +73,7 @@ struct ScopedDIRCloser {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
using ScopedDIR = scoped_ptr<DIR, ScopedDIRCloser>;
|
using ScopedDIR = std::unique_ptr<DIR, ScopedDIRCloser>;
|
||||||
|
|
||||||
// This function implements CloseMultipleNowOrOnExec() using an operating
|
// This function implements CloseMultipleNowOrOnExec() using an operating
|
||||||
// system-specific FD directory to determine which file descriptors are open.
|
// system-specific FD directory to determine which file descriptors are open.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user