| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#include <string> |
| 22 |
#include <stdexcept> |
| 23 |
#include <vector> |
| 24 |
#include <locale> |
| 25 |
#if __cplusplus >= 201103L |
| 26 |
# include <unordered_map> |
| 27 |
# ifdef _GLIBCXX_DEBUG |
| 28 |
namespace unord = std::_GLIBCXX_STD_C; |
| 29 |
# else |
| 30 |
namespace unord = std; |
| 31 |
# endif |
| 32 |
#else |
| 33 |
# include <tr1/unordered_map> |
| 34 |
namespace unord = std::tr1; |
| 35 |
#endif |
| 36 |
#include <cxxabi.h> |
| 37 |
|
| 38 |
|
| 39 |
struct symbol |
| 40 |
{ |
| 41 |
enum category { function, object, tls, uncategorized }; |
| 42 |
enum designation { existing, added, subtracted, undesignated }; |
| 43 |
enum version { none, compatible, incompatible, unversioned }; |
| 44 |
enum compatibility |
| 45 |
{ |
| 46 |
compat_type = 1, |
| 47 |
compat_name = 2, |
| 48 |
compat_size = 4, |
| 49 |
compat_version = 8 |
| 50 |
}; |
| 51 |
|
| 52 |
category type; |
| 53 |
std::string name; |
| 54 |
std::string raw_name; |
| 55 |
std::string demangled_name; |
| 56 |
int size; |
| 57 |
std::string version_name; |
| 58 |
version version_status; |
| 59 |
designation status; |
| 60 |
|
| 61 |
symbol() |
| 62 |
: type(uncategorized), size(0), version_status(unversioned), |
| 63 |
status(undesignated) { } |
| 64 |
|
| 65 |
symbol(const symbol& other) |
| 66 |
: type(other.type), name(other.name), demangled_name(other.demangled_name), |
| 67 |
size(other.size), version_name(other.version_name), |
| 68 |
version_status(other.version_status), status(other.status) { } |
| 69 |
|
| 70 |
void |
| 71 |
print() const; |
| 72 |
|
| 73 |
void |
| 74 |
init(std::string& data); |
| 75 |
}; |
| 76 |
|
| 77 |
|
| 78 |
typedef unord::unordered_map<std::string, symbol> symbols; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
bool |
| 83 |
check_version(symbol& test, bool added = false); |
| 84 |
|
| 85 |
bool |
| 86 |
check_compatible(symbol& lhs, symbol& rhs, bool verbose = false); |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
bool |
| 91 |
has_symbol(const std::string& mangled, const symbols& list) throw(); |
| 92 |
|
| 93 |
const symbol& |
| 94 |
get_symbol(const std::string& mangled, const symbols& list); |
| 95 |
|
| 96 |
extern "C" void |
| 97 |
examine_symbol(const char* name, const char* file); |
| 98 |
|
| 99 |
extern "C" int |
| 100 |
compare_symbols(const char* baseline_file, const char* test_file, bool verb); |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
symbols |
| 105 |
create_symbols(const char* file); |
| 106 |
|
| 107 |
std::string |
| 108 |
demangle(const std::string& mangled); |