From fc6f700bb56d25919e40b13bd141832dcb8c6a7f Mon Sep 17 00:00:00 2001 From: "ted.mielczarek@gmail.com" Date: Tue, 6 Nov 2012 16:50:01 +0000 Subject: Allow processing dumps with missing stack memory for some threads r=mkrebs at https://breakpad.appspot.com/413002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1077 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/google_breakpad/processor/minidump.h | 90 ++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 40 deletions(-) (limited to 'src/google_breakpad/processor/minidump.h') diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h index 03337796..5e60a77c 100644 --- a/src/google_breakpad/processor/minidump.h +++ b/src/google_breakpad/processor/minidump.h @@ -190,16 +190,32 @@ class MinidumpContext : public MinidumpStream { 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. @@ -211,21 +227,6 @@ class MinidumpContext : public MinidumpStream { // 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_; }; @@ -268,12 +269,13 @@ class MinidumpMemoryRegion : public MinidumpObject, // 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); @@ -300,29 +302,35 @@ class MinidumpMemoryRegion : public MinidumpObject, // 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. @@ -345,12 +353,12 @@ class MinidumpThreadList : public MinidumpStream { } 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); @@ -358,6 +366,9 @@ class MinidumpThreadList : public MinidumpStream { // Print a human-readable representation of the object to stdout. void Print(); + protected: + explicit MinidumpThreadList(Minidump* aMinidump); + private: friend class Minidump; @@ -366,8 +377,6 @@ class MinidumpThreadList : public MinidumpStream { 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 @@ -526,6 +535,9 @@ class MinidumpModuleList : public MinidumpStream, // Print a human-readable representation of the object to stdout. void Print(); + protected: + explicit MinidumpModuleList(Minidump* minidump); + private: friend class Minidump; @@ -533,8 +545,6 @@ class MinidumpModuleList : public MinidumpStream, 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 @@ -722,21 +732,21 @@ class MinidumpSystemInfo : public MinidumpStream { // Print a human-readable representation of the object to stdout. void Print(); - private: - friend class Minidump; - - static const u_int32_t kStreamType = MD_SYSTEM_INFO_STREAM; - + protected: 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_; + private: + friend class Minidump; + + static const u_int32_t kStreamType = MD_SYSTEM_INFO_STREAM; + + bool Read(u_int32_t expected_size); + // A string identifying the CPU vendor, if known. const string* cpu_vendor_; }; @@ -913,7 +923,7 @@ class Minidump { MinidumpMemoryList* GetMemoryList(); MinidumpException* GetException(); MinidumpAssertion* GetAssertion(); - MinidumpSystemInfo* GetSystemInfo(); + virtual MinidumpSystemInfo* GetSystemInfo(); MinidumpMiscInfo* GetMiscInfo(); MinidumpBreakpadInfo* GetBreakpadInfo(); MinidumpMemoryInfoList* GetMemoryInfoList(); -- cgit v1.2.1