3 // Copyright (C) 2004-2025 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 3, 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 COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
19 // Benjamin Kosnik <bkoz@redhat.com>
25 #if __cplusplus >= 201103L
26 # include <unordered_map>
27 # ifdef _GLIBCXX_DEBUG
28 namespace unord
= std::_GLIBCXX_STD_C
;
30 namespace unord
= std
;
33 # include <tr1/unordered_map>
34 namespace unord
= std::tr1
;
38 // Encapsulates symbol characteristics.
41 enum category
{ function
, object
, tls
, uncategorized
};
42 enum designation
{ existing
, added
, subtracted
, undesignated
};
43 enum version
{ none
, compatible
, incompatible
, unversioned
};
54 std::string raw_name
; // Name with versioning info still attached.
55 std::string demangled_name
;
57 std::string version_name
;
58 version version_status
;
62 : type(uncategorized
), size(0), version_status(unversioned
),
63 status(undesignated
) { }
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
) { }
74 init(std::string
& data
);
77 // Map type between symbol names and full symbol info.
78 typedef unord::unordered_map
<std::string
, symbol
> symbols
;
83 check_version(symbol
& test
, bool added
= false);
86 check_compatible(symbol
& lhs
, symbol
& rhs
, bool verbose
= false);
91 has_symbol(const std::string
& mangled
, const symbols
& list
) throw();
94 get_symbol(const std::string
& mangled
, const symbols
& list
);
97 examine_symbol(const char* name
, const char* file
);
100 compare_symbols(const char* baseline_file
, const char* test_file
, bool verb
);
105 create_symbols(const char* file
);
108 demangle(const std::string
& mangled
);