3 // Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 // Free Software Foundation, Inc.
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License as
8 // published by the Free Software Foundation; either version 3, or (at
9 // your option) any later version.
11 // This library is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // Benjamin Kosnik <bkoz@redhat.com>
26 #include <tr1/unordered_map>
29 // Encapsulates symbol characteristics.
32 enum category { function, object, tls, uncategorized };
33 enum designation { existing, added, subtracted, undesignated };
34 enum version { none, compatible, incompatible, unversioned };
45 std::string raw_name; // Name with versioning info still attached.
46 std::string demangled_name;
48 std::string version_name;
49 version version_status;
53 : type(uncategorized), size(0), version_status(unversioned),
54 status(undesignated) { }
56 symbol(const symbol& other)
57 : type(other.type), name(other.name), demangled_name(other.demangled_name),
58 size(other.size), version_name(other.version_name),
59 version_status(other.version_status), status(other.status) { }
65 init(std::string& data);
68 // Map type between symbol names and full symbol info.
69 typedef std::tr1::unordered_map<std::string, symbol> symbols;
74 check_version(symbol& test, bool added = false);
77 check_compatible(symbol& lhs, symbol& rhs, bool verbose = false);
82 has_symbol(const std::string& mangled, const symbols& list) throw();
85 get_symbol(const std::string& mangled, const symbols& list);
88 examine_symbol(const char* name, const char* file);
91 compare_symbols(const char* baseline_file, const char* test_file, bool verb);
96 create_symbols(const char* file);
99 demangle(const std::string& mangled);