mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 05:45:46 +00:00
Move dead submodules in-tree
Signed-off-by: swurl <swurl@swurl.xyz>
This commit is contained in:
parent
c0cceff365
commit
6c655321e6
4081 changed files with 1185566 additions and 45 deletions
183
externals/breakpad/src/google_breakpad/processor/basic_source_line_resolver.h
vendored
Normal file
183
externals/breakpad/src/google_breakpad/processor/basic_source_line_resolver.h
vendored
Normal file
|
@ -0,0 +1,183 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// basic_source_line_resolver.h: BasicSourceLineResolver is derived from
|
||||
// SourceLineResolverBase, and is a concrete implementation of
|
||||
// SourceLineResolverInterface, using address map files produced by a
|
||||
// compatible writer, e.g. PDBSourceLineWriter.
|
||||
//
|
||||
// see "processor/source_line_resolver_base.h"
|
||||
// and "source_line_resolver_interface.h" for more documentation.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/processor/source_line_resolver_base.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::map;
|
||||
|
||||
class BasicSourceLineResolver : public SourceLineResolverBase {
|
||||
public:
|
||||
BasicSourceLineResolver();
|
||||
virtual ~BasicSourceLineResolver() { }
|
||||
|
||||
using SourceLineResolverBase::LoadModule;
|
||||
using SourceLineResolverBase::LoadModuleUsingMapBuffer;
|
||||
using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
|
||||
using SourceLineResolverBase::ShouldDeleteMemoryBufferAfterLoadModule;
|
||||
using SourceLineResolverBase::UnloadModule;
|
||||
using SourceLineResolverBase::HasModule;
|
||||
using SourceLineResolverBase::IsModuleCorrupt;
|
||||
using SourceLineResolverBase::FillSourceLineInfo;
|
||||
using SourceLineResolverBase::FindWindowsFrameInfo;
|
||||
using SourceLineResolverBase::FindCFIFrameInfo;
|
||||
|
||||
private:
|
||||
// friend declarations:
|
||||
friend class BasicModuleFactory;
|
||||
friend class ModuleComparer;
|
||||
friend class ModuleSerializer;
|
||||
template<class> friend class SimpleSerializer;
|
||||
|
||||
// Function derives from SourceLineResolverBase::Function.
|
||||
struct Function;
|
||||
// Module implements SourceLineResolverBase::Module interface.
|
||||
class Module;
|
||||
|
||||
// Disallow unwanted copy ctor and assignment operator
|
||||
BasicSourceLineResolver(const BasicSourceLineResolver&);
|
||||
void operator=(const BasicSourceLineResolver&);
|
||||
};
|
||||
|
||||
// Helper class, containing useful methods for parsing of Breakpad symbol files.
|
||||
class SymbolParseHelper {
|
||||
public:
|
||||
using MemAddr = SourceLineResolverInterface::MemAddr;
|
||||
|
||||
// Parses a |file_line| declaration. Returns true on success.
|
||||
// Format: FILE <id> <filename>.
|
||||
// Notice, that this method modifies the input |file_line| which is why it
|
||||
// can't be const. On success, <id>, and <filename> are stored in |*index|,
|
||||
// and |*filename|. No allocation is done, |*filename| simply points inside
|
||||
// |file_line|.
|
||||
static bool ParseFile(char* file_line, // in
|
||||
long* index, // out
|
||||
char** filename); // out
|
||||
|
||||
// Parses a |inline_origin_line| declaration. Returns true on success.
|
||||
// Old Format: INLINE_ORIGIN <origin_id> <file_id> <name>.
|
||||
// New Format: INLINE_ORIGIN <origin_id> <name>.
|
||||
// Notice, that this method modifies the input |inline_origin_line| which is
|
||||
// why it can't be const. On success, <has_file_id>, <origin_id>, <file_id>
|
||||
// and <name> are stored in |*has_file_id*|, |*origin_id|, |*file_id|, and
|
||||
// |*name|. No allocation is done, |*name| simply points inside
|
||||
// |inline_origin_line|.
|
||||
static bool ParseInlineOrigin(char* inline_origin_line, // in
|
||||
bool* has_file_id, // out
|
||||
long* origin_id, // out
|
||||
long* file_id, // out
|
||||
char** name); // out
|
||||
|
||||
// Parses a |inline| declaration. Returns true on success.
|
||||
// Old Format: INLINE <inline_nest_level> <call_site_line> <origin_id>
|
||||
// [<address> <size>]+
|
||||
// New Format: INLINE <inline_nest_level> <call_site_line> <call_site_file_id>
|
||||
// <origin_id> [<address> <size>]+
|
||||
// Notice, that this method modifies the input |inline|
|
||||
// which is why it can't be const. On success, <has_call_site_file_id>,
|
||||
// <inline_nest_level>, <call_site_line> and <origin_id> are stored in
|
||||
// |*has_call_site_file_id*|, |*inline_nest_level|, |*call_site_line|, and
|
||||
// |*origin_id|, and all pairs of (<address>, <size>) are added into ranges.
|
||||
static bool ParseInline(
|
||||
char* inline_line, // in
|
||||
bool* has_call_site_file_id, // out
|
||||
long* inline_nest_level, // out
|
||||
long* call_site_line, // out
|
||||
long* call_site_file_id, // out
|
||||
long* origin_id, // out
|
||||
std::vector<std::pair<MemAddr, MemAddr>>* ranges); // out
|
||||
|
||||
// Parses a |function_line| declaration. Returns true on success.
|
||||
// Format: FUNC [<multiple>] <address> <size> <stack_param_size> <name>.
|
||||
// Notice, that this method modifies the input |function_line| which is why it
|
||||
// can't be const. On success, the presence of <multiple>, <address>, <size>,
|
||||
// <stack_param_size>, and <name> are stored in |*is_multiple|, |*address|,
|
||||
// |*size|, |*stack_param_size|, and |*name|. No allocation is done, |*name|
|
||||
// simply points inside |function_line|.
|
||||
static bool ParseFunction(char* function_line, // in
|
||||
bool* is_multiple, // out
|
||||
uint64_t* address, // out
|
||||
uint64_t* size, // out
|
||||
long* stack_param_size, // out
|
||||
char** name); // out
|
||||
|
||||
// Parses a |line| declaration. Returns true on success.
|
||||
// Format: <address> <size> <line number> <source file id>
|
||||
// Notice, that this method modifies the input |function_line| which is why
|
||||
// it can't be const. On success, <address>, <size>, <line number>, and
|
||||
// <source file id> are stored in |*address|, |*size|, |*line_number|, and
|
||||
// |*source_file|.
|
||||
static bool ParseLine(char* line_line, // in
|
||||
uint64_t* address, // out
|
||||
uint64_t* size, // out
|
||||
long* line_number, // out
|
||||
long* source_file); // out
|
||||
|
||||
// Parses a |public_line| declaration. Returns true on success.
|
||||
// Format: PUBLIC [<multiple>] <address> <stack_param_size> <name>
|
||||
// Notice, that this method modifies the input |function_line| which is why
|
||||
// it can't be const. On success, the presence of <multiple>, <address>,
|
||||
// <stack_param_size>, <name> are stored in |*is_multiple|, |*address|,
|
||||
// |*stack_param_size|, and |*name|. No allocation is done, |*name| simply
|
||||
// points inside |public_line|.
|
||||
static bool ParsePublicSymbol(char* public_line, // in
|
||||
bool* is_multiple, // out
|
||||
uint64_t* address, // out
|
||||
long* stack_param_size, // out
|
||||
char** name); // out
|
||||
|
||||
private:
|
||||
// Used for success checks after strtoull and strtol.
|
||||
static bool IsValidAfterNumber(char* after_number);
|
||||
|
||||
// Only allow static methods.
|
||||
SymbolParseHelper();
|
||||
SymbolParseHelper(const SymbolParseHelper&);
|
||||
void operator=(const SymbolParseHelper&);
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
|
86
externals/breakpad/src/google_breakpad/processor/call_stack.h
vendored
Normal file
86
externals/breakpad/src/google_breakpad/processor/call_stack.h
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// call_stack.h: A call stack comprised of stack frames.
|
||||
//
|
||||
// This class manages a vector of stack frames. It is used instead of
|
||||
// exposing the vector directly to allow the CallStack to own StackFrame
|
||||
// pointers without having to publicly export the linked_ptr class. A
|
||||
// CallStack must be composed of pointers instead of objects to allow for
|
||||
// CPU-specific StackFrame subclasses.
|
||||
//
|
||||
// By convention, the stack frame at index 0 is the innermost callee frame,
|
||||
// and the frame at the highest index in a call stack is the outermost
|
||||
// caller. CallStack only allows stacks to be built by pushing frames,
|
||||
// beginning with the innermost callee frame.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_CALL_STACK_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::vector;
|
||||
|
||||
struct StackFrame;
|
||||
template<typename T> class linked_ptr;
|
||||
|
||||
class CallStack {
|
||||
public:
|
||||
CallStack() { Clear(); }
|
||||
~CallStack();
|
||||
|
||||
// Resets the CallStack to its initial empty state
|
||||
void Clear();
|
||||
|
||||
const vector<StackFrame*>* frames() const { return &frames_; }
|
||||
|
||||
// Set the TID associated with this call stack.
|
||||
void set_tid(uint32_t tid) { tid_ = tid; }
|
||||
|
||||
uint32_t tid() const { return tid_; }
|
||||
|
||||
private:
|
||||
// Stackwalker is responsible for building the frames_ vector.
|
||||
friend class Stackwalker;
|
||||
|
||||
// Storage for pushed frames.
|
||||
vector<StackFrame*> frames_;
|
||||
|
||||
// The TID associated with this call stack. Default to 0 if it's not
|
||||
// available.
|
||||
uint32_t tid_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCSSOR_CALL_STACK_H__
|
103
externals/breakpad/src/google_breakpad/processor/code_module.h
vendored
Normal file
103
externals/breakpad/src/google_breakpad/processor/code_module.h
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// code_module.h: Carries information about code modules that are loaded
|
||||
// into a process.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class CodeModule {
|
||||
public:
|
||||
virtual ~CodeModule() {}
|
||||
|
||||
// The base address of this code module as it was loaded by the process.
|
||||
// (uint64_t)-1 on error.
|
||||
virtual uint64_t base_address() const = 0;
|
||||
|
||||
// The size of the code module. 0 on error.
|
||||
virtual uint64_t size() const = 0;
|
||||
|
||||
// The path or file name that the code module was loaded from. Empty on
|
||||
// error.
|
||||
virtual string code_file() const = 0;
|
||||
|
||||
// An identifying string used to discriminate between multiple versions and
|
||||
// builds of the same code module. This may contain a uuid, timestamp,
|
||||
// version number, or any combination of this or other information, in an
|
||||
// implementation-defined format. Empty on error.
|
||||
virtual string code_identifier() const = 0;
|
||||
|
||||
// The filename containing debugging information associated with the code
|
||||
// module. If debugging information is stored in a file separate from the
|
||||
// code module itself (as is the case when .pdb or .dSYM files are used),
|
||||
// this will be different from code_file. If debugging information is
|
||||
// stored in the code module itself (possibly prior to stripping), this
|
||||
// will be the same as code_file. Empty on error.
|
||||
virtual string debug_file() const = 0;
|
||||
|
||||
// An identifying string similar to code_identifier, but identifies a
|
||||
// specific version and build of the associated debug file. This may be
|
||||
// the same as code_identifier when the debug_file and code_file are
|
||||
// identical or when the same identifier is used to identify distinct
|
||||
// debug and code files.
|
||||
virtual string debug_identifier() const = 0;
|
||||
|
||||
// A human-readable representation of the code module's version. Empty on
|
||||
// error.
|
||||
virtual string version() const = 0;
|
||||
|
||||
// Creates a new copy of this CodeModule object, which the caller takes
|
||||
// ownership of. The new CodeModule may be of a different concrete class
|
||||
// than the CodeModule being copied, but will behave identically to the
|
||||
// copied CodeModule as far as the CodeModule interface is concerned.
|
||||
virtual CodeModule* Copy() const = 0;
|
||||
|
||||
// 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
|
||||
// other modules. The base_address and size fields are not updated and they
|
||||
// should always reflect the original values (reported in the minidump).
|
||||
virtual uint64_t shrink_down_delta() const = 0;
|
||||
virtual void SetShrinkDownDelta(uint64_t shrink_down_delta) = 0;
|
||||
|
||||
// Whether the module was unloaded from memory.
|
||||
virtual bool is_unloaded() const = 0;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
|
107
externals/breakpad/src/google_breakpad/processor/code_modules.h
vendored
Normal file
107
externals/breakpad/src/google_breakpad/processor/code_modules.h
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// code_modules.h: Contains all of the CodeModule objects that were loaded
|
||||
// into a single process.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "processor/linked_ptr.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class CodeModule;
|
||||
|
||||
class CodeModules {
|
||||
public:
|
||||
virtual ~CodeModules() {}
|
||||
|
||||
// The number of contained CodeModule objects.
|
||||
virtual unsigned int module_count() const = 0;
|
||||
|
||||
// Random access to modules. Returns the module whose code is present
|
||||
// at the address indicated by |address|. If no module is present at this
|
||||
// address, returns NULL. Ownership of the returned CodeModule is retained
|
||||
// by the CodeModules object; pointers returned by this method are valid for
|
||||
// comparison with pointers returned by the other Get methods.
|
||||
virtual const CodeModule* GetModuleForAddress(uint64_t address) const = 0;
|
||||
|
||||
// Returns the module corresponding to the main executable. If there is
|
||||
// no main executable, returns NULL. Ownership of the returned CodeModule
|
||||
// is retained by the CodeModules object; pointers returned by this method
|
||||
// are valid for comparison with pointers returned by the other Get
|
||||
// methods.
|
||||
virtual const CodeModule* GetMainModule() const = 0;
|
||||
|
||||
// Sequential access to modules. A sequence number of 0 corresponds to the
|
||||
// module residing lowest in memory. If the sequence number is out of
|
||||
// range, returns NULL. Ownership of the returned CodeModule is retained
|
||||
// by the CodeModules object; pointers returned by this method are valid for
|
||||
// comparison with pointers returned by the other Get methods.
|
||||
virtual const CodeModule* GetModuleAtSequence(
|
||||
unsigned int sequence) const = 0;
|
||||
|
||||
// Sequential access to modules. This is similar to GetModuleAtSequence,
|
||||
// except no ordering requirement is enforced. A CodeModules implementation
|
||||
// may return CodeModule objects from GetModuleAtIndex in any order it
|
||||
// wishes, provided that the order remain the same throughout the life of
|
||||
// the CodeModules object. Typically, GetModuleAtIndex would be used by
|
||||
// a caller to enumerate all CodeModule objects quickly when the enumeration
|
||||
// does not require any ordering. If the index argument is out of range,
|
||||
// returns NULL. Ownership of the returned CodeModule is retained by
|
||||
// the CodeModules object; pointers returned by this method are valid for
|
||||
// comparison with pointers returned by the other Get methods.
|
||||
virtual const CodeModule* GetModuleAtIndex(unsigned int index) const = 0;
|
||||
|
||||
// Creates a new copy of this CodeModules object, which the caller takes
|
||||
// ownership of. The new object will also contain copies of the existing
|
||||
// object's child CodeModule objects. The new CodeModules object may be of
|
||||
// a different concrete class than the object being copied, but will behave
|
||||
// identically to the copied object as far as the CodeModules and CodeModule
|
||||
// interfaces are concerned, except that the order that GetModuleAtIndex
|
||||
// returns objects in may differ between a copy and the original CodeModules
|
||||
// object.
|
||||
virtual const CodeModules* Copy() const = 0;
|
||||
|
||||
// Returns a vector of all modules which address ranges needed to be shrunk
|
||||
// down due to address range conflicts with other modules.
|
||||
virtual std::vector<linked_ptr<const CodeModule> >
|
||||
GetShrunkRangeModules() const = 0;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULES_H__
|
121
externals/breakpad/src/google_breakpad/processor/dump_context.h
vendored
Normal file
121
externals/breakpad/src/google_breakpad/processor/dump_context.h
vendored
Normal file
|
@ -0,0 +1,121 @@
|
|||
// Copyright 2014 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// dump_context.h: A (mini/micro) dump CPU-specific context.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
|
||||
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "google_breakpad/processor/dump_object.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// DumpContext carries a CPU-specific MDRawContext structure, which contains CPU
|
||||
// context such as register states.
|
||||
class DumpContext : public DumpObject {
|
||||
public:
|
||||
virtual ~DumpContext();
|
||||
|
||||
// Returns an MD_CONTEXT_* value such as MD_CONTEXT_X86 or MD_CONTEXT_PPC
|
||||
// identifying the CPU type that the context was collected from. The
|
||||
// returned value will identify the CPU only, and will have any other
|
||||
// MD_CONTEXT_* bits masked out. Returns 0 on failure.
|
||||
uint32_t GetContextCPU() const;
|
||||
|
||||
// Return the raw value of |context_flags_|
|
||||
uint32_t GetContextFlags() const;
|
||||
|
||||
// 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 MDRawContextARM64* GetContextARM64() const;
|
||||
const MDRawContextMIPS* GetContextMIPS() const;
|
||||
const MDRawContextPPC* GetContextPPC() const;
|
||||
const MDRawContextPPC64* GetContextPPC64() const;
|
||||
const MDRawContextSPARC* GetContextSPARC() const;
|
||||
const MDRawContextX86* GetContextX86() const;
|
||||
const MDRawContextRISCV* GetContextRISCV() const;
|
||||
const MDRawContextRISCV64* GetContextRISCV64() const;
|
||||
|
||||
// A convenience method to get the instruction pointer out of the
|
||||
// MDRawContext, since it varies per-CPU architecture.
|
||||
bool GetInstructionPointer(uint64_t* ip) const;
|
||||
|
||||
// Similar to the GetInstructionPointer method, this method gets the stack
|
||||
// pointer for all CPU architectures.
|
||||
bool GetStackPointer(uint64_t* sp) const;
|
||||
|
||||
// Print a human-readable representation of the object to stdout.
|
||||
void Print();
|
||||
|
||||
protected:
|
||||
DumpContext();
|
||||
|
||||
// Sets row CPU-specific context data for the names CPU type.
|
||||
void SetContextFlags(uint32_t context_flags);
|
||||
void SetContextX86(MDRawContextX86* x86);
|
||||
void SetContextPPC(MDRawContextPPC* ppc);
|
||||
void SetContextPPC64(MDRawContextPPC64* ppc64);
|
||||
void SetContextAMD64(MDRawContextAMD64* amd64);
|
||||
void SetContextSPARC(MDRawContextSPARC* ctx_sparc);
|
||||
void SetContextARM(MDRawContextARM* arm);
|
||||
void SetContextARM64(MDRawContextARM64* arm64);
|
||||
void SetContextMIPS(MDRawContextMIPS* ctx_mips);
|
||||
void SetContextRISCV(MDRawContextRISCV* riscv);
|
||||
void SetContextRISCV64(MDRawContextRISCV64* riscv64);
|
||||
|
||||
// Free the CPU-specific context structure.
|
||||
void FreeContext();
|
||||
|
||||
private:
|
||||
// The CPU-specific context structure.
|
||||
union {
|
||||
MDRawContextBase* base;
|
||||
MDRawContextX86* x86;
|
||||
MDRawContextPPC* ppc;
|
||||
MDRawContextPPC64* ppc64;
|
||||
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;
|
||||
MDRawContextARM64* arm64;
|
||||
MDRawContextMIPS* ctx_mips;
|
||||
MDRawContextRISCV* riscv;
|
||||
MDRawContextRISCV64* riscv64;
|
||||
} context_;
|
||||
|
||||
// Store this separately because of the weirdo AMD64 context
|
||||
uint32_t context_flags_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_CONTEXT_H__
|
52
externals/breakpad/src/google_breakpad/processor/dump_object.h
vendored
Normal file
52
externals/breakpad/src/google_breakpad/processor/dump_object.h
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright 2014 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// dump_object.h: A base class for all mini/micro dump object.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// DumpObject is the base of various mini/micro dump's objects.
|
||||
class DumpObject {
|
||||
public:
|
||||
DumpObject();
|
||||
|
||||
bool valid() const { return valid_; }
|
||||
|
||||
protected:
|
||||
// DumpObjects are not valid when created. When a subclass populates its own
|
||||
// fields, it can set valid_ to true. Accessors and mutators may wish to
|
||||
// consider or alter the valid_ state as they interact with objects.
|
||||
bool valid_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_DUMP_OBJECT_H__
|
123
externals/breakpad/src/google_breakpad/processor/exception_record.h
vendored
Normal file
123
externals/breakpad/src/google_breakpad/processor/exception_record.h
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
// Copyright 2019 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// exception_record.h: A snapshot of an exception record.
|
||||
//
|
||||
// Author: Ivan Penkov
|
||||
|
||||
#ifndef THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
||||
#define THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// Additional argument that describes the exception.
|
||||
class ExceptionParameter {
|
||||
public:
|
||||
ExceptionParameter(uint64_t value, const string& description)
|
||||
: value_(value), description_(description) {}
|
||||
// Accessors. See the data declarations below.
|
||||
uint64_t value() const { return value_; }
|
||||
void set_value(uint64_t value) { value_ = value; }
|
||||
const string& description() const { return description_; }
|
||||
void set_description(const string& description) {
|
||||
description_ = description;
|
||||
}
|
||||
|
||||
private:
|
||||
// Parameter value.
|
||||
uint64_t value_;
|
||||
// Human readable description/interpretation of the above value.
|
||||
string description_;
|
||||
};
|
||||
|
||||
// A snapshot of an exception record. Contains exception record details: code,
|
||||
// flags, address, parameters.
|
||||
class ExceptionRecord {
|
||||
public:
|
||||
// Accessors. See the data declarations below.
|
||||
uint32_t code() const { return code_; }
|
||||
const string& code_description() const { return code_description_; }
|
||||
void set_code(uint32_t code, const string& description) {
|
||||
code_ = code;
|
||||
code_description_ = description;
|
||||
}
|
||||
|
||||
uint32_t flags() const { return flags_; }
|
||||
const string& flags_description() const { return flags_description_; }
|
||||
void set_flags(uint32_t flags, const string& description) {
|
||||
flags_ = flags;
|
||||
flags_description_ = description;
|
||||
}
|
||||
|
||||
uint64_t nested_exception_record_address() const {
|
||||
return nested_exception_record_address_;
|
||||
}
|
||||
void set_nested_exception_record_address(
|
||||
uint64_t nested_exception_record_address) {
|
||||
nested_exception_record_address_ = nested_exception_record_address;
|
||||
}
|
||||
|
||||
uint64_t address() const { return address_; }
|
||||
void set_address(uint64_t address) { address_ = address; }
|
||||
|
||||
const std::vector<ExceptionParameter>* parameters() const {
|
||||
return ¶meters_;
|
||||
}
|
||||
void add_parameter(uint64_t value, const string& description) {
|
||||
parameters_.push_back(ExceptionParameter(value, description));
|
||||
}
|
||||
|
||||
private:
|
||||
// Exception code.
|
||||
uint32_t code_;
|
||||
string code_description_;
|
||||
|
||||
// Exception flags.
|
||||
uint32_t flags_;
|
||||
string flags_description_;
|
||||
|
||||
// The address of an associated MDException structure. Exception records can
|
||||
// be chained together to provide additional information when nested
|
||||
// exceptions occur.
|
||||
uint64_t nested_exception_record_address_;
|
||||
|
||||
// The memory address that caused the exception. For data access errors,
|
||||
// this will be the data address that caused the fault. For code errors,
|
||||
// this will be the address of the instruction that caused the fault.
|
||||
uint64_t address_;
|
||||
|
||||
// An array of additional arguments that describe the exception.
|
||||
std::vector<ExceptionParameter> parameters_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
|
||||
#endif // THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
81
externals/breakpad/src/google_breakpad/processor/exploitability.h
vendored
Normal file
81
externals/breakpad/src/google_breakpad/processor/exploitability.h
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// exploitability_engine.h: Generic exploitability engine.
|
||||
//
|
||||
// The Exploitability class is an abstract base class providing common
|
||||
// generic methods that apply to exploitability engines for specific platforms.
|
||||
// Specific implementations will extend this class by providing run
|
||||
// methods to fill in the exploitability_ enumeration of the ProcessState
|
||||
// for a crash.
|
||||
//
|
||||
// Author: Cris Neckar
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
|
||||
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/minidump.h"
|
||||
#include "google_breakpad/processor/process_state.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class Exploitability {
|
||||
public:
|
||||
virtual ~Exploitability() {}
|
||||
|
||||
static Exploitability *ExploitabilityForPlatform(Minidump *dump,
|
||||
ProcessState *process_state);
|
||||
|
||||
// The boolean parameter signals whether the exploitability engine is
|
||||
// enabled to call out to objdump for disassembly. This is disabled by
|
||||
// default. It is used to check the identity of the instruction that
|
||||
// caused the program to crash. This should not be enabled if there are
|
||||
// portability concerns.
|
||||
static Exploitability *ExploitabilityForPlatform(Minidump *dump,
|
||||
ProcessState *process_state,
|
||||
bool enable_objdump);
|
||||
|
||||
ExploitabilityRating CheckExploitability();
|
||||
bool AddressIsAscii(uint64_t);
|
||||
|
||||
protected:
|
||||
Exploitability(Minidump *dump,
|
||||
ProcessState *process_state);
|
||||
|
||||
Minidump *dump_;
|
||||
ProcessState *process_state_;
|
||||
SystemInfo *system_info_;
|
||||
|
||||
private:
|
||||
virtual ExploitabilityRating CheckPlatformExploitability() = 0;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_H_
|
101
externals/breakpad/src/google_breakpad/processor/fast_source_line_resolver.h
vendored
Normal file
101
externals/breakpad/src/google_breakpad/processor/fast_source_line_resolver.h
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// fast_source_line_resolver.h: FastSourceLineResolver is derived from
|
||||
// SourceLineResolverBase, and is a concrete implementation of
|
||||
// SourceLineResolverInterface.
|
||||
//
|
||||
// FastSourceLineResolver is a sibling class of BasicSourceLineResolver. The
|
||||
// difference is FastSourceLineResolver loads a serialized memory chunk of data
|
||||
// which can be used directly a Module without parsing or copying of underlying
|
||||
// data. Therefore loading a symbol in FastSourceLineResolver is much faster
|
||||
// and more memory-efficient than BasicSourceLineResolver.
|
||||
//
|
||||
// See "source_line_resolver_base.h" and
|
||||
// "google_breakpad/source_line_resolver_interface.h" for more reference.
|
||||
//
|
||||
// Author: Siyang Xie (lambxsy@google.com)
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "google_breakpad/processor/source_line_resolver_base.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::map;
|
||||
|
||||
class FastSourceLineResolver : public SourceLineResolverBase {
|
||||
public:
|
||||
FastSourceLineResolver();
|
||||
virtual ~FastSourceLineResolver() { }
|
||||
|
||||
using SourceLineResolverBase::FillSourceLineInfo;
|
||||
using SourceLineResolverBase::FindCFIFrameInfo;
|
||||
using SourceLineResolverBase::FindWindowsFrameInfo;
|
||||
using SourceLineResolverBase::HasModule;
|
||||
using SourceLineResolverBase::IsModuleCorrupt;
|
||||
using SourceLineResolverBase::LoadModule;
|
||||
using SourceLineResolverBase::LoadModuleUsingMapBuffer;
|
||||
using SourceLineResolverBase::LoadModuleUsingMemoryBuffer;
|
||||
using SourceLineResolverBase::UnloadModule;
|
||||
|
||||
private:
|
||||
// Friend declarations.
|
||||
friend class ModuleComparer;
|
||||
friend class ModuleSerializer;
|
||||
friend class FastModuleFactory;
|
||||
|
||||
// Nested types that will derive from corresponding nested types defined in
|
||||
// SourceLineResolverBase.
|
||||
struct Line;
|
||||
struct Function;
|
||||
struct Inline;
|
||||
struct InlineOrigin;
|
||||
struct PublicSymbol;
|
||||
class Module;
|
||||
|
||||
// Deserialize raw memory data to construct a WindowsFrameInfo object.
|
||||
static WindowsFrameInfo CopyWFI(const char *raw_memory);
|
||||
|
||||
// FastSourceLineResolver requires the memory buffer stays alive during the
|
||||
// lifetime of a corresponding module, therefore it needs to redefine this
|
||||
// virtual method.
|
||||
virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
|
||||
|
||||
// Disallow unwanted copy ctor and assignment operator
|
||||
FastSourceLineResolver(const FastSourceLineResolver&);
|
||||
void operator=(const FastSourceLineResolver&);
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_FAST_SOURCE_LINE_RESOLVER_H__
|
78
externals/breakpad/src/google_breakpad/processor/memory_region.h
vendored
Normal file
78
externals/breakpad/src/google_breakpad/processor/memory_region.h
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// memory_region.h: Access to memory regions.
|
||||
//
|
||||
// A MemoryRegion provides virtual access to a range of memory. It is an
|
||||
// abstraction allowing the actual source of memory to be independent of
|
||||
// methods which need to access a virtual memory space.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
|
||||
|
||||
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
||||
class MemoryRegion {
|
||||
public:
|
||||
virtual ~MemoryRegion() {}
|
||||
|
||||
// The base address of this memory region.
|
||||
virtual uint64_t GetBase() const = 0;
|
||||
|
||||
// The size of this memory region.
|
||||
virtual uint32_t GetSize() const = 0;
|
||||
|
||||
// Access to data of various sizes within the memory region. address
|
||||
// is a pointer to read, and it must lie within the memory region as
|
||||
// defined by its base address and size. The location pointed to by
|
||||
// value is set to the value at address. Byte-swapping is performed
|
||||
// if necessary so that the value is appropriate for the running
|
||||
// program. Returns true on success. Fails and returns false if address
|
||||
// is out of the region's bounds (after considering the width of value),
|
||||
// or for other types of errors.
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const = 0;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const = 0;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const = 0;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const = 0;
|
||||
|
||||
// Print a human-readable representation of the object to stdout.
|
||||
virtual void Print() const = 0;
|
||||
};
|
||||
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_MEMORY_REGION_H__
|
134
externals/breakpad/src/google_breakpad/processor/microdump.h
vendored
Normal file
134
externals/breakpad/src/google_breakpad/processor/microdump.h
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
// Copyright 2014 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// microdump.h: A microdump reader. Microdump is a minified variant of a
|
||||
// minidump (see minidump.h for documentation) which contains the minimum
|
||||
// amount of information required to get a stack trace for the crashing thread.
|
||||
// The information contained in a microdump is:
|
||||
// - the crashing thread stack
|
||||
// - system information (os type / version)
|
||||
// - cpu context (state of the registers)
|
||||
// - list of mmaps
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/scoped_ptr.h"
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/processor/dump_context.h"
|
||||
#include "google_breakpad/processor/memory_region.h"
|
||||
#include "google_breakpad/processor/system_info.h"
|
||||
#include "processor/basic_code_modules.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// MicrodumpModuleList contains all of the loaded code modules for a process
|
||||
// in the form of MicrodumpModules. It maintains a vector of these modules
|
||||
// and provides access to a code module corresponding to a specific address.
|
||||
class MicrodumpModules : public BasicCodeModules {
|
||||
public:
|
||||
// Takes over ownership of |module|.
|
||||
void Add(const CodeModule* module);
|
||||
|
||||
// Enables/disables module address range shrink.
|
||||
void SetEnableModuleShrink(bool is_enabled);
|
||||
};
|
||||
|
||||
// MicrodumpContext carries a CPU-specific context.
|
||||
// See dump_context.h for documentation.
|
||||
class MicrodumpContext : public DumpContext {
|
||||
public:
|
||||
virtual void SetContextARM(MDRawContextARM* arm);
|
||||
virtual void SetContextARM64(MDRawContextARM64* arm64);
|
||||
virtual void SetContextX86(MDRawContextX86* x86);
|
||||
virtual void SetContextMIPS(MDRawContextMIPS* mips32);
|
||||
virtual void SetContextMIPS64(MDRawContextMIPS* mips64);
|
||||
};
|
||||
|
||||
// This class provides access to microdump memory regions.
|
||||
// See memory_region.h for documentation.
|
||||
class MicrodumpMemoryRegion : public MemoryRegion {
|
||||
public:
|
||||
MicrodumpMemoryRegion();
|
||||
virtual ~MicrodumpMemoryRegion() {}
|
||||
|
||||
// Set this region's address and contents. If we have placed an
|
||||
// instance of this class in a test fixture class, individual tests
|
||||
// can use this to provide the region's contents.
|
||||
void Init(uint64_t base_address, const std::vector<uint8_t>& contents);
|
||||
|
||||
virtual uint64_t GetBase() const;
|
||||
virtual uint32_t GetSize() const;
|
||||
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint8_t* value) const;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint16_t* value) const;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint32_t* value) const;
|
||||
virtual bool GetMemoryAtAddress(uint64_t address, uint64_t* value) const;
|
||||
|
||||
// Print a human-readable representation of the object to stdout.
|
||||
virtual void Print() const;
|
||||
|
||||
private:
|
||||
// Fetch a little-endian value from ADDRESS in contents_ whose size
|
||||
// is BYTES, and store it in *VALUE. Returns true on success.
|
||||
template<typename ValueType>
|
||||
bool GetMemoryLittleEndian(uint64_t address, ValueType* value) const;
|
||||
|
||||
uint64_t base_address_;
|
||||
std::vector<uint8_t> contents_;
|
||||
};
|
||||
|
||||
// Microdump is the user's interface to a microdump file. It provides access to
|
||||
// the microdump's context, memory regions and modules.
|
||||
class Microdump {
|
||||
public:
|
||||
explicit Microdump(const string& contents);
|
||||
virtual ~Microdump() {}
|
||||
|
||||
DumpContext* GetContext() { return context_.get(); }
|
||||
MicrodumpMemoryRegion* GetMemory() { return stack_region_.get(); }
|
||||
MicrodumpModules* GetModules() { return modules_.get(); }
|
||||
SystemInfo* GetSystemInfo() { return system_info_.get(); }
|
||||
|
||||
string GetCrashReason() { return crash_reason_; }
|
||||
uint64_t GetCrashAddress() { return crash_address_; }
|
||||
private:
|
||||
scoped_ptr<MicrodumpContext> context_;
|
||||
scoped_ptr<MicrodumpMemoryRegion> stack_region_;
|
||||
scoped_ptr<MicrodumpModules> modules_;
|
||||
scoped_ptr<SystemInfo> system_info_;
|
||||
string crash_reason_;
|
||||
uint64_t crash_address_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_H__
|
63
externals/breakpad/src/google_breakpad/processor/microdump_processor.h
vendored
Normal file
63
externals/breakpad/src/google_breakpad/processor/microdump_processor.h
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
// Copyright 2014 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The processor for microdump (a reduced dump containing only the state of the
|
||||
// crashing thread). See crbug.com/410294 for more info and design docs.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/processor/process_result.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class Microdump;
|
||||
class ProcessState;
|
||||
class StackFrameSymbolizer;
|
||||
|
||||
class MicrodumpProcessor {
|
||||
public:
|
||||
// Initializes the MicrodumpProcessor with a stack frame symbolizer.
|
||||
// Does not take ownership of frame_symbolizer, which must NOT be NULL.
|
||||
explicit MicrodumpProcessor(StackFrameSymbolizer* frame_symbolizer);
|
||||
|
||||
virtual ~MicrodumpProcessor();
|
||||
|
||||
// Processes the microdump contents and fills process_state with the result.
|
||||
google_breakpad::ProcessResult Process(Microdump* microdump,
|
||||
ProcessState* process_state);
|
||||
private:
|
||||
StackFrameSymbolizer* frame_symbolizer_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_MICRODUMP_PROCESSOR_H__
|
1454
externals/breakpad/src/google_breakpad/processor/minidump.h
vendored
Normal file
1454
externals/breakpad/src/google_breakpad/processor/minidump.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
164
externals/breakpad/src/google_breakpad/processor/minidump_processor.h
vendored
Normal file
164
externals/breakpad/src/google_breakpad/processor/minidump_processor.h
vendored
Normal file
|
@ -0,0 +1,164 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/process_result.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class Minidump;
|
||||
class ProcessState;
|
||||
class StackFrameSymbolizer;
|
||||
class SourceLineResolverInterface;
|
||||
class SymbolSupplier;
|
||||
struct SystemInfo;
|
||||
|
||||
class MinidumpProcessor {
|
||||
public:
|
||||
// Initializes this MinidumpProcessor. supplier should be an
|
||||
// implementation of the SymbolSupplier abstract base class.
|
||||
MinidumpProcessor(SymbolSupplier* supplier,
|
||||
SourceLineResolverInterface* resolver);
|
||||
|
||||
// Initializes the MinidumpProcessor with the option of
|
||||
// enabling the exploitability framework to analyze dumps
|
||||
// for probable security relevance.
|
||||
MinidumpProcessor(SymbolSupplier* supplier,
|
||||
SourceLineResolverInterface* resolver,
|
||||
bool enable_exploitability);
|
||||
|
||||
// Initializes the MinidumpProcessor with source line resolver helper, and
|
||||
// the option of enabling the exploitability framework to analyze dumps
|
||||
// for probable security relevance.
|
||||
// Does not take ownership of resolver_helper, which must NOT be NULL.
|
||||
MinidumpProcessor(StackFrameSymbolizer* stack_frame_symbolizer,
|
||||
bool enable_exploitability);
|
||||
|
||||
~MinidumpProcessor();
|
||||
|
||||
// Processes the minidump file and fills process_state with the result.
|
||||
ProcessResult Process(const string& minidump_file,
|
||||
ProcessState* process_state);
|
||||
|
||||
// Processes the minidump structure and fills process_state with the
|
||||
// result.
|
||||
ProcessResult Process(Minidump* minidump,
|
||||
ProcessState* process_state);
|
||||
// Populates the cpu_* fields of the |info| parameter with textual
|
||||
// representations of the CPU type that the minidump in |dump| was
|
||||
// produced on. Returns false if this information is not available in
|
||||
// the minidump.
|
||||
static bool GetCPUInfo(Minidump* dump, SystemInfo* info);
|
||||
|
||||
// Populates the os_* fields of the |info| parameter with textual
|
||||
// representations of the operating system that the minidump in |dump|
|
||||
// was produced on. Returns false if this information is not available in
|
||||
// the minidump.
|
||||
static bool GetOSInfo(Minidump* dump, SystemInfo* info);
|
||||
|
||||
// Populates the |process_create_time| parameter with the create time of the
|
||||
// crashed process. Returns false if this information is not available in
|
||||
// the minidump |dump|.
|
||||
static bool GetProcessCreateTime(Minidump* dump,
|
||||
uint32_t* process_create_time);
|
||||
|
||||
// Returns a textual representation of the reason that a crash occurred,
|
||||
// if the minidump in dump was produced as a result of a crash. Returns
|
||||
// an empty string if this information cannot be determined. If address
|
||||
// is non-NULL, it will be set to contain the address that caused the
|
||||
// exception, if this information is available. This will be a code
|
||||
// address when the crash was caused by problems such as illegal
|
||||
// instructions or divisions by zero, or a data address when the crash
|
||||
// was caused by a memory access violation. If enable_objdump is set, this
|
||||
// may use disassembly to compute the faulting address.
|
||||
static string GetCrashReason(Minidump* dump, uint64_t* address,
|
||||
bool enable_objdump);
|
||||
|
||||
// This function returns true if the passed-in error code is
|
||||
// something unrecoverable(i.e. retry should not happen). For
|
||||
// instance, if the minidump is corrupt, then it makes no sense to
|
||||
// retry as we won't be able to glean additional information.
|
||||
// However, as an example of the other case, the symbol supplier can
|
||||
// return an error code indicating it was 'interrupted', which can
|
||||
// happen of the symbols are fetched from a remote store, and a
|
||||
// retry might be successful later on.
|
||||
// You should not call this method with PROCESS_OK! Test for
|
||||
// that separately before calling this.
|
||||
static bool IsErrorUnrecoverable(ProcessResult p) {
|
||||
assert(p != PROCESS_OK);
|
||||
return (p != PROCESS_SYMBOL_SUPPLIER_INTERRUPTED);
|
||||
}
|
||||
|
||||
// Returns a textual representation of an assertion included
|
||||
// in the minidump. Returns an empty string if this information
|
||||
// does not exist or cannot be determined.
|
||||
static string GetAssertion(Minidump* dump);
|
||||
|
||||
// Sets the flag to enable/disable use of objdump during normal crash
|
||||
// processing. This is independent from the flag for use of objdump during
|
||||
// exploitability analysis.
|
||||
void set_enable_objdump(bool enabled) { enable_objdump_ = enabled; }
|
||||
|
||||
// Sets the flag to enable/disable use of objdump during exploitability
|
||||
// analysis. This is independent from the flag for use of objdump during
|
||||
// normal crash processing.
|
||||
void set_enable_objdump_for_exploitability(bool enabled) {
|
||||
enable_objdump_for_exploitability_ = enabled;
|
||||
}
|
||||
|
||||
private:
|
||||
StackFrameSymbolizer* frame_symbolizer_;
|
||||
// Indicate whether resolver_helper_ is owned by this instance.
|
||||
bool own_frame_symbolizer_;
|
||||
|
||||
// This flag enables the exploitability scanner which attempts to
|
||||
// guess how likely it is that the crash represents an exploitable
|
||||
// memory corruption issue.
|
||||
bool enable_exploitability_;
|
||||
|
||||
// This flag permits the processor to shell out to objdump for purposes of
|
||||
// disassembly during normal crash processing, but not during exploitability
|
||||
// analysis.
|
||||
bool enable_objdump_;
|
||||
|
||||
// This flag permits the exploitability scanner to shell out to objdump for
|
||||
// purposes of disassembly. This results in significantly more overhead than
|
||||
// the enable_objdump_ flag.
|
||||
bool enable_objdump_for_exploitability_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
|
60
externals/breakpad/src/google_breakpad/processor/proc_maps_linux.h
vendored
Normal file
60
externals/breakpad/src/google_breakpad/processor/proc_maps_linux.h
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
// Copyright 2013 Google LLC
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef BASE_DEBUG_PROC_MAPS_LINUX_H_
|
||||
#define BASE_DEBUG_PROC_MAPS_LINUX_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// Describes a region of mapped memory and the path of the file mapped.
|
||||
struct MappedMemoryRegion {
|
||||
enum Permission {
|
||||
READ = 1 << 0,
|
||||
WRITE = 1 << 1,
|
||||
EXECUTE = 1 << 2,
|
||||
PRIVATE = 1 << 3, // If set, region is private, otherwise it is shared.
|
||||
};
|
||||
|
||||
// The address range [start,end) of mapped memory.
|
||||
uint64_t start;
|
||||
uint64_t end;
|
||||
|
||||
// Byte offset into |path| of the range mapped into memory.
|
||||
uint64_t offset;
|
||||
|
||||
// Bitmask of read/write/execute/private/shared permissions.
|
||||
uint8_t permissions;
|
||||
|
||||
// Major and minor devices.
|
||||
uint8_t major_device;
|
||||
uint8_t minor_device;
|
||||
|
||||
// Value of the inode.
|
||||
uint64_t inode;
|
||||
|
||||
// Name of the file mapped into memory.
|
||||
//
|
||||
// NOTE: path names aren't guaranteed to point at valid files. For example,
|
||||
// "[heap]" and "[stack]" are used to represent the location of the process'
|
||||
// heap and stack, respectively.
|
||||
string path;
|
||||
|
||||
// The line from /proc/<pid>/maps that this struct represents.
|
||||
string line;
|
||||
};
|
||||
|
||||
// Parses /proc/<pid>/maps input data and stores in |regions|. Returns true
|
||||
// and updates |regions| if and only if all of |input| was successfully parsed.
|
||||
bool ParseProcMaps(const string& input,
|
||||
std::vector<MappedMemoryRegion>* regions);
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // BASE_DEBUG_PROC_MAPS_LINUX_H_
|
69
externals/breakpad/src/google_breakpad/processor/process_result.h
vendored
Normal file
69
externals/breakpad/src/google_breakpad/processor/process_result.h
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Copyright 2014 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
// Return type for MinidumpProcessor or MicrodumpProcessor's Process()
|
||||
enum ProcessResult {
|
||||
PROCESS_OK, // The dump was processed
|
||||
// successfully.
|
||||
|
||||
PROCESS_ERROR_MINIDUMP_NOT_FOUND, // The minidump file was not
|
||||
// found.
|
||||
|
||||
PROCESS_ERROR_NO_MINIDUMP_HEADER, // The minidump file had no
|
||||
// header.
|
||||
|
||||
PROCESS_ERROR_NO_THREAD_LIST, // The minidump file has no
|
||||
// thread list.
|
||||
|
||||
PROCESS_ERROR_GETTING_THREAD, // There was an error getting one
|
||||
// thread's data from th dump.
|
||||
|
||||
PROCESS_ERROR_GETTING_THREAD_ID, // There was an error getting a
|
||||
// thread id from the thread's
|
||||
// data.
|
||||
|
||||
PROCESS_ERROR_DUPLICATE_REQUESTING_THREADS, // There was more than one
|
||||
// requesting thread.
|
||||
|
||||
PROCESS_SYMBOL_SUPPLIER_INTERRUPTED, // The dump processing was
|
||||
// interrupted by the
|
||||
// SymbolSupplier(not fatal).
|
||||
|
||||
PROCESS_ERROR_GETTING_THREAD_NAME, // There was an error getting one
|
||||
// thread's name from the dump.
|
||||
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_RESULT_H__
|
214
externals/breakpad/src/google_breakpad/processor/process_state.h
vendored
Normal file
214
externals/breakpad/src/google_breakpad/processor/process_state.h
vendored
Normal file
|
@ -0,0 +1,214 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// process_state.h: A snapshot of a process, in a fully-digested state.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/code_modules.h"
|
||||
#include "google_breakpad/processor/exception_record.h"
|
||||
#include "google_breakpad/processor/minidump.h"
|
||||
#include "google_breakpad/processor/system_info.h"
|
||||
#include "processor/linked_ptr.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::vector;
|
||||
|
||||
class CallStack;
|
||||
class CodeModules;
|
||||
|
||||
enum ExploitabilityRating {
|
||||
EXPLOITABILITY_HIGH, // The crash likely represents
|
||||
// a exploitable memory corruption
|
||||
// vulnerability.
|
||||
|
||||
EXPLOITABILITY_MEDIUM, // The crash appears to corrupt
|
||||
// memory in a way which may be
|
||||
// exploitable in some situations.
|
||||
|
||||
EXPLOITABLITY_MEDIUM = EXPLOITABILITY_MEDIUM, // an old misspelling
|
||||
|
||||
EXPLOITABILITY_LOW, // The crash either does not corrupt
|
||||
// memory directly or control over
|
||||
// the affected data is limited. The
|
||||
// issue may still be exploitable
|
||||
// on certain platforms or situations.
|
||||
|
||||
EXPLOITABILITY_INTERESTING, // The crash does not appear to be
|
||||
// directly exploitable. However it
|
||||
// represents a condition which should
|
||||
// be further analyzed.
|
||||
|
||||
EXPLOITABILITY_NONE, // The crash does not appear to represent
|
||||
// an exploitable condition.
|
||||
|
||||
EXPLOITABILITY_NOT_ANALYZED, // The crash was not analyzed for
|
||||
// exploitability because the engine
|
||||
// was disabled.
|
||||
|
||||
EXPLOITABILITY_ERR_NOENGINE, // The supplied minidump's platform does
|
||||
// not have a exploitability engine
|
||||
// associated with it.
|
||||
|
||||
EXPLOITABILITY_ERR_PROCESSING // An error occured within the
|
||||
// exploitability engine and no rating
|
||||
// was calculated.
|
||||
};
|
||||
|
||||
class ProcessState {
|
||||
public:
|
||||
ProcessState() : modules_(NULL), unloaded_modules_(NULL) { Clear(); }
|
||||
~ProcessState();
|
||||
|
||||
// Resets the ProcessState to its default values
|
||||
void Clear();
|
||||
|
||||
// Accessors. See the data declarations below.
|
||||
uint32_t time_date_stamp() const { return time_date_stamp_; }
|
||||
uint32_t process_create_time() const { return process_create_time_; }
|
||||
bool crashed() const { return crashed_; }
|
||||
string crash_reason() const { return crash_reason_; }
|
||||
uint64_t crash_address() const { return crash_address_; }
|
||||
string assertion() const { return assertion_; }
|
||||
int requesting_thread() const { return requesting_thread_; }
|
||||
const ExceptionRecord* exception_record() const { return &exception_record_; }
|
||||
const vector<CallStack*>* threads() const { return &threads_; }
|
||||
const vector<MemoryRegion*>* thread_memory_regions() const {
|
||||
return &thread_memory_regions_;
|
||||
}
|
||||
const vector<string>* thread_names() const { return &thread_names_; }
|
||||
const SystemInfo* system_info() const { return &system_info_; }
|
||||
const CodeModules* modules() const { return modules_; }
|
||||
const CodeModules* unloaded_modules() const { return unloaded_modules_; }
|
||||
const vector<linked_ptr<const CodeModule> >* shrunk_range_modules() const {
|
||||
return &shrunk_range_modules_;
|
||||
}
|
||||
const vector<const CodeModule*>* modules_without_symbols() const {
|
||||
return &modules_without_symbols_;
|
||||
}
|
||||
const vector<const CodeModule*>* modules_with_corrupt_symbols() const {
|
||||
return &modules_with_corrupt_symbols_;
|
||||
}
|
||||
ExploitabilityRating exploitability() const { return exploitability_; }
|
||||
|
||||
private:
|
||||
// MinidumpProcessor and MicrodumpProcessor are responsible for building
|
||||
// ProcessState objects.
|
||||
friend class MinidumpProcessor;
|
||||
friend class MicrodumpProcessor;
|
||||
|
||||
// The time-date stamp of the minidump (time_t format)
|
||||
uint32_t time_date_stamp_;
|
||||
|
||||
// The time-date stamp when the process was created (time_t format)
|
||||
uint32_t process_create_time_;
|
||||
|
||||
// True if the process crashed, false if the dump was produced outside
|
||||
// of an exception handler.
|
||||
bool crashed_;
|
||||
|
||||
// If the process crashed, the type of crash. OS- and possibly CPU-
|
||||
// specific. For example, "EXCEPTION_ACCESS_VIOLATION" (Windows),
|
||||
// "EXC_BAD_ACCESS / KERN_INVALID_ADDRESS" (Mac OS X), "SIGSEGV"
|
||||
// (other Unix).
|
||||
string crash_reason_;
|
||||
|
||||
// If the process crashed, and if crash_reason implicates memory,
|
||||
// the memory address that caused the crash. For data access errors,
|
||||
// this will be the data address that caused the fault. For code errors,
|
||||
// this will be the address of the instruction that caused the fault.
|
||||
uint64_t crash_address_;
|
||||
|
||||
// If there was an assertion that was hit, a textual representation
|
||||
// of that assertion, possibly including the file and line at which
|
||||
// it occurred.
|
||||
string assertion_;
|
||||
|
||||
// The index of the thread that requested a dump be written in the
|
||||
// threads vector. If a dump was produced as a result of a crash, this
|
||||
// will point to the thread that crashed. If the dump was produced as
|
||||
// by user code without crashing, and the dump contains extended Breakpad
|
||||
// information, this will point to the thread that requested the dump.
|
||||
// If the dump was not produced as a result of an exception and no
|
||||
// extended Breakpad information is present, this field will be set to -1,
|
||||
// indicating that the dump thread is not available.
|
||||
int requesting_thread_;
|
||||
|
||||
// Exception record details: code, flags, address, parameters.
|
||||
ExceptionRecord exception_record_;
|
||||
|
||||
// Stacks for each thread (except possibly the exception handler
|
||||
// thread) at the time of the crash.
|
||||
vector<CallStack*> threads_;
|
||||
vector<MemoryRegion*> thread_memory_regions_;
|
||||
|
||||
// Names of each thread at the time of the crash, one for each entry in
|
||||
// threads_. Note that a thread's name might be empty if there was no
|
||||
// corresponding ThreadNamesStream in the minidump, or if a particular thread
|
||||
// ID was not present in the THREAD_NAME_LIST.
|
||||
vector<string> thread_names_;
|
||||
|
||||
// OS and CPU information.
|
||||
SystemInfo system_info_;
|
||||
|
||||
// The modules that were loaded into the process represented by the
|
||||
// ProcessState.
|
||||
const CodeModules *modules_;
|
||||
|
||||
// The modules that have been unloaded from the process represented by the
|
||||
// ProcessState.
|
||||
const CodeModules *unloaded_modules_;
|
||||
|
||||
// The modules which virtual address ranges were shrunk down due to
|
||||
// virtual address conflicts.
|
||||
vector<linked_ptr<const CodeModule> > shrunk_range_modules_;
|
||||
|
||||
// The modules that didn't have symbols when the report was processed.
|
||||
vector<const CodeModule*> modules_without_symbols_;
|
||||
|
||||
// The modules that had corrupt symbols when the report was processed.
|
||||
vector<const CodeModule*> modules_with_corrupt_symbols_;
|
||||
|
||||
// The exploitability rating as determined by the exploitability
|
||||
// engine. When the exploitability engine is not enabled this
|
||||
// defaults to EXPLOITABILITY_NOT_ANALYZED.
|
||||
ExploitabilityRating exploitability_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_PROCESS_STATE_H__
|
132
externals/breakpad/src/google_breakpad/processor/source_line_resolver_base.h
vendored
Normal file
132
externals/breakpad/src/google_breakpad/processor/source_line_resolver_base.h
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// source_line_resolver_base.h: SourceLineResolverBase, an (incomplete)
|
||||
// implementation of SourceLineResolverInterface. It serves as a common base
|
||||
// class for concrete implementations: FastSourceLineResolver and
|
||||
// BasicSourceLineResolver. It is designed for refactoring that removes
|
||||
// code redundancy in the two concrete source line resolver classes.
|
||||
//
|
||||
// See "google_breakpad/processor/source_line_resolver_interface.h" for more
|
||||
// documentation.
|
||||
|
||||
// Author: Siyang Xie (lambxsy@google.com)
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "google_breakpad/processor/source_line_resolver_interface.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::map;
|
||||
using std::set;
|
||||
|
||||
// Forward declaration.
|
||||
// ModuleFactory is a simple factory interface for creating a Module instance
|
||||
// at run-time.
|
||||
class ModuleFactory;
|
||||
|
||||
class SourceLineResolverBase : public SourceLineResolverInterface {
|
||||
public:
|
||||
// Read the symbol_data from a file with given file_name.
|
||||
// The part of code was originally in BasicSourceLineResolver::Module's
|
||||
// LoadMap() method.
|
||||
// Place dynamically allocated heap buffer in symbol_data. Caller has the
|
||||
// ownership of the buffer, and should call delete [] to free the buffer.
|
||||
static bool ReadSymbolFile(const string& file_name,
|
||||
char** symbol_data,
|
||||
size_t* symbol_data_size);
|
||||
|
||||
protected:
|
||||
// Users are not allowed create SourceLineResolverBase instance directly.
|
||||
SourceLineResolverBase(ModuleFactory* module_factory);
|
||||
virtual ~SourceLineResolverBase();
|
||||
|
||||
// Virtual methods inherited from SourceLineResolverInterface.
|
||||
virtual bool LoadModule(const CodeModule* module, const string& map_file);
|
||||
virtual bool LoadModuleUsingMapBuffer(const CodeModule* module,
|
||||
const string& map_buffer);
|
||||
virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module,
|
||||
char* memory_buffer,
|
||||
size_t memory_buffer_size);
|
||||
virtual bool ShouldDeleteMemoryBufferAfterLoadModule();
|
||||
virtual void UnloadModule(const CodeModule* module);
|
||||
virtual bool HasModule(const CodeModule* module);
|
||||
virtual bool IsModuleCorrupt(const CodeModule* module);
|
||||
virtual void FillSourceLineInfo(
|
||||
StackFrame* frame,
|
||||
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
|
||||
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
|
||||
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);
|
||||
|
||||
// Nested structs and classes.
|
||||
struct InlineOrigin;
|
||||
struct Inline;
|
||||
struct Line;
|
||||
struct Function;
|
||||
struct PublicSymbol;
|
||||
struct CompareString {
|
||||
bool operator()(const string& s1, const string& s2) const;
|
||||
};
|
||||
// Module is an interface for an in-memory symbol file.
|
||||
class Module;
|
||||
class AutoFileCloser;
|
||||
|
||||
// All of the modules that are loaded.
|
||||
typedef map<string, Module*, CompareString> ModuleMap;
|
||||
ModuleMap* modules_;
|
||||
|
||||
// The loaded modules that were detecting to be corrupt during load.
|
||||
typedef set<string, CompareString> ModuleSet;
|
||||
ModuleSet* corrupt_modules_;
|
||||
|
||||
// All of heap-allocated buffers that are owned locally by resolver.
|
||||
typedef std::map<string, char*, CompareString> MemoryMap;
|
||||
MemoryMap* memory_buffers_;
|
||||
|
||||
// Creates a concrete module at run-time.
|
||||
ModuleFactory* module_factory_;
|
||||
|
||||
private:
|
||||
// ModuleFactory needs to have access to protected type Module.
|
||||
friend class ModuleFactory;
|
||||
|
||||
// Disallow unwanted copy ctor and assignment operator
|
||||
SourceLineResolverBase(const SourceLineResolverBase&);
|
||||
void operator=(const SourceLineResolverBase&);
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_BASE_H__
|
123
externals/breakpad/src/google_breakpad/processor/source_line_resolver_interface.h
vendored
Normal file
123
externals/breakpad/src/google_breakpad/processor/source_line_resolver_interface.h
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
// -*- mode: C++ -*-
|
||||
|
||||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Abstract interface to return function/file/line info for a memory address.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/code_module.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
struct StackFrame;
|
||||
struct WindowsFrameInfo;
|
||||
class CFIFrameInfo;
|
||||
|
||||
class SourceLineResolverInterface {
|
||||
public:
|
||||
typedef uint64_t MemAddr;
|
||||
|
||||
virtual ~SourceLineResolverInterface() {}
|
||||
|
||||
// Adds a module to this resolver, returning true on success.
|
||||
//
|
||||
// module should have at least the code_file, debug_file,
|
||||
// and debug_identifier members populated.
|
||||
//
|
||||
// map_file should contain line/address mappings for this module.
|
||||
virtual bool LoadModule(const CodeModule* module,
|
||||
const string& map_file) = 0;
|
||||
// Same as above, but takes the contents of a pre-read map buffer
|
||||
virtual bool LoadModuleUsingMapBuffer(const CodeModule* module,
|
||||
const string& map_buffer) = 0;
|
||||
|
||||
// Add an interface to load symbol using C-String data instead of string.
|
||||
// This is useful in the optimization design for avoiding unnecessary copying
|
||||
// of symbol data, in order to improve memory efficiency.
|
||||
// LoadModuleUsingMemoryBuffer() does NOT take ownership of memory_buffer.
|
||||
// LoadModuleUsingMemoryBuffer() null terminates the passed in buffer, if
|
||||
// the last character is not a null terminator.
|
||||
virtual bool LoadModuleUsingMemoryBuffer(const CodeModule* module,
|
||||
char* memory_buffer,
|
||||
size_t memory_buffer_size) = 0;
|
||||
|
||||
// Return true if the memory buffer should be deleted immediately after
|
||||
// LoadModuleUsingMemoryBuffer(). Return false if the memory buffer has to be
|
||||
// alive during the lifetime of the corresponding Module.
|
||||
virtual bool ShouldDeleteMemoryBufferAfterLoadModule() = 0;
|
||||
|
||||
// Request that the specified module be unloaded from this resolver.
|
||||
// A resolver may choose to ignore such a request.
|
||||
virtual void UnloadModule(const CodeModule* module) = 0;
|
||||
|
||||
// Returns true if the module has been loaded.
|
||||
virtual bool HasModule(const CodeModule* module) = 0;
|
||||
|
||||
// Returns true if the module has been loaded and it is corrupt.
|
||||
virtual bool IsModuleCorrupt(const CodeModule* module) = 0;
|
||||
|
||||
// Fills in the function_base, function_name, source_file_name,
|
||||
// and source_line fields of the StackFrame. The instruction and
|
||||
// module_name fields must already be filled in. If inlined_frames is not
|
||||
// nullptr, it will try to construct inlined frames by adding them into
|
||||
// inlined_frames in an order from outermost frame to inner most frame.
|
||||
virtual void FillSourceLineInfo(
|
||||
StackFrame* frame,
|
||||
std::deque<std::unique_ptr<StackFrame>>* inlined_frames) = 0;
|
||||
|
||||
// If Windows stack walking information is available covering
|
||||
// FRAME's instruction address, return a WindowsFrameInfo structure
|
||||
// describing it. If the information is not available, returns NULL.
|
||||
// A NULL return value does not indicate an error. The caller takes
|
||||
// ownership of any returned WindowsFrameInfo object.
|
||||
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame) = 0;
|
||||
|
||||
// If CFI stack walking information is available covering ADDRESS,
|
||||
// return a CFIFrameInfo structure describing it. If the information
|
||||
// is not available, return NULL. The caller takes ownership of any
|
||||
// returned CFIFrameInfo object.
|
||||
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame) = 0;
|
||||
|
||||
protected:
|
||||
// SourceLineResolverInterface cannot be instantiated except by subclasses
|
||||
SourceLineResolverInterface() {}
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_SOURCE_LINE_RESOLVER_INTERFACE_H__
|
158
externals/breakpad/src/google_breakpad/processor/stack_frame.h
vendored
Normal file
158
externals/breakpad/src/google_breakpad/processor/stack_frame.h
vendored
Normal file
|
@ -0,0 +1,158 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class CodeModule;
|
||||
|
||||
struct StackFrame {
|
||||
// Indicates how well the instruction pointer derived during
|
||||
// stack walking is trusted. Since the stack walker can resort to
|
||||
// stack scanning, it can wind up with dubious frames.
|
||||
// In rough order of "trust metric".
|
||||
enum FrameTrust {
|
||||
FRAME_TRUST_NONE, // Unknown
|
||||
FRAME_TRUST_SCAN, // Scanned the stack, found this
|
||||
FRAME_TRUST_CFI_SCAN, // Found while scanning stack using call frame info
|
||||
FRAME_TRUST_FP, // Derived from frame pointer
|
||||
FRAME_TRUST_CFI, // Derived from call frame info
|
||||
// Explicitly provided by some external stack walker.
|
||||
FRAME_TRUST_PREWALKED,
|
||||
FRAME_TRUST_CONTEXT, // Given as instruction pointer in a context
|
||||
FRAME_TRUST_INLINE, // Found by inline records in symbol files.
|
||||
// Derived from leaf function by simulating a return.
|
||||
FRAME_TRUST_LEAF,
|
||||
};
|
||||
|
||||
StackFrame()
|
||||
: instruction(),
|
||||
module(NULL),
|
||||
function_name(),
|
||||
function_base(),
|
||||
source_file_name(),
|
||||
source_line(0),
|
||||
source_line_base(),
|
||||
trust(FRAME_TRUST_NONE),
|
||||
is_multiple(false) {}
|
||||
virtual ~StackFrame() {}
|
||||
|
||||
// Return a string describing how this stack frame was found
|
||||
// by the stackwalker.
|
||||
string trust_description() const {
|
||||
switch (trust) {
|
||||
case StackFrame::FRAME_TRUST_CONTEXT:
|
||||
return "given as instruction pointer in context";
|
||||
case StackFrame::FRAME_TRUST_PREWALKED:
|
||||
return "recovered by external stack walker";
|
||||
case StackFrame::FRAME_TRUST_CFI:
|
||||
return "call frame info";
|
||||
case StackFrame::FRAME_TRUST_CFI_SCAN:
|
||||
return "call frame info with scanning";
|
||||
case StackFrame::FRAME_TRUST_FP:
|
||||
return "previous frame's frame pointer";
|
||||
case StackFrame::FRAME_TRUST_SCAN:
|
||||
return "stack scanning";
|
||||
case StackFrame::FRAME_TRUST_INLINE:
|
||||
return "inline record";
|
||||
case StackFrame::FRAME_TRUST_LEAF:
|
||||
return "simulating a return from leaf function";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
// Return the actual return address, as saved on the stack or in a
|
||||
// register. See the comments for 'instruction', below, for details.
|
||||
virtual uint64_t ReturnAddress() const { return instruction; }
|
||||
|
||||
// The program counter location as an absolute virtual address.
|
||||
//
|
||||
// - For the innermost called frame in a stack, this will be an exact
|
||||
// program counter or instruction pointer value.
|
||||
//
|
||||
// - For all other frames, this address is within the instruction that
|
||||
// caused execution to branch to this frame's callee (although it may
|
||||
// not point to the exact beginning of that instruction). This ensures
|
||||
// that, when we look up the source code location for this frame, we
|
||||
// get the source location of the call, not of the point at which
|
||||
// control will resume when the call returns, which may be on the next
|
||||
// line. (If the compiler knows the callee never returns, it may even
|
||||
// place the call instruction at the very end of the caller's machine
|
||||
// code, such that the "return address" (which will never be used)
|
||||
// immediately after the call instruction is in an entirely different
|
||||
// function, perhaps even from a different source file.)
|
||||
//
|
||||
// On some architectures, the return address as saved on the stack or in
|
||||
// a register is fine for looking up the point of the call. On others, it
|
||||
// requires adjustment. ReturnAddress returns the address as saved by the
|
||||
// machine.
|
||||
uint64_t instruction;
|
||||
|
||||
// The module in which the instruction resides.
|
||||
const CodeModule *module;
|
||||
|
||||
// The function name, may be omitted if debug symbols are not available.
|
||||
string function_name;
|
||||
|
||||
// The start address of the function, may be omitted if debug symbols
|
||||
// are not available.
|
||||
uint64_t function_base;
|
||||
|
||||
// The source file name, may be omitted if debug symbols are not available.
|
||||
string source_file_name;
|
||||
|
||||
// The (1-based) source line number, may be omitted if debug symbols are
|
||||
// not available.
|
||||
int source_line;
|
||||
|
||||
// The start address of the source line, may be omitted if debug symbols
|
||||
// are not available.
|
||||
uint64_t source_line_base;
|
||||
|
||||
// Amount of trust the stack walker has in the instruction pointer
|
||||
// of this frame.
|
||||
FrameTrust trust;
|
||||
|
||||
// True if the frame corresponds to multiple functions, for example as the
|
||||
// result of identical code folding by the linker. In that case the function
|
||||
// name, filename, etc. information above represents the state of an arbitrary
|
||||
// one of these functions.
|
||||
bool is_multiple;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_H__
|
519
externals/breakpad/src/google_breakpad/processor/stack_frame_cpu.h
vendored
Normal file
519
externals/breakpad/src/google_breakpad/processor/stack_frame_cpu.h
vendored
Normal file
|
@ -0,0 +1,519 @@
|
|||
// -*- mode: c++ -*-
|
||||
|
||||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// stack_frame_cpu.h: CPU-specific StackFrame extensions.
|
||||
//
|
||||
// These types extend the StackFrame structure to carry CPU-specific register
|
||||
// state. They are defined in this header instead of stack_frame.h to
|
||||
// avoid the need to include minidump_format.h when only the generic
|
||||
// StackFrame type is needed.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
|
||||
|
||||
#include "google_breakpad/common/minidump_format.h"
|
||||
#include "google_breakpad/processor/stack_frame.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
struct WindowsFrameInfo;
|
||||
class CFIFrameInfo;
|
||||
|
||||
struct StackFrameX86 : public StackFrame {
|
||||
// ContextValidity has one entry for each relevant hardware pointer
|
||||
// register (%eip and %esp) and one entry for each general-purpose
|
||||
// register. It's worthwhile having validity flags for caller-saves
|
||||
// registers: they are valid in the youngest frame, and such a frame
|
||||
// might save a callee-saves register in a caller-saves register, but
|
||||
// SimpleCFIWalker won't touch registers unless they're marked as valid.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_EIP = 1 << 0,
|
||||
CONTEXT_VALID_ESP = 1 << 1,
|
||||
CONTEXT_VALID_EBP = 1 << 2,
|
||||
CONTEXT_VALID_EAX = 1 << 3,
|
||||
CONTEXT_VALID_EBX = 1 << 4,
|
||||
CONTEXT_VALID_ECX = 1 << 5,
|
||||
CONTEXT_VALID_EDX = 1 << 6,
|
||||
CONTEXT_VALID_ESI = 1 << 7,
|
||||
CONTEXT_VALID_EDI = 1 << 8,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFrameX86()
|
||||
: context(),
|
||||
context_validity(CONTEXT_VALID_NONE),
|
||||
windows_frame_info(NULL),
|
||||
cfi_frame_info(NULL) {}
|
||||
~StackFrameX86();
|
||||
|
||||
// Overriden to return the return address as saved on the stack.
|
||||
virtual uint64_t ReturnAddress() const;
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextX86 context;
|
||||
|
||||
// context_validity is actually ContextValidity, but int is used because
|
||||
// the OR operator doesn't work well with enumerated types. This indicates
|
||||
// which fields in context are valid.
|
||||
int context_validity;
|
||||
|
||||
// Any stack walking information we found describing this.instruction.
|
||||
// These may be NULL if there is no such information for that address.
|
||||
WindowsFrameInfo *windows_frame_info;
|
||||
CFIFrameInfo *cfi_frame_info;
|
||||
};
|
||||
|
||||
struct StackFramePPC : public StackFrame {
|
||||
// ContextValidity should eventually contain entries for the validity of
|
||||
// other nonvolatile (callee-save) registers as in
|
||||
// StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
|
||||
// locate registers other than the ones listed here.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_SRR0 = 1 << 0,
|
||||
CONTEXT_VALID_GPR1 = 1 << 1,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFramePPC() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextPPC context;
|
||||
|
||||
// context_validity is actually ContextValidity, but int is used because
|
||||
// the OR operator doesn't work well with enumerated types. This indicates
|
||||
// which fields in context are valid.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFramePPC64 : public StackFrame {
|
||||
// ContextValidity should eventually contain entries for the validity of
|
||||
// other nonvolatile (callee-save) registers as in
|
||||
// StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
|
||||
// locate registers other than the ones listed here.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_SRR0 = 1 << 0,
|
||||
CONTEXT_VALID_GPR1 = 1 << 1,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFramePPC64() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextPPC64 context;
|
||||
|
||||
// context_validity is actually ContextValidity, but int is used because
|
||||
// the OR operator doesn't work well with enumerated types. This indicates
|
||||
// which fields in context are valid.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameAMD64 : public StackFrame {
|
||||
// ContextValidity has one entry for each register that we might be able
|
||||
// to recover.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_RAX = 1 << 0,
|
||||
CONTEXT_VALID_RDX = 1 << 1,
|
||||
CONTEXT_VALID_RCX = 1 << 2,
|
||||
CONTEXT_VALID_RBX = 1 << 3,
|
||||
CONTEXT_VALID_RSI = 1 << 4,
|
||||
CONTEXT_VALID_RDI = 1 << 5,
|
||||
CONTEXT_VALID_RBP = 1 << 6,
|
||||
CONTEXT_VALID_RSP = 1 << 7,
|
||||
CONTEXT_VALID_R8 = 1 << 8,
|
||||
CONTEXT_VALID_R9 = 1 << 9,
|
||||
CONTEXT_VALID_R10 = 1 << 10,
|
||||
CONTEXT_VALID_R11 = 1 << 11,
|
||||
CONTEXT_VALID_R12 = 1 << 12,
|
||||
CONTEXT_VALID_R13 = 1 << 13,
|
||||
CONTEXT_VALID_R14 = 1 << 14,
|
||||
CONTEXT_VALID_R15 = 1 << 15,
|
||||
CONTEXT_VALID_RIP = 1 << 16,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Overriden to return the return address as saved on the stack.
|
||||
virtual uint64_t ReturnAddress() const;
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information we had available. Refer to context_validity.
|
||||
MDRawContextAMD64 context;
|
||||
|
||||
// For each register in context whose value has been recovered, we set
|
||||
// the corresponding CONTEXT_VALID_ bit in context_validity.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// we use int instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameSPARC : public StackFrame {
|
||||
// to be confirmed
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_PC = 1 << 0,
|
||||
CONTEXT_VALID_SP = 1 << 1,
|
||||
CONTEXT_VALID_FP = 1 << 2,
|
||||
CONTEXT_VALID_ALL = -1
|
||||
};
|
||||
|
||||
StackFrameSPARC() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextSPARC context;
|
||||
|
||||
// context_validity is actually ContextValidity, but int is used because
|
||||
// the OR operator doesn't work well with enumerated types. This indicates
|
||||
// which fields in context are valid.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameARM : public StackFrame {
|
||||
// A flag for each register we might know.
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_R0 = 1 << 0,
|
||||
CONTEXT_VALID_R1 = 1 << 1,
|
||||
CONTEXT_VALID_R2 = 1 << 2,
|
||||
CONTEXT_VALID_R3 = 1 << 3,
|
||||
CONTEXT_VALID_R4 = 1 << 4,
|
||||
CONTEXT_VALID_R5 = 1 << 5,
|
||||
CONTEXT_VALID_R6 = 1 << 6,
|
||||
CONTEXT_VALID_R7 = 1 << 7,
|
||||
CONTEXT_VALID_R8 = 1 << 8,
|
||||
CONTEXT_VALID_R9 = 1 << 9,
|
||||
CONTEXT_VALID_R10 = 1 << 10,
|
||||
CONTEXT_VALID_R11 = 1 << 11,
|
||||
CONTEXT_VALID_R12 = 1 << 12,
|
||||
CONTEXT_VALID_R13 = 1 << 13,
|
||||
CONTEXT_VALID_R14 = 1 << 14,
|
||||
CONTEXT_VALID_R15 = 1 << 15,
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE,
|
||||
|
||||
// Aliases for registers with dedicated or conventional roles.
|
||||
CONTEXT_VALID_FP = CONTEXT_VALID_R11,
|
||||
CONTEXT_VALID_SP = CONTEXT_VALID_R13,
|
||||
CONTEXT_VALID_LR = CONTEXT_VALID_R14,
|
||||
CONTEXT_VALID_PC = CONTEXT_VALID_R15
|
||||
};
|
||||
|
||||
StackFrameARM() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Return the ContextValidity flag for register rN.
|
||||
static ContextValidity RegisterValidFlag(int n) {
|
||||
if (0 <= n && n <= 15) {
|
||||
return ContextValidity(1 << n);
|
||||
}
|
||||
return CONTEXT_VALID_NONE;
|
||||
}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextARM context;
|
||||
|
||||
// For each register in context whose value has been recovered, we set
|
||||
// the corresponding CONTEXT_VALID_ bit in context_validity.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// we use int instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameARM64 : public StackFrame {
|
||||
// A flag for each register we might know. Note that we can't use an enum
|
||||
// here as there are 33 values to represent.
|
||||
static const uint64_t CONTEXT_VALID_NONE = 0;
|
||||
static const uint64_t CONTEXT_VALID_X0 = 1ULL << 0;
|
||||
static const uint64_t CONTEXT_VALID_X1 = 1ULL << 1;
|
||||
static const uint64_t CONTEXT_VALID_X2 = 1ULL << 2;
|
||||
static const uint64_t CONTEXT_VALID_X3 = 1ULL << 3;
|
||||
static const uint64_t CONTEXT_VALID_X4 = 1ULL << 4;
|
||||
static const uint64_t CONTEXT_VALID_X5 = 1ULL << 5;
|
||||
static const uint64_t CONTEXT_VALID_X6 = 1ULL << 6;
|
||||
static const uint64_t CONTEXT_VALID_X7 = 1ULL << 7;
|
||||
static const uint64_t CONTEXT_VALID_X8 = 1ULL << 8;
|
||||
static const uint64_t CONTEXT_VALID_X9 = 1ULL << 9;
|
||||
static const uint64_t CONTEXT_VALID_X10 = 1ULL << 10;
|
||||
static const uint64_t CONTEXT_VALID_X11 = 1ULL << 11;
|
||||
static const uint64_t CONTEXT_VALID_X12 = 1ULL << 12;
|
||||
static const uint64_t CONTEXT_VALID_X13 = 1ULL << 13;
|
||||
static const uint64_t CONTEXT_VALID_X14 = 1ULL << 14;
|
||||
static const uint64_t CONTEXT_VALID_X15 = 1ULL << 15;
|
||||
static const uint64_t CONTEXT_VALID_X16 = 1ULL << 16;
|
||||
static const uint64_t CONTEXT_VALID_X17 = 1ULL << 17;
|
||||
static const uint64_t CONTEXT_VALID_X18 = 1ULL << 18;
|
||||
static const uint64_t CONTEXT_VALID_X19 = 1ULL << 19;
|
||||
static const uint64_t CONTEXT_VALID_X20 = 1ULL << 20;
|
||||
static const uint64_t CONTEXT_VALID_X21 = 1ULL << 21;
|
||||
static const uint64_t CONTEXT_VALID_X22 = 1ULL << 22;
|
||||
static const uint64_t CONTEXT_VALID_X23 = 1ULL << 23;
|
||||
static const uint64_t CONTEXT_VALID_X24 = 1ULL << 24;
|
||||
static const uint64_t CONTEXT_VALID_X25 = 1ULL << 25;
|
||||
static const uint64_t CONTEXT_VALID_X26 = 1ULL << 26;
|
||||
static const uint64_t CONTEXT_VALID_X27 = 1ULL << 27;
|
||||
static const uint64_t CONTEXT_VALID_X28 = 1ULL << 28;
|
||||
static const uint64_t CONTEXT_VALID_X29 = 1ULL << 29;
|
||||
static const uint64_t CONTEXT_VALID_X30 = 1ULL << 30;
|
||||
static const uint64_t CONTEXT_VALID_X31 = 1ULL << 31;
|
||||
static const uint64_t CONTEXT_VALID_X32 = 1ULL << 32;
|
||||
static const uint64_t CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE;
|
||||
|
||||
// Aliases for registers with dedicated or conventional roles.
|
||||
static const uint64_t CONTEXT_VALID_FP = CONTEXT_VALID_X29;
|
||||
static const uint64_t CONTEXT_VALID_LR = CONTEXT_VALID_X30;
|
||||
static const uint64_t CONTEXT_VALID_SP = CONTEXT_VALID_X31;
|
||||
static const uint64_t CONTEXT_VALID_PC = CONTEXT_VALID_X32;
|
||||
|
||||
StackFrameARM64() : context(),
|
||||
context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Return the validity flag for register xN.
|
||||
static uint64_t RegisterValidFlag(int n) {
|
||||
return 1ULL << n;
|
||||
}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, the values of nonvolatile registers may be
|
||||
// present, given sufficient debugging information. Refer to
|
||||
// context_validity.
|
||||
MDRawContextARM64 context;
|
||||
|
||||
// For each register in context whose value has been recovered, we set
|
||||
// the corresponding CONTEXT_VALID_ bit in context_validity.
|
||||
uint64_t context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameMIPS : public StackFrame {
|
||||
// MIPS callee save registers for o32 ABI (32bit registers) are:
|
||||
// 1. $s0-$s7,
|
||||
// 2. $sp, $fp
|
||||
// 3. $f20-$f31
|
||||
//
|
||||
// The register structure is available at
|
||||
// http://en.wikipedia.org/wiki/MIPS_architecture#Compiler_register_usage
|
||||
|
||||
#define INDEX_MIPS_REG_S0 MD_CONTEXT_MIPS_REG_S0 // 16
|
||||
#define INDEX_MIPS_REG_S7 MD_CONTEXT_MIPS_REG_S7 // 23
|
||||
#define INDEX_MIPS_REG_GP MD_CONTEXT_MIPS_REG_GP // 28
|
||||
#define INDEX_MIPS_REG_RA MD_CONTEXT_MIPS_REG_RA // 31
|
||||
#define INDEX_MIPS_REG_PC 34
|
||||
#define SHIFT_MIPS_REG_S0 0
|
||||
#define SHIFT_MIPS_REG_GP 8
|
||||
#define SHIFT_MIPS_REG_PC 12
|
||||
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_S0 = 1 << 0, // $16
|
||||
CONTEXT_VALID_S1 = 1 << 1, // $17
|
||||
CONTEXT_VALID_S2 = 1 << 2, // $18
|
||||
CONTEXT_VALID_S3 = 1 << 3, // $19
|
||||
CONTEXT_VALID_S4 = 1 << 4, // $20
|
||||
CONTEXT_VALID_S5 = 1 << 5, // $21
|
||||
CONTEXT_VALID_S6 = 1 << 6, // $22
|
||||
CONTEXT_VALID_S7 = 1 << 7, // $23
|
||||
// GP is not calee-save for o32 abi.
|
||||
CONTEXT_VALID_GP = 1 << 8, // $28
|
||||
CONTEXT_VALID_SP = 1 << 9, // $29
|
||||
CONTEXT_VALID_FP = 1 << 10, // $30
|
||||
CONTEXT_VALID_RA = 1 << 11, // $31
|
||||
CONTEXT_VALID_PC = 1 << 12, // $34
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
|
||||
};
|
||||
|
||||
// Return the ContextValidity flag for register rN.
|
||||
static ContextValidity RegisterValidFlag(int n) {
|
||||
if (n >= INDEX_MIPS_REG_S0 && n <= INDEX_MIPS_REG_S7)
|
||||
return ContextValidity(1 << (n - INDEX_MIPS_REG_S0 + SHIFT_MIPS_REG_S0));
|
||||
else if (n >= INDEX_MIPS_REG_GP && n <= INDEX_MIPS_REG_RA)
|
||||
return ContextValidity(1 << (n - INDEX_MIPS_REG_GP + SHIFT_MIPS_REG_GP));
|
||||
else if (n == INDEX_MIPS_REG_PC)
|
||||
return ContextValidity(1 << SHIFT_MIPS_REG_PC);
|
||||
|
||||
return CONTEXT_VALID_NONE;
|
||||
}
|
||||
|
||||
StackFrameMIPS() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information were available. Refer to 'context_validity' below.
|
||||
MDRawContextMIPS context;
|
||||
|
||||
// For each register in context whose value has been recovered,
|
||||
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// type int is used instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameRISCV : public StackFrame {
|
||||
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_PC = 1 << 0,
|
||||
CONTEXT_VALID_RA = 1 << 1,
|
||||
CONTEXT_VALID_SP = 1 << 2,
|
||||
CONTEXT_VALID_GP = 1 << 3,
|
||||
CONTEXT_VALID_TP = 1 << 4,
|
||||
CONTEXT_VALID_T0 = 1 << 5,
|
||||
CONTEXT_VALID_T1 = 1 << 6,
|
||||
CONTEXT_VALID_T2 = 1 << 7,
|
||||
CONTEXT_VALID_S0 = 1 << 8,
|
||||
CONTEXT_VALID_S1 = 1 << 9,
|
||||
CONTEXT_VALID_A0 = 1 << 10,
|
||||
CONTEXT_VALID_A1 = 1 << 11,
|
||||
CONTEXT_VALID_A2 = 1 << 12,
|
||||
CONTEXT_VALID_A3 = 1 << 13,
|
||||
CONTEXT_VALID_A4 = 1 << 14,
|
||||
CONTEXT_VALID_A5 = 1 << 15,
|
||||
CONTEXT_VALID_A6 = 1 << 16,
|
||||
CONTEXT_VALID_A7 = 1 << 17,
|
||||
CONTEXT_VALID_S2 = 1 << 18,
|
||||
CONTEXT_VALID_S3 = 1 << 19,
|
||||
CONTEXT_VALID_S4 = 1 << 20,
|
||||
CONTEXT_VALID_S5 = 1 << 21,
|
||||
CONTEXT_VALID_S6 = 1 << 22,
|
||||
CONTEXT_VALID_S7 = 1 << 23,
|
||||
CONTEXT_VALID_S8 = 1 << 24,
|
||||
CONTEXT_VALID_S9 = 1 << 25,
|
||||
CONTEXT_VALID_S10 = 1 << 26,
|
||||
CONTEXT_VALID_S11 = 1 << 27,
|
||||
CONTEXT_VALID_T3 = 1 << 28,
|
||||
CONTEXT_VALID_T4 = 1 << 29,
|
||||
CONTEXT_VALID_T5 = 1 << 30,
|
||||
CONTEXT_VALID_T6 = 1 << 31,
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
|
||||
};
|
||||
|
||||
StackFrameRISCV() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information were available. Refer to 'context_validity' below.
|
||||
MDRawContextRISCV context;
|
||||
|
||||
// For each register in context whose value has been recovered,
|
||||
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// type int is used instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
struct StackFrameRISCV64 : public StackFrame {
|
||||
|
||||
enum ContextValidity {
|
||||
CONTEXT_VALID_NONE = 0,
|
||||
CONTEXT_VALID_PC = 1 << 0,
|
||||
CONTEXT_VALID_RA = 1 << 1,
|
||||
CONTEXT_VALID_SP = 1 << 2,
|
||||
CONTEXT_VALID_GP = 1 << 3,
|
||||
CONTEXT_VALID_TP = 1 << 4,
|
||||
CONTEXT_VALID_T0 = 1 << 5,
|
||||
CONTEXT_VALID_T1 = 1 << 6,
|
||||
CONTEXT_VALID_T2 = 1 << 7,
|
||||
CONTEXT_VALID_S0 = 1 << 8,
|
||||
CONTEXT_VALID_S1 = 1 << 9,
|
||||
CONTEXT_VALID_A0 = 1 << 10,
|
||||
CONTEXT_VALID_A1 = 1 << 11,
|
||||
CONTEXT_VALID_A2 = 1 << 12,
|
||||
CONTEXT_VALID_A3 = 1 << 13,
|
||||
CONTEXT_VALID_A4 = 1 << 14,
|
||||
CONTEXT_VALID_A5 = 1 << 15,
|
||||
CONTEXT_VALID_A6 = 1 << 16,
|
||||
CONTEXT_VALID_A7 = 1 << 17,
|
||||
CONTEXT_VALID_S2 = 1 << 18,
|
||||
CONTEXT_VALID_S3 = 1 << 19,
|
||||
CONTEXT_VALID_S4 = 1 << 20,
|
||||
CONTEXT_VALID_S5 = 1 << 21,
|
||||
CONTEXT_VALID_S6 = 1 << 22,
|
||||
CONTEXT_VALID_S7 = 1 << 23,
|
||||
CONTEXT_VALID_S8 = 1 << 24,
|
||||
CONTEXT_VALID_S9 = 1 << 25,
|
||||
CONTEXT_VALID_S10 = 1 << 26,
|
||||
CONTEXT_VALID_S11 = 1 << 27,
|
||||
CONTEXT_VALID_T3 = 1 << 28,
|
||||
CONTEXT_VALID_T4 = 1 << 29,
|
||||
CONTEXT_VALID_T5 = 1 << 30,
|
||||
CONTEXT_VALID_T6 = 1 << 31,
|
||||
CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE
|
||||
};
|
||||
|
||||
StackFrameRISCV64() : context(), context_validity(CONTEXT_VALID_NONE) {}
|
||||
|
||||
// Register state. This is only fully valid for the topmost frame in a
|
||||
// stack. In other frames, which registers are present depends on what
|
||||
// debugging information were available. Refer to 'context_validity' below.
|
||||
MDRawContextRISCV64 context;
|
||||
|
||||
// For each register in context whose value has been recovered,
|
||||
// the corresponding CONTEXT_VALID_ bit in 'context_validity' is set.
|
||||
//
|
||||
// context_validity's type should actually be ContextValidity, but
|
||||
// type int is used instead because the bitwise inclusive or operator
|
||||
// yields an int when applied to enum values, and C++ doesn't
|
||||
// silently convert from ints to enums.
|
||||
int context_validity;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
|
113
externals/breakpad/src/google_breakpad/processor/stack_frame_symbolizer.h
vendored
Normal file
113
externals/breakpad/src/google_breakpad/processor/stack_frame_symbolizer.h
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
// -*- mode: C++ -*-
|
||||
|
||||
// Copyright 2012 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Helper class that encapsulates the logic of how symbol supplier interacts
|
||||
// with source line resolver to fill stack frame information.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
|
||||
|
||||
#include <deque>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/code_module.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
class CFIFrameInfo;
|
||||
class CodeModules;
|
||||
class SymbolSupplier;
|
||||
class SourceLineResolverInterface;
|
||||
struct StackFrame;
|
||||
struct SystemInfo;
|
||||
struct WindowsFrameInfo;
|
||||
|
||||
class StackFrameSymbolizer {
|
||||
public:
|
||||
enum SymbolizerResult {
|
||||
// Symbol data was found and successfully loaded in resolver.
|
||||
// This does NOT guarantee source line info is found within symbol file.
|
||||
kNoError,
|
||||
// This indicates non-critical error, such as, no code module found for
|
||||
// frame's instruction, no symbol file, or resolver failed to load symbol.
|
||||
kError,
|
||||
// This indicates error for which stack walk should be interrupted
|
||||
// and retried in future.
|
||||
kInterrupt,
|
||||
// Symbol data was found and loaded in resolver however some corruptions
|
||||
// were detected.
|
||||
kWarningCorruptSymbols,
|
||||
};
|
||||
|
||||
StackFrameSymbolizer(SymbolSupplier* supplier,
|
||||
SourceLineResolverInterface* resolver);
|
||||
|
||||
virtual ~StackFrameSymbolizer() { }
|
||||
|
||||
// Encapsulate the step of resolving source line info for a stack frame.
|
||||
// "frame" must not be NULL.
|
||||
virtual SymbolizerResult FillSourceLineInfo(
|
||||
const CodeModules* modules,
|
||||
const CodeModules* unloaded_modules,
|
||||
const SystemInfo* system_info,
|
||||
StackFrame* stack_frame,
|
||||
std::deque<std::unique_ptr<StackFrame>>* inlined_frames);
|
||||
|
||||
virtual WindowsFrameInfo* FindWindowsFrameInfo(const StackFrame* frame);
|
||||
|
||||
virtual CFIFrameInfo* FindCFIFrameInfo(const StackFrame* frame);
|
||||
|
||||
// Reset internal (locally owned) data as if the helper is re-instantiated.
|
||||
// A typical case is to call Reset() after processing an individual report
|
||||
// before start to process next one, in order to reset internal information
|
||||
// about missing symbols found so far.
|
||||
virtual void Reset() { no_symbol_modules_.clear(); }
|
||||
|
||||
// Returns true if there is valid implementation for stack symbolization.
|
||||
virtual bool HasImplementation() { return resolver_ && supplier_; }
|
||||
|
||||
SourceLineResolverInterface* resolver() { return resolver_; }
|
||||
SymbolSupplier* supplier() { return supplier_; }
|
||||
|
||||
protected:
|
||||
SymbolSupplier* supplier_;
|
||||
SourceLineResolverInterface* resolver_;
|
||||
// A list of modules known to have symbols missing. This helps avoid
|
||||
// repeated lookups for the missing symbols within one minidump.
|
||||
std::set<string> no_symbol_modules_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_SYMBOLIZER_H__
|
260
externals/breakpad/src/google_breakpad/processor/stackwalker.h
vendored
Normal file
260
externals/breakpad/src/google_breakpad/processor/stackwalker.h
vendored
Normal file
|
@ -0,0 +1,260 @@
|
|||
// Copyright 2010 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// stackwalker.h: Generic stackwalker.
|
||||
//
|
||||
// The Stackwalker class is an abstract base class providing common generic
|
||||
// methods that apply to stacks from all systems. Specific implementations
|
||||
// will extend this class by providing GetContextFrame and GetCallerFrame
|
||||
// methods to fill in system-specific data in a StackFrame structure.
|
||||
// Stackwalker assembles these StackFrame strucutres into a CallStack.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
#include "google_breakpad/processor/code_modules.h"
|
||||
#include "google_breakpad/processor/memory_region.h"
|
||||
#include "google_breakpad/processor/stack_frame_symbolizer.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class CallStack;
|
||||
class DumpContext;
|
||||
class StackFrameSymbolizer;
|
||||
|
||||
using std::set;
|
||||
using std::vector;
|
||||
|
||||
class Stackwalker {
|
||||
public:
|
||||
virtual ~Stackwalker() {}
|
||||
|
||||
// Populates the given CallStack by calling GetContextFrame and
|
||||
// GetCallerFrame. The frames are further processed to fill all available
|
||||
// data. Returns true if the stackwalk completed, or false if it was
|
||||
// interrupted by SymbolSupplier::GetSymbolFile().
|
||||
// Upon return, |modules_without_symbols| will be populated with pointers to
|
||||
// the code modules (CodeModule*) that DON'T have symbols.
|
||||
// |modules_with_corrupt_symbols| will be populated with pointers to the
|
||||
// modules which have corrupt symbols. |modules_without_symbols| and
|
||||
// |modules_with_corrupt_symbols| DO NOT take ownership of the code modules.
|
||||
// The lifetime of these code modules is the same as the lifetime of the
|
||||
// CodeModules passed to the StackWalker constructor (which currently
|
||||
// happens to be the lifetime of the Breakpad's ProcessingState object).
|
||||
// There is a check for duplicate modules so no duplicates are expected.
|
||||
bool Walk(CallStack* stack,
|
||||
vector<const CodeModule*>* modules_without_symbols,
|
||||
vector<const CodeModule*>* modules_with_corrupt_symbols);
|
||||
|
||||
// Returns a new concrete subclass suitable for the CPU that a stack was
|
||||
// generated on, according to the CPU type indicated by the context
|
||||
// argument. If no suitable concrete subclass exists, returns NULL.
|
||||
static Stackwalker* StackwalkerForCPU(
|
||||
const SystemInfo* system_info,
|
||||
DumpContext* context,
|
||||
MemoryRegion* memory,
|
||||
const CodeModules* modules,
|
||||
const CodeModules* unloaded_modules,
|
||||
StackFrameSymbolizer* resolver_helper);
|
||||
|
||||
|
||||
static void set_max_frames(uint32_t max_frames) {
|
||||
max_frames_ = max_frames;
|
||||
max_frames_set_ = true;
|
||||
}
|
||||
static uint32_t max_frames() { return max_frames_; }
|
||||
|
||||
static void set_max_frames_scanned(uint32_t max_frames_scanned) {
|
||||
max_frames_scanned_ = max_frames_scanned;
|
||||
}
|
||||
|
||||
protected:
|
||||
// system_info identifies the operating system, NULL or empty if unknown.
|
||||
// memory identifies a MemoryRegion that provides the stack memory
|
||||
// for the stack to walk. modules, if non-NULL, is a CodeModules
|
||||
// object that is used to look up which code module each stack frame is
|
||||
// associated with. frame_symbolizer is a StackFrameSymbolizer object that
|
||||
// encapsulates the logic of how source line resolver interacts with symbol
|
||||
// supplier to symbolize stack frame and look up caller frame information
|
||||
// (see stack_frame_symbolizer.h).
|
||||
// frame_symbolizer MUST NOT be NULL (asserted).
|
||||
Stackwalker(const SystemInfo* system_info,
|
||||
MemoryRegion* memory,
|
||||
const CodeModules* modules,
|
||||
StackFrameSymbolizer* frame_symbolizer);
|
||||
|
||||
// This can be used to filter out potential return addresses when
|
||||
// the stack walker resorts to stack scanning.
|
||||
// Returns true if any of:
|
||||
// * This address is within a loaded module, but we don't have symbols
|
||||
// for that module.
|
||||
// * This address is within a loaded module for which we have symbols,
|
||||
// and falls inside a function in that module.
|
||||
// Returns false otherwise.
|
||||
bool InstructionAddressSeemsValid(uint64_t address) const;
|
||||
|
||||
// Checks whether we should stop the stack trace.
|
||||
// (either we reached the end-of-stack or we detected a
|
||||
// broken callstack invariant)
|
||||
bool TerminateWalk(uint64_t caller_ip,
|
||||
uint64_t caller_sp,
|
||||
uint64_t callee_sp,
|
||||
bool first_unwind) const;
|
||||
|
||||
// The default number of words to search through on the stack
|
||||
// for a return address.
|
||||
static const int kRASearchWords;
|
||||
|
||||
template<typename InstructionType>
|
||||
bool ScanForReturnAddress(InstructionType location_start,
|
||||
InstructionType* location_found,
|
||||
InstructionType* ip_found,
|
||||
bool is_context_frame) {
|
||||
// When searching for the caller of the context frame,
|
||||
// allow the scanner to look farther down the stack.
|
||||
const int search_words = is_context_frame ?
|
||||
kRASearchWords * 4 :
|
||||
kRASearchWords;
|
||||
|
||||
return ScanForReturnAddress(location_start, location_found, ip_found,
|
||||
search_words);
|
||||
}
|
||||
|
||||
// Scan the stack starting at location_start, looking for an address
|
||||
// that looks like a valid instruction pointer. Addresses must
|
||||
// 1) be contained in the current stack memory
|
||||
// 2) pass the checks in InstructionAddressSeemsValid
|
||||
//
|
||||
// Returns true if a valid-looking instruction pointer was found.
|
||||
// When returning true, sets location_found to the address at which
|
||||
// the value was found, and ip_found to the value contained at that
|
||||
// location in memory.
|
||||
template<typename InstructionType>
|
||||
bool ScanForReturnAddress(InstructionType location_start,
|
||||
InstructionType* location_found,
|
||||
InstructionType* ip_found,
|
||||
int searchwords) {
|
||||
for (InstructionType location = location_start;
|
||||
location <= location_start + searchwords * sizeof(InstructionType);
|
||||
location += sizeof(InstructionType)) {
|
||||
InstructionType ip;
|
||||
if (!memory_->GetMemoryAtAddress(location, &ip))
|
||||
break;
|
||||
|
||||
// The return address points to the instruction after a call. If the
|
||||
// caller was a no return function, this might point past the end of the
|
||||
// function. Subtract one from the instruction pointer so it points into
|
||||
// the call instruction instead.
|
||||
if (modules_ && modules_->GetModuleForAddress(ip - 1) &&
|
||||
InstructionAddressSeemsValid(ip - 1)) {
|
||||
*ip_found = ip;
|
||||
*location_found = location;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// nothing found
|
||||
return false;
|
||||
}
|
||||
|
||||
// Information about the system that produced the minidump. Subclasses
|
||||
// and the SymbolSupplier may find this information useful.
|
||||
const SystemInfo* system_info_;
|
||||
|
||||
// The stack memory to walk. Subclasses will require this region to
|
||||
// get information from the stack.
|
||||
MemoryRegion* memory_;
|
||||
|
||||
// A list of modules, for populating each StackFrame's module information.
|
||||
// This field is optional and may be NULL.
|
||||
const CodeModules* modules_;
|
||||
|
||||
// A list of unloaded modules, for populating frames which aren't matched
|
||||
// to any loaded modules.
|
||||
// This field is optional and may be NULL.
|
||||
const CodeModules* unloaded_modules_;
|
||||
|
||||
protected:
|
||||
// The StackFrameSymbolizer implementation.
|
||||
StackFrameSymbolizer* frame_symbolizer_;
|
||||
|
||||
private:
|
||||
// Obtains the context frame, the innermost called procedure in a stack
|
||||
// trace. Returns NULL on failure. GetContextFrame allocates a new
|
||||
// StackFrame (or StackFrame subclass), ownership of which is taken by
|
||||
// the caller.
|
||||
virtual StackFrame* GetContextFrame() = 0;
|
||||
|
||||
// Obtains a caller frame. Each call to GetCallerFrame should return the
|
||||
// frame that called the last frame returned by GetContextFrame or
|
||||
// GetCallerFrame. To aid this purpose, stack contains the CallStack
|
||||
// made of frames that have already been walked. GetCallerFrame should
|
||||
// return NULL on failure or when there are no more caller frames (when
|
||||
// the end of the stack has been reached). GetCallerFrame allocates a new
|
||||
// StackFrame (or StackFrame subclass), ownership of which is taken by
|
||||
// the caller. |stack_scan_allowed| controls whether stack scanning is
|
||||
// an allowable frame-recovery method, since it is desirable to be able to
|
||||
// disable stack scanning in performance-critical use cases.
|
||||
//
|
||||
// CONSIDER: a way to differentiate between:
|
||||
// - full stack traces
|
||||
// - explicitly truncated traces (max_frames_)
|
||||
// - stopping after max scanned frames
|
||||
// - failed stack walk (breaking one of the stack walk invariants)
|
||||
//
|
||||
virtual StackFrame* GetCallerFrame(const CallStack* stack,
|
||||
bool stack_scan_allowed) = 0;
|
||||
|
||||
// The maximum number of frames Stackwalker will walk through.
|
||||
// This defaults to 1024 to prevent infinite loops.
|
||||
static uint32_t max_frames_;
|
||||
|
||||
// Keep track of whether max_frames_ has been set by the user, since
|
||||
// it affects whether or not an error message is printed in the case
|
||||
// where an unwind got stopped by the limit.
|
||||
static bool max_frames_set_;
|
||||
|
||||
// The maximum number of stack-scanned and otherwise untrustworthy
|
||||
// frames allowed. Stack-scanning can be expensive, so the option to
|
||||
// disable or limit it is helpful in cases where unwind performance is
|
||||
// important. This defaults to 1024, the same as max_frames_.
|
||||
static uint32_t max_frames_scanned_;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_STACKWALKER_H__
|
98
externals/breakpad/src/google_breakpad/processor/symbol_supplier.h
vendored
Normal file
98
externals/breakpad/src/google_breakpad/processor/symbol_supplier.h
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// The caller may implement the SymbolSupplier abstract base class
|
||||
// to provide symbols for a given module.
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
|
||||
|
||||
#include <string>
|
||||
#include "common/using_std_string.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
class CodeModule;
|
||||
struct SystemInfo;
|
||||
|
||||
class SymbolSupplier {
|
||||
public:
|
||||
// Result type for GetSymbolFile
|
||||
enum SymbolResult {
|
||||
// no symbols were found, but continue processing
|
||||
NOT_FOUND,
|
||||
|
||||
// symbols were found, and the path has been placed in symbol_file
|
||||
FOUND,
|
||||
|
||||
// stops processing the minidump immediately
|
||||
INTERRUPT
|
||||
};
|
||||
|
||||
virtual ~SymbolSupplier() {}
|
||||
|
||||
// Retrieves the symbol file for the given CodeModule, placing the
|
||||
// path in symbol_file if successful. system_info contains strings
|
||||
// identifying the operating system and CPU; SymbolSupplier may use
|
||||
// to help locate the symbol file. system_info may be NULL or its
|
||||
// fields may be empty if these values are unknown. symbol_file
|
||||
// must be a pointer to a valid string
|
||||
virtual SymbolResult GetSymbolFile(const CodeModule* module,
|
||||
const SystemInfo* system_info,
|
||||
string* symbol_file) = 0;
|
||||
// Same as above, except also places symbol data into symbol_data.
|
||||
// If symbol_data is NULL, the data is not returned.
|
||||
// TODO(nealsid) Once we have symbol data caching behavior implemented
|
||||
// investigate making all symbol suppliers implement all methods,
|
||||
// and make this pure virtual
|
||||
virtual SymbolResult GetSymbolFile(const CodeModule* module,
|
||||
const SystemInfo* system_info,
|
||||
string* symbol_file,
|
||||
string* symbol_data) = 0;
|
||||
|
||||
// Same as above, except allocates data buffer on heap and then places the
|
||||
// symbol data into the buffer as C-string.
|
||||
// SymbolSupplier is responsible for deleting the data buffer. After the call
|
||||
// to GetCStringSymbolData(), the caller should call FreeSymbolData(const
|
||||
// Module* module) once the data buffer is no longer needed.
|
||||
// If symbol_data is not NULL, symbol supplier won't return FOUND unless it
|
||||
// returns a valid buffer in symbol_data, e.g., returns INTERRUPT on memory
|
||||
// allocation failure.
|
||||
virtual SymbolResult GetCStringSymbolData(const CodeModule* module,
|
||||
const SystemInfo* system_info,
|
||||
string* symbol_file,
|
||||
char** symbol_data,
|
||||
size_t* symbol_data_size) = 0;
|
||||
|
||||
// Frees the data buffer allocated for the module in GetCStringSymbolData.
|
||||
virtual void FreeSymbolData(const CodeModule* module) = 0;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_SYMBOL_SUPPLIER_H__
|
105
externals/breakpad/src/google_breakpad/processor/system_info.h
vendored
Normal file
105
externals/breakpad/src/google_breakpad/processor/system_info.h
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
// Copyright 2006 Google LLC
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google LLC nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// system_info.h: Information about the system that was running a program
|
||||
// when a crash report was produced.
|
||||
//
|
||||
// Author: Mark Mentovai
|
||||
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
struct SystemInfo {
|
||||
public:
|
||||
SystemInfo() : os(), os_short(), os_version(), cpu(), cpu_info(),
|
||||
cpu_count(0), gl_version(), gl_vendor(), gl_renderer() {}
|
||||
|
||||
// Resets the SystemInfo object to its default values.
|
||||
void Clear() {
|
||||
os.clear();
|
||||
os_short.clear();
|
||||
os_version.clear();
|
||||
cpu.clear();
|
||||
cpu_info.clear();
|
||||
cpu_count = 0;
|
||||
gl_version.clear();
|
||||
gl_vendor.clear();
|
||||
gl_renderer.clear();
|
||||
}
|
||||
|
||||
// A string identifying the operating system, such as "Windows NT",
|
||||
// "Mac OS X", or "Linux". If the information is present in the dump but
|
||||
// its value is unknown, this field will contain a numeric value. If
|
||||
// the information is not present in the dump, this field will be empty.
|
||||
string os;
|
||||
|
||||
// A short form of the os string, using lowercase letters and no spaces,
|
||||
// suitable for use in a filesystem. Possible values include "windows",
|
||||
// "mac", "linux" and "nacl". Empty if the information is not present
|
||||
// in the dump or if the OS given by the dump is unknown. The values
|
||||
// stored in this field should match those used by
|
||||
// MinidumpSystemInfo::GetOS.
|
||||
string os_short;
|
||||
|
||||
// A string identifying the version of the operating system, such as
|
||||
// "5.1.2600 Service Pack 2" or "10.4.8 8L2127". If the dump does not
|
||||
// contain this information, this field will be empty.
|
||||
string os_version;
|
||||
|
||||
// A string identifying the basic CPU family, such as "x86" or "ppc".
|
||||
// If this information is present in the dump but its value is unknown,
|
||||
// this field will contain a numeric value. If the information is not
|
||||
// present in the dump, this field will be empty. The values stored in
|
||||
// this field should match those used by MinidumpSystemInfo::GetCPU.
|
||||
string cpu;
|
||||
|
||||
// A string further identifying the specific CPU, such as
|
||||
// "GenuineIntel level 6 model 13 stepping 8". If the information is not
|
||||
// present in the dump, or additional identifying information is not
|
||||
// defined for the CPU family, this field will be empty.
|
||||
string cpu_info;
|
||||
|
||||
// The number of processors in the system. Will be greater than one for
|
||||
// multi-core systems.
|
||||
int cpu_count;
|
||||
|
||||
// The GPU information. Currently only populated in microdumps.
|
||||
string gl_version;
|
||||
string gl_vendor;
|
||||
string gl_renderer;
|
||||
};
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
||||
#endif // GOOGLE_BREAKPAD_PROCESSOR_SYSTEM_INFO_H__
|
Loading…
Add table
Add a link
Reference in a new issue