3 // Copyright (C) 2004, 2005 Free Software Foundation, Inc.
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 2, or (at
8 // your option) any later version.
10 // This library is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this library; see the file COPYING. If not, write to
17 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
18 // MA 02111-1307, USA.
20 // As a special exception, you may use this file as part of a free
21 // software library without restriction. Specifically, if other files
22 // instantiate templates or use macros or inline functions from this
23 // file, or you compile this file and link it with other files to
24 // produce an executable, this file does not by itself cause the
25 // resulting executable to be covered by the GNU General Public
26 // License. This exception does not however invalidate any other
27 // reasons why the executable file might be covered by the GNU General
30 // Benjamin Kosnik <bkoz@redhat.com>
35 #include <ext/hash_map>
38 // Encapsulates symbol characteristics.
41 enum category
{ none
, function
, object
, error
};
42 enum designation
{ unknown
, added
, subtracted
, compatible
, incompatible
};
53 std::string demangled_name
;
55 std::string version_name
;
58 symbol() : type(none
), size(0), status(unknown
) { }
60 symbol(const symbol
& other
)
61 : type(other
.type
), name(other
.name
), demangled_name(other
.demangled_name
),
62 size(other
.size
), version_name(other
.version_name
),
63 status(other
.status
) { }
69 init(std::string
& data
);
72 typedef __gnu_cxx::hash_map
<std::string
, symbol
> symbol_objects
;
74 typedef std::deque
<std::string
> symbol_names
;
76 typedef std::pair
<symbol_names
, symbol_objects
> symbols
;
81 check_version(const symbol
& test
, bool added
= false);
84 check_compatible(const symbol
& lhs
, const symbol
& rhs
, bool verbose
= false);
89 has_symbol(const std::string
& mangled
, const symbols
& list
) throw();
92 get_symbol(const std::string
& mangled
, const symbols
& list
);
95 examine_symbol(const char* name
, const char* file
);
98 compare_symbols(const char* baseline_file
, const char* test_file
, bool verb
);
103 create_symbols(const char* file
);
106 demangle(const std::string
& mangled
);
117 size_t operator()(const string
& s
) const
119 const collate
<char>& c
= use_facet
<collate
<char> >(locale::classic());
120 return c
.hash(s
.c_str(), s
.c_str() + s
.size());