@@ -38,10 +38,14 @@ AM_SILENT_RULES([yes])
VERSION_MAJOR=version_major
VERSION_MINOR=version_minor
VERSION_REVISION=0
+ABIXML_VERSION_MAJOR=2
+ABIXML_VERSION_MINOR=1
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_REVISION)
+AC_SUBST(ABIXML_VERSION_MAJOR)
+AC_SUBST(ABIXML_VERSION_MINOR)
dnl This VERSION_SUFFIX environment variable is to allow appending
dnl arbitrary text to the libabigail version string representation.
@@ -5,11 +5,11 @@ abidw
abidw reads a shared library in `ELF`_ format and emits an XML
representation of its ABI to standard output. The emitted
-representation includes all the globally defined functions and
-variables, along with a complete representation of their types. It
-also includes a representation of the globally defined ELF symbols of
-the file. The input shared library must contain associated debug
-information in `DWARF`_ format.
+representation format, named ``ABIXML``, includes all the globally
+defined functions and variables, along with a complete representation
+of their types. It also includes a representation of the globally
+defined ELF symbols of the file. The input shared library must
+contain associated debug information in `DWARF`_ format.
When given the ``--linux-tree`` option, this program can also handle a
Linux kernel tree. That is, a directory tree that contains both the
@@ -39,6 +39,10 @@ Options
Display the version of the program and exit.
+ * `--abixml-version`
+
+ Display the version of the ABIXML format emitted by this program and exit.
+
* ``--debug-info-dir | -d`` <*dir-path*>
In cases where the debug info for *path-to-elf-file* is in a
@@ -72,6 +72,9 @@ extern "C"
std::string& min,
std::string& rev,
std::string& suf);
+
+ void
+ abigail_get_abixml_version(std::string& maj, std::string& min);
}
}//end namespace abigail
@@ -61,6 +61,7 @@ bool split_string(const string&, const string&, vector<string>&);
bool string_suffix(const string&, const string&, string&);
bool sorted_strings_common_prefix(vector<string>&, string&);
string get_library_version_string();
+string get_abixml_version_string();
bool execute_command_and_get_output(const string&, vector<string>&);
bool get_dsos_provided_by_rpm(const string& rpm_path,
set<string>& provided_dsos);
@@ -5,4 +5,6 @@
#define ABIGAIL_VERSION_MINOR "@VERSION_MINOR@"
#define ABIGAIL_VERSION_REVISION "@VERSION_REVISION@"
#define ABIGAIL_VERSION_SUFFIX "@VERSION_SUFFIX@"
+#define ABIGAIL_ABIXML_VERSION_MAJOR "@ABIXML_VERSION_MAJOR@"
+#define ABIGAIL_ABIXML_VERSION_MINOR "@ABIXML_VERSION_MINOR@"
#endif
@@ -18,8 +18,8 @@ ABG_END_EXPORT_DECLARATIONS
namespace abigail
{
config::config()
- : m_format_minor("1"),
- m_format_major("2"),
+ : m_format_minor(ABIGAIL_ABIXML_VERSION_MINOR),
+ m_format_major(ABIGAIL_ABIXML_VERSION_MAJOR),
m_xml_element_indent(2),
m_tu_instr_suffix(".bi"),
m_tu_instr_archive_suffix(".abi")
@@ -80,5 +80,18 @@ abigail_get_library_version(std::string& major,
suffix = ABIGAIL_VERSION_SUFFIX;
}
+/// Return the version numbers for the ABIXML format.
+///
+/// @param maj the major version number of the ABIXML format.
+///
+/// @param min the minor version number of the ABIXML format.
+void
+abigail_get_abixml_version(std::string& major,
+ std::string& minor)
+{
+ major = ABIGAIL_ABIXML_VERSION_MAJOR;
+ minor = ABIGAIL_ABIXML_VERSION_MINOR;
+}
+
}
}//end namespace abigail
@@ -1037,6 +1037,18 @@ get_library_version_string()
return version_string;
}
+/// Return the version string for the ABIXML format.
+///
+/// @return the version string of the ABIXML format.
+string
+get_abixml_version_string()
+{
+ string major, minor, version_string;
+ abigail::abigail_get_abixml_version(major, minor);
+ version_string = major + "." + minor;
+ return version_string;
+}
+
/// Execute a shell command and returns its output.
///
/// @param cmd the shell command to execute.
@@ -84,6 +84,7 @@ struct options
vector<string> kabi_whitelist_paths;
suppressions_type kabi_whitelist_supprs;
bool display_version;
+ bool display_abixml_version;
bool check_alt_debug_info_path;
bool show_base_name_alt_debug_info_path;
bool write_architecture;
@@ -117,6 +118,7 @@ struct options
options()
: display_version(),
+ display_abixml_version(),
check_alt_debug_info_path(),
show_base_name_alt_debug_info_path(),
write_architecture(true),
@@ -165,6 +167,7 @@ display_usage(const string& prog_name, ostream& out)
<< " where options can be: \n"
<< " --help|-h display this message\n"
<< " --version|-v display program version information and exit\n"
+ << " --abixml-version display the version of the ABIXML ABI format\n"
<< " --debug-info-dir|-d <dir-path> look for debug info under 'dir-path'\n"
<< " --headers-dir|--hd <path> the path to headers of the elf file\n"
<< " --header-file|--hf <path> the path one header of the elf file\n"
@@ -229,6 +232,9 @@ parse_command_line(int argc, char* argv[], options& opts)
else if (!strcmp(argv[i], "--version")
|| !strcmp(argv[i], "-v"))
opts.display_version = true;
+ else if (!strcmp(argv[i], "--abixml-version")
+ || !strcmp(argv[i], "-v"))
+ opts.display_abixml_version = true;
else if (!strcmp(argv[i], "--debug-info-dir")
|| !strcmp(argv[i], "-d"))
{
@@ -817,7 +823,8 @@ main(int argc, char* argv[])
if (!parse_command_line(argc, argv, opts)
|| (opts.in_file_path.empty()
- && !opts.display_version))
+ && !opts.display_version
+ && !opts.display_abixml_version))
{
if (!opts.wrong_option.empty())
emit_prefix(argv[0], cerr)
@@ -834,6 +841,14 @@ main(int argc, char* argv[])
return 0;
}
+ if (opts.display_abixml_version)
+ {
+ emit_prefix(argv[0], cout)
+ << abigail::tools_utils::get_abixml_version_string()
+ << "\n";
+ return 0;
+ }
+
ABG_ASSERT(!opts.in_file_path.empty());
if (opts.corpus_group_for_linux)
{