aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjimblandy@gmail.com <jimblandy@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-09-03 18:27:16 +0000
committerjimblandy@gmail.com <jimblandy@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2009-09-03 18:27:16 +0000
commitc426b3d98af4c3cc48d97322001963f8b886e8e9 (patch)
treee24489a8d07ac6403a88e83e8118fbe651ccfec6 /src
parentFix text field resizing for 10.5+ SDK (diff)
downloadbreakpad-c426b3d98af4c3cc48d97322001963f8b886e8e9.tar.xz
Breakpad: Don't use the deprecated __gnu_cxx::hash_map container.
Modern GNU compilers warn about the #inclusion of <ext/hash_map>; that container is deprecated, and code should use <tr1/unordered_map> instead. However, to stay within the boundaries of C++ '98, it's probably fine just to use plain old std::map. Breakpad uses hash_map in three cases: o The DWARF reader's SectionMap type maps object file section names to data. This map is consulted once per section kind per DWARF compilation unit; it is not performance-critical. o The Mac dump_syms tool uses it to map machine architectures to section maps in Universal binaries. It's hard to imagine there ever being more than two entries in such a map. o The processor's BasicSourceLineResolver uses a hash_map to map file numbers to file names. This is the map that will probably have the most entries, but it's only accessed once per frame, after we've found the frame's line entry. a=jimblandy r=nealsid git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@393 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/common/mac/dump_syms.h2
-rw-r--r--src/common/mac/dump_syms.mm9
-rw-r--r--src/common/mac/dwarf/dwarf2reader.cc12
-rw-r--r--src/common/mac/dwarf/dwarf2reader.h5
-rw-r--r--src/common/mac/dwarf/functioninfo.cc21
-rw-r--r--src/google_breakpad/processor/basic_source_line_resolver.h24
-rw-r--r--src/processor/basic_source_line_resolver.cc13
7 files changed, 3 insertions, 83 deletions
diff --git a/src/common/mac/dump_syms.h b/src/common/mac/dump_syms.h
index 12d8f7d6..5ed3e3b6 100644
--- a/src/common/mac/dump_syms.h
+++ b/src/common/mac/dump_syms.h
@@ -37,7 +37,7 @@
// This will map from an architecture string to a SectionMap, which
// will contain the offsets for all the sections in the dictionary
-typedef hash_map<string, dwarf2reader::SectionMap *> ArchSectionMap;
+typedef map<string, dwarf2reader::SectionMap *> ArchSectionMap;
@interface DumpSymbols : NSObject {
@protected
diff --git a/src/common/mac/dump_syms.mm b/src/common/mac/dump_syms.mm
index 73e4f76a..8f0b9fe1 100644
--- a/src/common/mac/dump_syms.mm
+++ b/src/common/mac/dump_syms.mm
@@ -68,15 +68,6 @@ static NSString *kHeaderCPUTypeKey = @"cpuType";
// for pruning out extraneous non-function symbols.
static const int kTextSection = 1;
-namespace __gnu_cxx {
-template<>
- struct hash<std::string> {
- size_t operator()(const std::string& k) const {
- return hash< const char* >()( k.c_str() );
- }
-};
-}
-
// Dump FunctionMap to stdout. Print address, function name, file
// name, line number, lowpc, and highpc if available.
void DumpFunctionMap(const dwarf2reader::FunctionMap function_map) {
diff --git a/src/common/mac/dwarf/dwarf2reader.cc b/src/common/mac/dwarf/dwarf2reader.cc
index 6e7a2f1d..dd21561d 100644
--- a/src/common/mac/dwarf/dwarf2reader.cc
+++ b/src/common/mac/dwarf/dwarf2reader.cc
@@ -26,7 +26,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include <ext/hash_map>
#include <stack>
#include <utility>
@@ -35,17 +34,6 @@
#include "common/mac/dwarf/bytereader.h"
#include "common/mac/dwarf/line_state_machine.h"
-namespace __gnu_cxx
-{
- template<> struct hash< std::string >
- {
- size_t operator()( const std::string& x ) const
- {
- return hash< const char* >()( x.c_str() );
- }
- };
-}
-
namespace dwarf2reader {
// Read a DWARF2/3 initial length field from START, using READER, and
diff --git a/src/common/mac/dwarf/dwarf2reader.h b/src/common/mac/dwarf/dwarf2reader.h
index f27cdac7..cb47d97f 100644
--- a/src/common/mac/dwarf/dwarf2reader.h
+++ b/src/common/mac/dwarf/dwarf2reader.h
@@ -36,8 +36,8 @@
#ifndef COMMON_MAC_DWARF_DWARF2READER_H__
#define COMMON_MAC_DWARF_DWARF2READER_H__
-#include <ext/hash_map>
#include <list>
+#include <map>
#include <string>
#include <utility>
#include <vector>
@@ -46,7 +46,6 @@
#include "common/mac/dwarf/types.h"
using namespace std;
-using namespace __gnu_cxx;
namespace dwarf2reader {
struct LineStateMachine;
@@ -56,7 +55,7 @@ class LineInfoHandler;
// This maps from a string naming a section to a pair containing a
// the data for the section, and the size of the section.
-typedef hash_map<string, pair<const char*, uint64> > SectionMap;
+typedef map<string, pair<const char*, uint64> > SectionMap;
typedef list<pair<enum DwarfAttribute, enum DwarfForm> > AttributeList;
typedef AttributeList::iterator AttributeIterator;
typedef AttributeList::const_iterator ConstAttributeIterator;
diff --git a/src/common/mac/dwarf/functioninfo.cc b/src/common/mac/dwarf/functioninfo.cc
index 267d6cf9..3501c035 100644
--- a/src/common/mac/dwarf/functioninfo.cc
+++ b/src/common/mac/dwarf/functioninfo.cc
@@ -39,27 +39,6 @@
#include "common/mac/dwarf/bytereader.h"
-namespace __gnu_cxx {
-
-// Implement a string hash function so that std::string can be used as a key
-// in STL maps and sets. The hash algorithm comes from the GNU C++ library,
-// in <tr1/functional>. It is duplicated here because GCC versions prior to
-// 4.3.2 are unable to compile <tr1/functional> when RTTI is disabled, as it
-// may be in this code.
-
-template<>
-struct hash<std::string> {
- std::size_t operator()(const std::string& s) const {
- std::size_t result = 0;
- for (std::string::const_iterator i = s.begin(); i != s.end(); ++i)
- result = (result * 131) + *i;
- return result;
- }
-};
-
-} // namespace __gnu_cxx
-
-
namespace dwarf2reader {
// Given an offset value, its form, and the base offset of the
diff --git a/src/google_breakpad/processor/basic_source_line_resolver.h b/src/google_breakpad/processor/basic_source_line_resolver.h
index 38759579..c01cc685 100644
--- a/src/google_breakpad/processor/basic_source_line_resolver.h
+++ b/src/google_breakpad/processor/basic_source_line_resolver.h
@@ -33,28 +33,14 @@
#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:
@@ -85,23 +71,13 @@ 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
diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
index fe04439e..63a94a3a 100644
--- a/src/processor/basic_source_line_resolver.cc
+++ b/src/processor/basic_source_line_resolver.cc
@@ -51,9 +51,6 @@
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 {
@@ -125,11 +122,7 @@ 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
@@ -702,15 +695,9 @@ 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