Modernize code

- Replace DISALLOW_COPY_AND_ASSIGN with =delete.
- Replace some NULLs with nullptrs;
- Use the override keyword when appropriate.
- Use =default when appropriate.

Change-Id: I99e1d7f349dd4c32aa5d05e2ebdce7a86e47f551
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4527718
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
Lei Zhang 2023-05-12 11:13:43 -07:00
parent 463ae7cd60
commit 5850e262b1
8 changed files with 119 additions and 126 deletions

View file

@ -49,9 +49,11 @@ namespace {
class CrashGenerationClientImpl : public CrashGenerationClient { class CrashGenerationClientImpl : public CrashGenerationClient {
public: public:
explicit CrashGenerationClientImpl(int server_fd) : server_fd_(server_fd) {} explicit CrashGenerationClientImpl(int server_fd) : server_fd_(server_fd) {}
virtual ~CrashGenerationClientImpl() {} CrashGenerationClientImpl(const CrashGenerationClientImpl&) = delete;
void operator=(const CrashGenerationClientImpl&) = delete;
~CrashGenerationClientImpl() override = default;
virtual bool RequestDump(const void* blob, size_t blob_size) { bool RequestDump(const void* blob, size_t blob_size) override {
int fds[2]; int fds[2];
if (sys_pipe(fds) < 0) if (sys_pipe(fds) < 0)
return false; return false;
@ -92,8 +94,6 @@ class CrashGenerationClientImpl : public CrashGenerationClient {
private: private:
int server_fd_; int server_fd_;
DISALLOW_COPY_AND_ASSIGN(CrashGenerationClientImpl);
}; };
} // namespace } // namespace

View file

@ -29,8 +29,6 @@
#ifndef CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_ #ifndef CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
#define CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_ #define CLIENT_LINUX_CRASH_GENERATION_CRASH_GENERATION_CLIENT_H_
#include "common/basictypes.h"
#include <stddef.h> #include <stddef.h>
namespace google_breakpad { namespace google_breakpad {
@ -41,8 +39,10 @@ namespace google_breakpad {
// via a remote process. // via a remote process.
class CrashGenerationClient { class CrashGenerationClient {
public: public:
CrashGenerationClient() {} CrashGenerationClient() = default;
virtual ~CrashGenerationClient() {} CrashGenerationClient(const CrashGenerationClient&) = delete;
void operator=(const CrashGenerationClient&) = delete;
virtual ~CrashGenerationClient() = default;
// Request the crash server to generate a dump. |blob| is an opaque // Request the crash server to generate a dump. |blob| is an opaque
// CrashContext pointer from exception_handler.h. // CrashContext pointer from exception_handler.h.
@ -54,9 +54,6 @@ class CrashGenerationClient {
// The returned CrashGenerationClient* is owned by the caller of // The returned CrashGenerationClient* is owned by the caller of
// this function. // this function.
static CrashGenerationClient* TryCreate(int server_fd); static CrashGenerationClient* TryCreate(int server_fd);
private:
DISALLOW_COPY_AND_ASSIGN(CrashGenerationClient);
}; };
} // namespace google_breakpad } // namespace google_breakpad

View file

@ -29,14 +29,6 @@
#ifndef COMMON_BASICTYPES_H_ #ifndef COMMON_BASICTYPES_H_
#define COMMON_BASICTYPES_H_ #define COMMON_BASICTYPES_H_
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#ifndef DISALLOW_COPY_AND_ASSIGN
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif // DISALLOW_COPY_AND_ASSIGN
namespace google_breakpad { namespace google_breakpad {
// Used to explicitly mark the return value of a function as unused. If you are // Used to explicitly mark the return value of a function as unused. If you are

View file

@ -33,7 +33,7 @@
#define COMMON_LINUX_MEMORY_MAPPED_FILE_H_ #define COMMON_LINUX_MEMORY_MAPPED_FILE_H_
#include <stddef.h> #include <stddef.h>
#include "common/basictypes.h"
#include "common/memory_range.h" #include "common/memory_range.h"
namespace google_breakpad { namespace google_breakpad {
@ -49,6 +49,9 @@ class MemoryMappedFile {
// If Map() fails, the object behaves as if it is default constructed. // If Map() fails, the object behaves as if it is default constructed.
MemoryMappedFile(const char* path, size_t offset); MemoryMappedFile(const char* path, size_t offset);
MemoryMappedFile(const MemoryMappedFile&) = delete;
void operator=(const MemoryMappedFile&) = delete;
~MemoryMappedFile(); ~MemoryMappedFile();
// Maps a file at |path| into memory, which can then be accessed via // Maps a file at |path| into memory, which can then be accessed via
@ -77,8 +80,6 @@ class MemoryMappedFile {
private: private:
// Mapped file content as a MemoryRange object. // Mapped file content as a MemoryRange object.
MemoryRange content_; MemoryRange content_;
DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile);
}; };
} // namespace google_breakpad } // namespace google_breakpad

View file

@ -32,8 +32,6 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
#include "common/basictypes.h"
namespace google_breakpad { namespace google_breakpad {
// Opaque type for the serialized representation of a NonAllocatingMap. One is // Opaque type for the serialized representation of a NonAllocatingMap. One is
@ -80,6 +78,8 @@ class NonAllocatingMap {
: map_(map), : map_(map),
current_(0) { current_(0) {
} }
Iterator(const Iterator&) = delete;
void operator=(const Iterator&) = delete;
// Returns the next entry in the map, or NULL if at the end of the // Returns the next entry in the map, or NULL if at the end of the
// collection. // collection.
@ -90,14 +90,12 @@ class NonAllocatingMap {
return entry; return entry;
} }
} }
return NULL; return nullptr;
} }
private: private:
const NonAllocatingMap& map_; const NonAllocatingMap& map_;
size_t current_; size_t current_;
DISALLOW_COPY_AND_ASSIGN(Iterator);
}; };
NonAllocatingMap() : entries_() { NonAllocatingMap() : entries_() {

View file

@ -31,7 +31,6 @@
#include <string> #include <string>
#include "common/basictypes.h"
#include "common/windows/module_info.h" #include "common/windows/module_info.h"
namespace google_breakpad { namespace google_breakpad {
@ -44,6 +43,8 @@ using std::wstring;
class PESourceLineWriter { class PESourceLineWriter {
public: public:
explicit PESourceLineWriter(const wstring& pe_file); explicit PESourceLineWriter(const wstring& pe_file);
PESourceLineWriter(const PESourceLineWriter&) = delete;
void operator=(const PESourceLineWriter&) = delete;
~PESourceLineWriter(); ~PESourceLineWriter();
// Writes Breakpad symbols from the pe file to |symbol_file|. // Writes Breakpad symbols from the pe file to |symbol_file|.
@ -58,9 +59,7 @@ public:
bool GetPEInfo(PEModuleInfo* info); bool GetPEInfo(PEModuleInfo* info);
private: private:
const wstring pe_file_; const wstring pe_file_;
DISALLOW_COPY_AND_ASSIGN(PESourceLineWriter);
}; };
} // namespace google_breakpad } // namespace google_breakpad

View file

@ -89,7 +89,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "common/basictypes.h"
#include "common/using_std_string.h" #include "common/using_std_string.h"
#include "google_breakpad/processor/code_module.h" #include "google_breakpad/processor/code_module.h"
#include "google_breakpad/processor/code_modules.h" #include "google_breakpad/processor/code_modules.h"
@ -114,7 +113,7 @@ template<typename AddressType, typename EntryType> class RangeMap;
// itself. // itself.
class MinidumpObject : public DumpObject { class MinidumpObject : public DumpObject {
public: public:
virtual ~MinidumpObject() {} virtual ~MinidumpObject() = default;
protected: protected:
explicit MinidumpObject(Minidump* minidump); explicit MinidumpObject(Minidump* minidump);
@ -136,7 +135,9 @@ class MinidumpObject : public DumpObject {
// same interface, and may be derived from this class. // same interface, and may be derived from this class.
class MinidumpStream : public MinidumpObject { class MinidumpStream : public MinidumpObject {
public: public:
virtual ~MinidumpStream() {} MinidumpStream(const MinidumpStream&) = delete;
void operator=(const MinidumpStream&) = delete;
~MinidumpStream() override = default;
protected: protected:
explicit MinidumpStream(Minidump* minidump); explicit MinidumpStream(Minidump* minidump);
@ -150,8 +151,6 @@ class MinidumpStream : public MinidumpObject {
// that implements MinidumpStream can compare expected_size to a // that implements MinidumpStream can compare expected_size to a
// known size as an integrity check. // known size as an integrity check.
virtual bool Read(uint32_t expected_size) = 0; virtual bool Read(uint32_t expected_size) = 0;
DISALLOW_COPY_AND_ASSIGN(MinidumpStream);
}; };
@ -167,7 +166,9 @@ class MinidumpStream : public MinidumpObject {
// user wants). // user wants).
class MinidumpContext : public DumpContext { class MinidumpContext : public DumpContext {
public: public:
virtual ~MinidumpContext(); MinidumpContext(const MinidumpContext&) = delete;
void operator=(const MinidumpContext&) = delete;
~MinidumpContext() override;
protected: protected:
explicit MinidumpContext(Minidump* minidump); explicit MinidumpContext(Minidump* minidump);
@ -192,8 +193,6 @@ class MinidumpContext : public DumpContext {
// for access to data about the minidump file itself, such as whether // for access to data about the minidump file itself, such as whether
// it should be byte-swapped. // it should be byte-swapped.
Minidump* minidump_; Minidump* minidump_;
DISALLOW_COPY_AND_ASSIGN(MinidumpContext);
}; };
@ -208,7 +207,7 @@ class MinidumpContext : public DumpContext {
class MinidumpMemoryRegion : public MinidumpObject, class MinidumpMemoryRegion : public MinidumpObject,
public MemoryRegion { public MemoryRegion {
public: public:
virtual ~MinidumpMemoryRegion(); ~MinidumpMemoryRegion() override;
static void set_max_bytes(uint32_t max_bytes) { max_bytes_ = max_bytes; } static void set_max_bytes(uint32_t max_bytes) { max_bytes_ = max_bytes; }
static uint32_t max_bytes() { return max_bytes_; } static uint32_t max_bytes() { return max_bytes_; }
@ -219,22 +218,22 @@ class MinidumpMemoryRegion : public MinidumpObject,
const uint8_t* GetMemory() const; const uint8_t* GetMemory() const;
// The address of the base of the memory region. // The address of the base of the memory region.
uint64_t GetBase() const; uint64_t GetBase() const override;
// The size, in bytes, of the memory region. // The size, in bytes, of the memory region.
uint32_t GetSize() const; uint32_t GetSize() const override;
// Frees the cached memory region, if cached. // Frees the cached memory region, if cached.
void FreeMemory(); void FreeMemory();
// Obtains the value of memory at the pointer specified by address. // Obtains the value of memory at the pointer specified by address.
bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const; bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const override;
bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const; bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const override;
bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const; bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const override;
bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const; bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const override;
// Print a human-readable representation of the object to stdout. // Print a human-readable representation of the object to stdout.
void Print() const; void Print() const override;
void SetPrintMode(bool hexdump, unsigned int width); void SetPrintMode(bool hexdump, unsigned int width);
protected: protected:
@ -277,9 +276,9 @@ class MinidumpMemoryRegion : public MinidumpObject,
// contain a memory region or context. // contain a memory region or context.
class MinidumpThread : public MinidumpObject { class MinidumpThread : public MinidumpObject {
public: public:
virtual ~MinidumpThread(); ~MinidumpThread() override;
const MDRawThread* thread() const { return valid_ ? &thread_ : NULL; } const MDRawThread* thread() const { return valid_ ? &thread_ : nullptr; }
// GetMemory may return NULL even if the MinidumpThread is valid, // GetMemory may return NULL even if the MinidumpThread is valid,
// if the thread memory cannot be read. // if the thread memory cannot be read.
virtual MinidumpMemoryRegion* GetMemory(); virtual MinidumpMemoryRegion* GetMemory();
@ -322,7 +321,9 @@ class MinidumpThread : public MinidumpObject {
// a process. // a process.
class MinidumpThreadList : public MinidumpStream { class MinidumpThreadList : public MinidumpStream {
public: public:
virtual ~MinidumpThreadList(); MinidumpThreadList(const MinidumpThreadList&) = delete;
void operator=(const MinidumpThreadList&) = delete;
~MinidumpThreadList() override;
static void set_max_threads(uint32_t max_threads) { static void set_max_threads(uint32_t max_threads) {
max_threads_ = max_threads; max_threads_ = max_threads;
@ -364,18 +365,16 @@ class MinidumpThreadList : public MinidumpStream {
// The list of threads. // The list of threads.
MinidumpThreads* threads_; MinidumpThreads* threads_;
uint32_t thread_count_; uint32_t thread_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpThreadList);
}; };
// MinidumpThreadName contains the name of a thread. // MinidumpThreadName contains the name of a thread.
class MinidumpThreadName : public MinidumpObject { class MinidumpThreadName : public MinidumpObject {
public: public:
virtual ~MinidumpThreadName(); ~MinidumpThreadName() override;
const MDRawThreadName* thread_name() const { const MDRawThreadName* thread_name() const {
return valid_ ? &thread_name_ : NULL; return valid_ ? &thread_name_ : nullptr;
} }
// Gets the thread ID. // Gets the thread ID.
@ -419,7 +418,9 @@ class MinidumpThreadName : public MinidumpObject {
// MinidumpThreadNames) in a process. // MinidumpThreadNames) in a process.
class MinidumpThreadNameList : public MinidumpStream { class MinidumpThreadNameList : public MinidumpStream {
public: public:
virtual ~MinidumpThreadNameList(); MinidumpThreadNameList(const MinidumpThreadNameList&) = delete;
void operator=(const MinidumpThreadNameList&) = delete;
~MinidumpThreadNameList() override;
virtual unsigned int thread_name_count() const { virtual unsigned int thread_name_count() const {
return valid_ ? thread_name_count_ : 0; return valid_ ? thread_name_count_ : 0;
@ -446,8 +447,6 @@ class MinidumpThreadNameList : public MinidumpStream {
// The list of thread names. // The list of thread names.
MinidumpThreadNames* thread_names_; MinidumpThreadNames* thread_names_;
uint32_t thread_name_count_; uint32_t thread_name_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpThreadNameList);
}; };
// MinidumpModule wraps MDRawModule, which contains information about loaded // MinidumpModule wraps MDRawModule, which contains information about loaded
@ -457,7 +456,7 @@ class MinidumpThreadNameList : public MinidumpStream {
class MinidumpModule : public MinidumpObject, class MinidumpModule : public MinidumpObject,
public CodeModule { public CodeModule {
public: public:
virtual ~MinidumpModule(); ~MinidumpModule() override;
static void set_max_cv_bytes(uint32_t max_cv_bytes) { static void set_max_cv_bytes(uint32_t max_cv_bytes) {
max_cv_bytes_ = max_cv_bytes; max_cv_bytes_ = max_cv_bytes;
@ -469,27 +468,27 @@ class MinidumpModule : public MinidumpObject,
} }
static uint32_t max_misc_bytes() { return max_misc_bytes_; } static uint32_t max_misc_bytes() { return max_misc_bytes_; }
const MDRawModule* module() const { return valid_ ? &module_ : NULL; } const MDRawModule* module() const { return valid_ ? &module_ : nullptr; }
// CodeModule implementation // CodeModule implementation
virtual uint64_t base_address() const { uint64_t base_address() const override {
return valid_ ? module_.base_of_image : static_cast<uint64_t>(-1); return valid_ ? module_.base_of_image : static_cast<uint64_t>(-1);
} }
virtual uint64_t size() const { return valid_ ? module_.size_of_image : 0; } uint64_t size() const override { return valid_ ? module_.size_of_image : 0; }
virtual string code_file() const; string code_file() const override;
virtual string code_identifier() const; string code_identifier() const override;
virtual string debug_file() const; string debug_file() const override;
virtual string debug_identifier() const; string debug_identifier() const override;
virtual string version() const; string version() const override;
virtual CodeModule* Copy() const; CodeModule* Copy() const override;
virtual bool is_unloaded() const { return false; } bool is_unloaded() const override { return false; }
// Getter and setter for shrink_down_delta. This is used when the address // Getter and setter for shrink_down_delta. This is used when the address
// range for a module is shrunk down due to address range conflicts with // range for a module is shrunk down due to address range conflicts with
// other modules. The base_address and size fields are not updated and they // other modules. The base_address and size fields are not updated and they
// should always reflect the original values (reported in the minidump). // should always reflect the original values (reported in the minidump).
virtual uint64_t shrink_down_delta() const; uint64_t shrink_down_delta() const override;
virtual void SetShrinkDownDelta(uint64_t shrink_down_delta); void SetShrinkDownDelta(uint64_t shrink_down_delta) override;
// The CodeView record, which contains information to locate the module's // The CodeView record, which contains information to locate the module's
// debugging information (pdb). This is returned as uint8_t* because // debugging information (pdb). This is returned as uint8_t* because
@ -580,7 +579,9 @@ class MinidumpModule : public MinidumpObject,
class MinidumpModuleList : public MinidumpStream, class MinidumpModuleList : public MinidumpStream,
public CodeModules { public CodeModules {
public: public:
virtual ~MinidumpModuleList(); MinidumpModuleList(const MinidumpModuleList&) = delete;
void operator=(const MinidumpModuleList&) = delete;
~MinidumpModuleList() override;
static void set_max_modules(uint32_t max_modules) { static void set_max_modules(uint32_t max_modules) {
max_modules_ = max_modules; max_modules_ = max_modules;
@ -588,19 +589,19 @@ class MinidumpModuleList : public MinidumpStream,
static uint32_t max_modules() { return max_modules_; } static uint32_t max_modules() { return max_modules_; }
// CodeModules implementation. // CodeModules implementation.
virtual unsigned int module_count() const { unsigned int module_count() const override {
return valid_ ? module_count_ : 0; return valid_ ? module_count_ : 0;
} }
virtual const MinidumpModule* GetModuleForAddress(uint64_t address) const; const MinidumpModule* GetModuleForAddress(uint64_t address) const override;
virtual const MinidumpModule* GetMainModule() const; const MinidumpModule* GetMainModule() const override;
virtual const MinidumpModule* GetModuleAtSequence( const MinidumpModule* GetModuleAtSequence(
unsigned int sequence) const; unsigned int sequence) const override;
virtual const MinidumpModule* GetModuleAtIndex(unsigned int index) const; const MinidumpModule* GetModuleAtIndex(unsigned int index) const override;
virtual const CodeModules* Copy() const; const CodeModules* Copy() const override;
// Returns a vector of all modules which address ranges needed to be shrunk // Returns a vector of all modules which address ranges needed to be shrunk
// down due to address range conflicts with other modules. // down due to address range conflicts with other modules.
virtual vector<linked_ptr<const CodeModule> > GetShrunkRangeModules() const; vector<linked_ptr<const CodeModule>> GetShrunkRangeModules() const override;
// Print a human-readable representation of the object to stdout. // Print a human-readable representation of the object to stdout.
void Print(); void Print();
@ -615,7 +616,7 @@ class MinidumpModuleList : public MinidumpStream,
static const uint32_t kStreamType = MD_MODULE_LIST_STREAM; static const uint32_t kStreamType = MD_MODULE_LIST_STREAM;
bool Read(uint32_t expected_size); bool Read(uint32_t expected_size) override;
bool StoreRange(const MinidumpModule& module, bool StoreRange(const MinidumpModule& module,
uint64_t base_address, uint64_t base_address,
@ -632,8 +633,6 @@ class MinidumpModuleList : public MinidumpStream,
MinidumpModules* modules_; MinidumpModules* modules_;
uint32_t module_count_; uint32_t module_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpModuleList);
}; };
@ -648,7 +647,9 @@ class MinidumpModuleList : public MinidumpStream,
// memory minidumps contain all of a process' mapped memory. // memory minidumps contain all of a process' mapped memory.
class MinidumpMemoryList : public MinidumpStream { class MinidumpMemoryList : public MinidumpStream {
public: public:
virtual ~MinidumpMemoryList(); MinidumpMemoryList(const MinidumpMemoryList&) = delete;
void operator=(const MinidumpMemoryList&) = delete;
~MinidumpMemoryList() override;
static void set_max_regions(uint32_t max_regions) { static void set_max_regions(uint32_t max_regions) {
max_regions_ = max_regions; max_regions_ = max_regions;
@ -696,8 +697,6 @@ class MinidumpMemoryList : public MinidumpStream {
// The list of regions. // The list of regions.
MemoryRegions* regions_; MemoryRegions* regions_;
uint32_t region_count_; uint32_t region_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryList);
}; };
@ -709,10 +708,12 @@ class MinidumpMemoryList : public MinidumpStream {
// occurred. // occurred.
class MinidumpException : public MinidumpStream { class MinidumpException : public MinidumpStream {
public: public:
virtual ~MinidumpException(); MinidumpException(const MinidumpException&) = delete;
void operator=(const MinidumpException&) = delete;
~MinidumpException() override;
const MDRawExceptionStream* exception() const { const MDRawExceptionStream* exception() const {
return valid_ ? &exception_ : NULL; return valid_ ? &exception_ : nullptr;
} }
// The thread ID is used to determine if a thread is the exception thread, // The thread ID is used to determine if a thread is the exception thread,
@ -736,19 +737,19 @@ class MinidumpException : public MinidumpStream {
bool Read(uint32_t expected_size) override; bool Read(uint32_t expected_size) override;
MDRawExceptionStream exception_; MDRawExceptionStream exception_;
MinidumpContext* context_; MinidumpContext* context_;
DISALLOW_COPY_AND_ASSIGN(MinidumpException);
}; };
// MinidumpAssertion wraps MDRawAssertionInfo, which contains information // MinidumpAssertion wraps MDRawAssertionInfo, which contains information
// about an assertion that caused the minidump to be generated. // about an assertion that caused the minidump to be generated.
class MinidumpAssertion : public MinidumpStream { class MinidumpAssertion : public MinidumpStream {
public: public:
virtual ~MinidumpAssertion(); MinidumpAssertion(const MinidumpAssertion&) = delete;
void operator=(const MinidumpAssertion&) = delete;
~MinidumpAssertion() override;
const MDRawAssertionInfo* assertion() const { const MDRawAssertionInfo* assertion() const {
return valid_ ? &assertion_ : NULL; return valid_ ? &assertion_ : nullptr;
} }
string expression() const { string expression() const {
@ -779,8 +780,6 @@ class MinidumpAssertion : public MinidumpStream {
string expression_; string expression_;
string function_; string function_;
string file_; string file_;
DISALLOW_COPY_AND_ASSIGN(MinidumpAssertion);
}; };
@ -788,10 +787,12 @@ class MinidumpAssertion : public MinidumpStream {
// the system on which the minidump was generated. See also MinidumpMiscInfo. // the system on which the minidump was generated. See also MinidumpMiscInfo.
class MinidumpSystemInfo : public MinidumpStream { class MinidumpSystemInfo : public MinidumpStream {
public: public:
virtual ~MinidumpSystemInfo(); MinidumpSystemInfo(const MinidumpSystemInfo&) = delete;
void operator=(const MinidumpSystemInfo&) = delete;
~MinidumpSystemInfo() override;
const MDRawSystemInfo* system_info() const { const MDRawSystemInfo* system_info() const {
return valid_ ? &system_info_ : NULL; return valid_ ? &system_info_ : nullptr;
} }
// GetOS and GetCPU return textual representations of the operating system // GetOS and GetCPU return textual representations of the operating system
@ -834,8 +835,6 @@ class MinidumpSystemInfo : public MinidumpStream {
// A string identifying the CPU vendor, if known. // A string identifying the CPU vendor, if known.
const string* cpu_vendor_; const string* cpu_vendor_;
DISALLOW_COPY_AND_ASSIGN(MinidumpSystemInfo);
}; };
@ -846,7 +845,7 @@ class MinidumpUnloadedModule : public MinidumpObject,
~MinidumpUnloadedModule() override; ~MinidumpUnloadedModule() override;
const MDRawUnloadedModule* module() const { const MDRawUnloadedModule* module() const {
return valid_ ? &unloaded_module_ : NULL; return valid_ ? &unloaded_module_ : nullptr;
} }
// CodeModule implementation // CodeModule implementation
@ -903,6 +902,8 @@ class MinidumpUnloadedModule : public MinidumpObject,
class MinidumpUnloadedModuleList : public MinidumpStream, class MinidumpUnloadedModuleList : public MinidumpStream,
public CodeModules { public CodeModules {
public: public:
MinidumpUnloadedModuleList(const MinidumpUnloadedModuleList&) = delete;
void operator=(const MinidumpUnloadedModuleList&) = delete;
~MinidumpUnloadedModuleList() override; ~MinidumpUnloadedModuleList() override;
static void set_max_modules(uint32_t max_modules) { static void set_max_modules(uint32_t max_modules) {
@ -945,8 +946,6 @@ class MinidumpUnloadedModuleList : public MinidumpStream,
MinidumpUnloadedModules* unloaded_modules_; MinidumpUnloadedModules* unloaded_modules_;
uint32_t module_count_; uint32_t module_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpUnloadedModuleList);
}; };
@ -955,8 +954,11 @@ class MinidumpUnloadedModuleList : public MinidumpStream,
// information. See also MinidumpSystemInfo. // information. See also MinidumpSystemInfo.
class MinidumpMiscInfo : public MinidumpStream { class MinidumpMiscInfo : public MinidumpStream {
public: public:
MinidumpMiscInfo(const MinidumpMiscInfo&) = delete;
void operator=(const MinidumpMiscInfo&) = delete;
const MDRawMiscInfo* misc_info() const { const MDRawMiscInfo* misc_info() const {
return valid_ ? &misc_info_ : NULL; return valid_ ? &misc_info_ : nullptr;
} }
// Print a human-readable representation of the object to stdout. // Print a human-readable representation of the object to stdout.
@ -980,8 +982,6 @@ class MinidumpMiscInfo : public MinidumpStream {
string daylight_name_; string daylight_name_;
string build_string_; string build_string_;
string dbg_bld_str_; string dbg_bld_str_;
DISALLOW_COPY_AND_ASSIGN(MinidumpMiscInfo);
}; };
@ -990,8 +990,11 @@ class MinidumpMiscInfo : public MinidumpStream {
// at the time the minidump was generated. // at the time the minidump was generated.
class MinidumpBreakpadInfo : public MinidumpStream { class MinidumpBreakpadInfo : public MinidumpStream {
public: public:
MinidumpBreakpadInfo(const MinidumpBreakpadInfo&) = delete;
void operator=(const MinidumpBreakpadInfo&) = delete;
const MDRawBreakpadInfo* breakpad_info() const { const MDRawBreakpadInfo* breakpad_info() const {
return valid_ ? &breakpad_info_ : NULL; return valid_ ? &breakpad_info_ : nullptr;
} }
// These thread IDs are used to determine if threads deserve special // These thread IDs are used to determine if threads deserve special
@ -1014,8 +1017,6 @@ class MinidumpBreakpadInfo : public MinidumpStream {
bool Read(uint32_t expected_size_) override; bool Read(uint32_t expected_size_) override;
MDRawBreakpadInfo breakpad_info_; MDRawBreakpadInfo breakpad_info_;
DISALLOW_COPY_AND_ASSIGN(MinidumpBreakpadInfo);
}; };
// MinidumpMemoryInfo wraps MDRawMemoryInfo, which provides information // MinidumpMemoryInfo wraps MDRawMemoryInfo, which provides information
@ -1023,7 +1024,9 @@ class MinidumpBreakpadInfo : public MinidumpStream {
// and protection. // and protection.
class MinidumpMemoryInfo : public MinidumpObject { class MinidumpMemoryInfo : public MinidumpObject {
public: public:
const MDRawMemoryInfo* info() const { return valid_ ? &memory_info_ : NULL; } const MDRawMemoryInfo* info() const {
return valid_ ? &memory_info_ : nullptr;
}
// The address of the base of the memory region. // The address of the base of the memory region.
uint64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; } uint64_t GetBase() const { return valid_ ? memory_info_.base_address : 0; }
@ -1060,7 +1063,9 @@ class MinidumpMemoryInfo : public MinidumpObject {
// info corresponding to a specific address. // info corresponding to a specific address.
class MinidumpMemoryInfoList : public MinidumpStream { class MinidumpMemoryInfoList : public MinidumpStream {
public: public:
virtual ~MinidumpMemoryInfoList(); MinidumpMemoryInfoList(const MinidumpMemoryInfoList&) = delete;
void operator=(const MinidumpMemoryInfoList&) = delete;
~MinidumpMemoryInfoList() override;
unsigned int info_count() const { return valid_ ? info_count_ : 0; } unsigned int info_count() const { return valid_ ? info_count_ : 0; }
@ -1086,14 +1091,15 @@ class MinidumpMemoryInfoList : public MinidumpStream {
MinidumpMemoryInfos* infos_; MinidumpMemoryInfos* infos_;
uint32_t info_count_; uint32_t info_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpMemoryInfoList);
}; };
// MinidumpLinuxMaps wraps information about a single mapped memory region // MinidumpLinuxMaps wraps information about a single mapped memory region
// from /proc/self/maps. // from /proc/self/maps.
class MinidumpLinuxMaps : public MinidumpObject { class MinidumpLinuxMaps : public MinidumpObject {
public: public:
MinidumpLinuxMaps(const MinidumpLinuxMaps&) = delete;
void operator=(const MinidumpLinuxMaps&) = delete;
// The memory address of the base of the mapped region. // The memory address of the base of the mapped region.
uint64_t GetBase() const { return valid_ ? region_.start : 0; } uint64_t GetBase() const { return valid_ ? region_.start : 0; }
// The size of the mapped region. // The size of the mapped region.
@ -1139,8 +1145,6 @@ class MinidumpLinuxMaps : public MinidumpObject {
// The memory region struct that this class wraps. // The memory region struct that this class wraps.
MappedMemoryRegion region_; MappedMemoryRegion region_;
DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMaps);
}; };
// MinidumpLinuxMapsList corresponds to the Linux-exclusive MD_LINUX_MAPS // MinidumpLinuxMapsList corresponds to the Linux-exclusive MD_LINUX_MAPS
@ -1148,7 +1152,9 @@ class MinidumpLinuxMaps : public MinidumpObject {
// the mapped memory regions and their access permissions. // the mapped memory regions and their access permissions.
class MinidumpLinuxMapsList : public MinidumpStream { class MinidumpLinuxMapsList : public MinidumpStream {
public: public:
virtual ~MinidumpLinuxMapsList(); MinidumpLinuxMapsList(const MinidumpLinuxMapsList&) = delete;
void operator=(const MinidumpLinuxMapsList&) = delete;
~MinidumpLinuxMapsList() override;
// Get number of mappings. // Get number of mappings.
unsigned int get_maps_count() const { return valid_ ? maps_count_ : 0; } unsigned int get_maps_count() const { return valid_ ? maps_count_ : 0; }
@ -1180,8 +1186,6 @@ class MinidumpLinuxMapsList : public MinidumpStream {
MinidumpLinuxMappings* maps_; MinidumpLinuxMappings* maps_;
// The number of mappings. // The number of mappings.
uint32_t maps_count_; uint32_t maps_count_;
DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMapsList);
}; };
// MinidumpCrashpadInfo wraps MDRawCrashpadInfo, which is an optional stream in // MinidumpCrashpadInfo wraps MDRawCrashpadInfo, which is an optional stream in
@ -1196,12 +1200,12 @@ class MinidumpCrashpadInfo : public MinidumpStream {
}; };
const MDRawCrashpadInfo* crashpad_info() const { const MDRawCrashpadInfo* crashpad_info() const {
return valid_ ? &crashpad_info_ : NULL; return valid_ ? &crashpad_info_ : nullptr;
} }
const std::vector<std::vector<AnnotationObject>>* const std::vector<std::vector<AnnotationObject>>*
GetModuleCrashpadInfoAnnotationObjects() const { GetModuleCrashpadInfoAnnotationObjects() const {
return valid_ ? &module_crashpad_info_annotation_objects_ : NULL; return valid_ ? &module_crashpad_info_annotation_objects_ : nullptr;
} }
// Print a human-readable representation of the object to stdout. // Print a human-readable representation of the object to stdout.
@ -1242,6 +1246,9 @@ class Minidump {
// is valid as long as the Minidump object is. // is valid as long as the Minidump object is.
explicit Minidump(std::istream& input); explicit Minidump(std::istream& input);
Minidump(const Minidump&) = delete;
void operator=(const Minidump&) = delete;
virtual ~Minidump(); virtual ~Minidump();
// path may be empty if the minidump was not opened from a file // path may be empty if the minidump was not opened from a file
@ -1258,7 +1265,9 @@ class Minidump {
} }
static uint32_t max_string_length() { return max_string_length_; } static uint32_t max_string_length() { return max_string_length_; }
virtual const MDRawHeader* header() const { return valid_ ? &header_ : NULL; } virtual const MDRawHeader* header() const {
return valid_ ? &header_ : nullptr;
}
// Reads the CPU information from the system info stream and generates the // Reads the CPU information from the system info stream and generates the
// appropriate CPU flags. The returned context_cpu_flags are the same as // appropriate CPU flags. The returned context_cpu_flags are the same as
@ -1374,7 +1383,7 @@ class Minidump {
// the Minidump object locate interesting streams quickly, and // the Minidump object locate interesting streams quickly, and
// provides a convenient place to stash MinidumpStream objects. // provides a convenient place to stash MinidumpStream objects.
struct MinidumpStreamInfo { struct MinidumpStreamInfo {
MinidumpStreamInfo() : stream_index(0), stream(NULL) {} MinidumpStreamInfo() : stream_index(0), stream(nullptr) {}
~MinidumpStreamInfo() { delete stream; } ~MinidumpStreamInfo() { delete stream; }
// Index into the MinidumpDirectoryEntries vector // Index into the MinidumpDirectoryEntries vector
@ -1436,8 +1445,6 @@ class Minidump {
// Knobs for controlling display of memory printing. // Knobs for controlling display of memory printing.
bool hexdump_; bool hexdump_;
unsigned int hexdump_width_; unsigned int hexdump_width_;
DISALLOW_COPY_AND_ASSIGN(Minidump);
}; };

View file

@ -36,7 +36,6 @@
#ifndef PROCESSOR_STACKWALKER_ADDRESS_LIST_H_ #ifndef PROCESSOR_STACKWALKER_ADDRESS_LIST_H_
#define PROCESSOR_STACKWALKER_ADDRESS_LIST_H_ #define PROCESSOR_STACKWALKER_ADDRESS_LIST_H_
#include "common/basictypes.h"
#include "google_breakpad/common/breakpad_types.h" #include "google_breakpad/common/breakpad_types.h"
#include "google_breakpad/processor/stackwalker.h" #include "google_breakpad/processor/stackwalker.h"
@ -53,6 +52,8 @@ class StackwalkerAddressList : public Stackwalker {
size_t frame_count, size_t frame_count,
const CodeModules* modules, const CodeModules* modules,
StackFrameSymbolizer* frame_symbolizer); StackFrameSymbolizer* frame_symbolizer);
StackwalkerAddressList(const StackwalkerAddressList&) = delete;
void operator=(const StackwalkerAddressList&) = delete;
private: private:
// Implementation of Stackwalker. // Implementation of Stackwalker.
@ -62,8 +63,6 @@ class StackwalkerAddressList : public Stackwalker {
const uint64_t* frames_; const uint64_t* frames_;
size_t frame_count_; size_t frame_count_;
DISALLOW_COPY_AND_ASSIGN(StackwalkerAddressList);
}; };
} // namespace google_breakpad } // namespace google_breakpad