Index: src/google_breakpad/processor/minidump.h |
=================================================================== |
--- a/src/google_breakpad/processor/minidump.h |
+++ b/src/google_breakpad/processor/minidump.h |
@@ -185,52 +185,53 @@ class MinidumpContext : public MinidumpS |
// Returns raw CPU-specific context data for the named CPU type. If the |
// context data does not match the CPU type or does not exist, returns |
// NULL. |
const MDRawContextAMD64* GetContextAMD64() const; |
const MDRawContextARM* GetContextARM() const; |
const MDRawContextPPC* GetContextPPC() const; |
const MDRawContextSPARC* GetContextSPARC() const; |
const MDRawContextX86* GetContextX86() const; |
- |
+ |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpContext(Minidump* minidump); |
+ |
+ // The CPU-specific context structure. |
+ union { |
+ MDRawContextBase* base; |
+ MDRawContextX86* x86; |
+ MDRawContextPPC* ppc; |
+ MDRawContextAMD64* amd64; |
+ // on Solaris SPARC, sparc is defined as a numeric constant, |
+ // so variables can NOT be named as sparc |
+ MDRawContextSPARC* ctx_sparc; |
+ MDRawContextARM* arm; |
+ } context_; |
+ |
+ // Store this separately because of the weirdo AMD64 context |
+ u_int32_t context_flags_; |
+ |
private: |
friend class MinidumpThread; |
friend class MinidumpException; |
- explicit MinidumpContext(Minidump* minidump); |
- |
bool Read(u_int32_t expected_size); |
// Free the CPU-specific context structure. |
void FreeContext(); |
// If the minidump contains a SYSTEM_INFO_STREAM, makes sure that the |
// system info stream gives an appropriate CPU type matching the context |
// CPU type in context_cpu_type. Returns false if the CPU type does not |
// match. Returns true if the CPU type matches or if the minidump does |
// not contain a system info stream. |
bool CheckAgainstSystemInfo(u_int32_t context_cpu_type); |
- |
- // Store this separately because of the weirdo AMD64 context |
- u_int32_t context_flags_; |
- |
- // The CPU-specific context structure. |
- union { |
- MDRawContextBase* base; |
- MDRawContextX86* x86; |
- MDRawContextPPC* ppc; |
- MDRawContextAMD64* amd64; |
- // on Solaris SPARC, sparc is defined as a numeric constant, |
- // so variables can NOT be named as sparc |
- MDRawContextSPARC* ctx_sparc; |
- MDRawContextARM* arm; |
- } context_; |
}; |
// MinidumpMemoryRegion does not wrap any MDRaw structure, and only contains |
// a reference to an MDMemoryDescriptor. This object is intended to wrap |
// portions of a minidump file that contain memory dumps. In normal |
// minidumps, each MinidumpThread owns a MinidumpMemoryRegion corresponding |
// to the thread's stack memory. MinidumpMemoryList also gives access to |
@@ -263,22 +264,23 @@ class MinidumpMemoryRegion : public Mini |
bool GetMemoryAtAddress(u_int64_t address, u_int8_t* value) const; |
bool GetMemoryAtAddress(u_int64_t address, u_int16_t* value) const; |
bool GetMemoryAtAddress(u_int64_t address, u_int32_t* value) const; |
bool GetMemoryAtAddress(u_int64_t address, u_int64_t* value) const; |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpMemoryRegion(Minidump* minidump); |
+ |
private: |
friend class MinidumpThread; |
friend class MinidumpMemoryList; |
- explicit MinidumpMemoryRegion(Minidump* minidump); |
- |
// Identify the base address and size of the memory region, and the |
// location it may be found in the minidump file. |
void SetDescriptor(MDMemoryDescriptor* descriptor); |
// Implementation for GetMemoryAtAddress |
template<typename T> bool GetMemoryAtAddressInternal(u_int64_t address, |
T* value) const; |
@@ -295,39 +297,45 @@ class MinidumpMemoryRegion : public Mini |
}; |
// MinidumpThread contains information about a thread of execution, |
// including a snapshot of the thread's stack and CPU context. For |
// the thread that caused an exception, the context carried by |
// MinidumpException is probably desired instead of the CPU context |
// provided here. |
+// Note that a MinidumpThread may be valid() even if it does not |
+// contain a memory region or context. |
class MinidumpThread : public MinidumpObject { |
public: |
virtual ~MinidumpThread(); |
const MDRawThread* thread() const { return valid_ ? &thread_ : NULL; } |
- MinidumpMemoryRegion* GetMemory(); |
- MinidumpContext* GetContext(); |
+ // GetMemory may return NULL even if the MinidumpThread is valid, |
+ // if the thread memory cannot be read. |
+ virtual MinidumpMemoryRegion* GetMemory(); |
+ // GetContext may return NULL even if the MinidumpThread is valid. |
+ virtual MinidumpContext* GetContext(); |
// The thread ID is used to determine if a thread is the exception thread, |
// so a special getter is provided to retrieve this data from the |
// MDRawThread structure. Returns false if the thread ID cannot be |
// determined. |
- bool GetThreadID(u_int32_t *thread_id) const; |
+ virtual bool GetThreadID(u_int32_t *thread_id) const; |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpThread(Minidump* minidump); |
+ |
private: |
// These objects are managed by MinidumpThreadList. |
friend class MinidumpThreadList; |
- explicit MinidumpThread(Minidump* minidump); |
- |
// This works like MinidumpStream::Read, but is driven by |
// MinidumpThreadList. No size checking is done, because |
// MinidumpThreadList handles that directly. |
bool Read(); |
MDRawThread thread_; |
MinidumpMemoryRegion* memory_; |
MinidumpContext* context_; |
@@ -340,39 +348,40 @@ class MinidumpThreadList : public Minidu |
public: |
virtual ~MinidumpThreadList(); |
static void set_max_threads(u_int32_t max_threads) { |
max_threads_ = max_threads; |
} |
static u_int32_t max_threads() { return max_threads_; } |
- unsigned int thread_count() const { |
+ virtual unsigned int thread_count() const { |
return valid_ ? thread_count_ : 0; |
} |
// Sequential access to threads. |
- MinidumpThread* GetThreadAtIndex(unsigned int index) const; |
+ virtual MinidumpThread* GetThreadAtIndex(unsigned int index) const; |
// Random access to threads. |
MinidumpThread* GetThreadByID(u_int32_t thread_id); |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpThreadList(Minidump* aMinidump); |
+ |
private: |
friend class Minidump; |
typedef map<u_int32_t, MinidumpThread*> IDToThreadMap; |
typedef vector<MinidumpThread> MinidumpThreads; |
static const u_int32_t kStreamType = MD_THREAD_LIST_STREAM; |
- explicit MinidumpThreadList(Minidump* aMinidump); |
- |
bool Read(u_int32_t aExpectedSize); |
// The largest number of threads that will be read from a minidump. The |
// default is 256. |
static u_int32_t max_threads_; |
// Access to threads using the thread ID as the key. |
IDToThreadMap id_to_thread_map_; |
@@ -521,25 +530,26 @@ class MinidumpModuleList : public Minidu |
virtual const MinidumpModule* GetModuleAtSequence( |
unsigned int sequence) const; |
virtual const MinidumpModule* GetModuleAtIndex(unsigned int index) const; |
virtual const CodeModules* Copy() const; |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpModuleList(Minidump* minidump); |
+ |
private: |
friend class Minidump; |
typedef vector<MinidumpModule> MinidumpModules; |
static const u_int32_t kStreamType = MD_MODULE_LIST_STREAM; |
- explicit MinidumpModuleList(Minidump* minidump); |
- |
bool Read(u_int32_t expected_size); |
// The largest number of modules that will be read from a minidump. The |
// default is 1024. |
static u_int32_t max_modules_; |
// Access to modules using addresses as the key. |
RangeMap<u_int64_t, unsigned int> *range_map_; |
@@ -717,31 +727,31 @@ class MinidumpSystemInfo : public Minidu |
// If a CPU vendor string can be determined, returns a pointer to it, |
// otherwise, returns NULL. CPU vendor strings can be determined from |
// x86 CPUs with CPUID 0. |
const string* GetCPUVendor(); |
// Print a human-readable representation of the object to stdout. |
void Print(); |
+ protected: |
+ explicit MinidumpSystemInfo(Minidump* minidump); |
+ MDRawSystemInfo system_info_; |
+ |
+ // Textual representation of the OS service pack, for minidumps produced |
+ // by MiniDumpWriteDump on Windows. |
+ const string* csd_version_; |
+ |
private: |
friend class Minidump; |
static const u_int32_t kStreamType = MD_SYSTEM_INFO_STREAM; |
- explicit MinidumpSystemInfo(Minidump* minidump); |
- |
bool Read(u_int32_t expected_size); |
- MDRawSystemInfo system_info_; |
- |
- // Textual representation of the OS service pack, for minidumps produced |
- // by MiniDumpWriteDump on Windows. |
- const string* csd_version_; |
- |
// A string identifying the CPU vendor, if known. |
const string* cpu_vendor_; |
}; |
// MinidumpMiscInfo wraps MDRawMiscInfo and provides information about |
// the process that generated the minidump, and optionally additional system |
// information. See also MinidumpSystemInfo. |
@@ -908,17 +918,17 @@ class Minidump { |
// force code generation of the templatized API within the module, and |
// to avoid exposing an ugly API (GetStream needs to accept a garbage |
// parameter). |
virtual MinidumpThreadList* GetThreadList(); |
MinidumpModuleList* GetModuleList(); |
MinidumpMemoryList* GetMemoryList(); |
MinidumpException* GetException(); |
MinidumpAssertion* GetAssertion(); |
- MinidumpSystemInfo* GetSystemInfo(); |
+ virtual MinidumpSystemInfo* GetSystemInfo(); |
MinidumpMiscInfo* GetMiscInfo(); |
MinidumpBreakpadInfo* GetBreakpadInfo(); |
MinidumpMemoryInfoList* GetMemoryInfoList(); |
// The next set of methods are provided for users who wish to access |
// data in minidump files directly, while leveraging the rest of |
// this class and related classes to handle the basic minidump |
// structure and known stream types. |