mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-24 09:25:43 +01:00
Allow Breakpad processor library to build on Solaris with the native Sun
toolchain (#142). Patch by Alfred Peng. r=me. git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@213 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
7e2b64f5fd
commit
0e6f5c95d7
@ -33,14 +33,28 @@
|
||||
#ifndef GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_BASIC_SOURCE_LINE_RESOLVER_H__
|
||||
|
||||
// TODO: Platforms that have no hash_map can use map, at the likely cost of
|
||||
// performance.
|
||||
#ifdef __SUNPRO_CC
|
||||
#define BSLR_NO_HASH_MAP
|
||||
#endif // __SUNPRO_CC
|
||||
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
#include <map>
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
#include <ext/hash_map>
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
|
||||
#include "google_breakpad/processor/source_line_resolver_interface.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
using std::string;
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
using std::map;
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
using __gnu_cxx::hash_map;
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
|
||||
class BasicSourceLineResolver : public SourceLineResolverInterface {
|
||||
public:
|
||||
@ -65,13 +79,23 @@ class BasicSourceLineResolver : public SourceLineResolverInterface {
|
||||
struct Function;
|
||||
struct PublicSymbol;
|
||||
struct File;
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
struct CompareString {
|
||||
bool operator()(const string &s1, const string &s2) const;
|
||||
};
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
struct HashString {
|
||||
size_t operator()(const string &s) const;
|
||||
};
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
class Module;
|
||||
|
||||
// All of the modules we've loaded
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
typedef map<string, Module*, CompareString> ModuleMap;
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
typedef hash_map<string, Module*, HashString> ModuleMap;
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
ModuleMap *modules_;
|
||||
|
||||
// Disallow unwanted copy ctor and assignment operator
|
||||
|
@ -36,6 +36,7 @@
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_CODE_MODULE_H__
|
||||
|
||||
#include <string>
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define GOOGLE_BREAKPAD_PROCESSOR_MINIDUMP_PROCESSOR_H__
|
||||
|
||||
#include <string>
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "google_breakpad/processor/system_info.h"
|
||||
#include "google_breakpad/common/breakpad_types.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
|
@ -48,7 +48,9 @@
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::make_pair;
|
||||
#ifndef BSLR_NO_HASH_MAP
|
||||
using __gnu_cxx::hash;
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
|
||||
namespace google_breakpad {
|
||||
|
||||
@ -116,7 +118,11 @@ class BasicSourceLineResolver::Module {
|
||||
|
||||
private:
|
||||
friend class BasicSourceLineResolver;
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
typedef map<int, string> FileMap;
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
typedef hash_map<int, string> FileMap;
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
|
||||
// The types for stack_info_. This is equivalent to MS DIA's
|
||||
// StackFrameTypeEnum. Each identifies a different type of frame
|
||||
@ -594,8 +600,15 @@ bool BasicSourceLineResolver::Module::ParseStackInfo(char *stack_info_line) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef BSLR_NO_HASH_MAP
|
||||
bool BasicSourceLineResolver::CompareString::operator()(
|
||||
const string &s1, const string &s2) const {
|
||||
return strcmp(s1.c_str(), s2.c_str()) < 0;
|
||||
}
|
||||
#else // BSLR_NO_HASH_MAP
|
||||
size_t BasicSourceLineResolver::HashString::operator()(const string &s) const {
|
||||
return hash<const char*>()(s.c_str());
|
||||
}
|
||||
#endif // BSLR_NO_HASH_MAP
|
||||
|
||||
} // namespace google_breakpad
|
||||
|
@ -70,7 +70,7 @@ bool ContainedRangeMap<AddressType, EntryType>::StoreRange(
|
||||
|
||||
MapIterator iterator_base = map_->lower_bound(base);
|
||||
MapIterator iterator_high = map_->lower_bound(high);
|
||||
MapConstIterator iterator_end = map_->end();
|
||||
MapIterator iterator_end = map_->end();
|
||||
|
||||
if (iterator_base == iterator_high && iterator_base != iterator_end &&
|
||||
base >= iterator_base->second->base_) {
|
||||
|
@ -106,7 +106,7 @@ static inline void Swap(u_int32_t* value) {
|
||||
}
|
||||
|
||||
|
||||
static void Swap(u_int64_t* value) {
|
||||
static inline void Swap(u_int64_t* value) {
|
||||
u_int32_t* value32 = reinterpret_cast<u_int32_t*>(value);
|
||||
Swap(&value32[0]);
|
||||
Swap(&value32[1]);
|
||||
|
@ -113,7 +113,7 @@ SymbolSupplier::SymbolResult SimpleSymbolSupplier::GetSymbolFileAtPath(
|
||||
string debug_file_extension;
|
||||
if (debug_file_name.size() > 4)
|
||||
debug_file_extension = debug_file_name.substr(debug_file_name.size() - 4);
|
||||
transform(debug_file_extension.begin(), debug_file_extension.end(),
|
||||
std::transform(debug_file_extension.begin(), debug_file_extension.end(),
|
||||
debug_file_extension.begin(), tolower);
|
||||
if (debug_file_extension == ".pdb") {
|
||||
path.append(debug_file_name.substr(0, debug_file_name.size() - 4));
|
||||
|
Loading…
Reference in New Issue
Block a user