abidw: Add --abixml-version
Add a command line option to display the version number of the ABIXML output format. * doc/manuals/abidw.rst: Document the --abixml-version command line option. * configure.ac (ABIXML_VERSION_MAJOR, ABIXML_VERSION_MINOR): Define these two new autoconf variables. * include/abg-config.h (abigail_get_abixml_version): Declare new function. * include/abg-tools-utils.h (get_abixml_version_string): Declare new function. * include/abg-version.h.in (ABIGAIL_ABIXML_VERSION_MAJOR) (ABIGAIL_ABIXML_VERSION_MINOR): Define new preprocessor macros. * src/abg-config.cc (config::config): Initialize config::m_format_{minor,major} using the newly defined preprocessor macros ABIGAIL_ABIXML_VERSION_M{IN,AJ}OR. * src/abg-tools-utils.cc (get_abixml_version_string): Define new function. * tools/abidw.cc (options::display_abixml_version): Define new data member. (options::options): Initialize it. (display_usage): Emit a help string for the new --abixml-version option. (parse_command_line): Parse the --abixml-version string. (main): Emit the abixml version when asked. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
861e4670b6
commit
522cc62b9b
|
@ -38,10 +38,14 @@ AM_SILENT_RULES([yes])
|
||||||
VERSION_MAJOR=version_major
|
VERSION_MAJOR=version_major
|
||||||
VERSION_MINOR=version_minor
|
VERSION_MINOR=version_minor
|
||||||
VERSION_REVISION=0
|
VERSION_REVISION=0
|
||||||
|
ABIXML_VERSION_MAJOR=2
|
||||||
|
ABIXML_VERSION_MINOR=1
|
||||||
|
|
||||||
AC_SUBST(VERSION_MAJOR)
|
AC_SUBST(VERSION_MAJOR)
|
||||||
AC_SUBST(VERSION_MINOR)
|
AC_SUBST(VERSION_MINOR)
|
||||||
AC_SUBST(VERSION_REVISION)
|
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 This VERSION_SUFFIX environment variable is to allow appending
|
||||||
dnl arbitrary text to the libabigail version string representation.
|
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
|
abidw reads a shared library in `ELF`_ format and emits an XML
|
||||||
representation of its ABI to standard output. The emitted
|
representation of its ABI to standard output. The emitted
|
||||||
representation includes all the globally defined functions and
|
representation format, named ``ABIXML``, includes all the globally
|
||||||
variables, along with a complete representation of their types. It
|
defined functions and variables, along with a complete representation
|
||||||
also includes a representation of the globally defined ELF symbols of
|
of their types. It also includes a representation of the globally
|
||||||
the file. The input shared library must contain associated debug
|
defined ELF symbols of the file. The input shared library must
|
||||||
information in `DWARF`_ format.
|
contain associated debug information in `DWARF`_ format.
|
||||||
|
|
||||||
When given the ``--linux-tree`` option, this program can also handle a
|
When given the ``--linux-tree`` option, this program can also handle a
|
||||||
Linux kernel tree. That is, a directory tree that contains both the
|
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.
|
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*>
|
* ``--debug-info-dir | -d`` <*dir-path*>
|
||||||
|
|
||||||
In cases where the debug info for *path-to-elf-file* is in a
|
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& min,
|
||||||
std::string& rev,
|
std::string& rev,
|
||||||
std::string& suf);
|
std::string& suf);
|
||||||
|
|
||||||
|
void
|
||||||
|
abigail_get_abixml_version(std::string& maj, std::string& min);
|
||||||
}
|
}
|
||||||
|
|
||||||
}//end namespace abigail
|
}//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 string_suffix(const string&, const string&, string&);
|
||||||
bool sorted_strings_common_prefix(vector<string>&, string&);
|
bool sorted_strings_common_prefix(vector<string>&, string&);
|
||||||
string get_library_version_string();
|
string get_library_version_string();
|
||||||
|
string get_abixml_version_string();
|
||||||
bool execute_command_and_get_output(const string&, vector<string>&);
|
bool execute_command_and_get_output(const string&, vector<string>&);
|
||||||
bool get_dsos_provided_by_rpm(const string& rpm_path,
|
bool get_dsos_provided_by_rpm(const string& rpm_path,
|
||||||
set<string>& provided_dsos);
|
set<string>& provided_dsos);
|
||||||
|
|
|
@ -5,4 +5,6 @@
|
||||||
#define ABIGAIL_VERSION_MINOR "@VERSION_MINOR@"
|
#define ABIGAIL_VERSION_MINOR "@VERSION_MINOR@"
|
||||||
#define ABIGAIL_VERSION_REVISION "@VERSION_REVISION@"
|
#define ABIGAIL_VERSION_REVISION "@VERSION_REVISION@"
|
||||||
#define ABIGAIL_VERSION_SUFFIX "@VERSION_SUFFIX@"
|
#define ABIGAIL_VERSION_SUFFIX "@VERSION_SUFFIX@"
|
||||||
|
#define ABIGAIL_ABIXML_VERSION_MAJOR "@ABIXML_VERSION_MAJOR@"
|
||||||
|
#define ABIGAIL_ABIXML_VERSION_MINOR "@ABIXML_VERSION_MINOR@"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,8 +18,8 @@ ABG_END_EXPORT_DECLARATIONS
|
||||||
namespace abigail
|
namespace abigail
|
||||||
{
|
{
|
||||||
config::config()
|
config::config()
|
||||||
: m_format_minor("1"),
|
: m_format_minor(ABIGAIL_ABIXML_VERSION_MINOR),
|
||||||
m_format_major("2"),
|
m_format_major(ABIGAIL_ABIXML_VERSION_MAJOR),
|
||||||
m_xml_element_indent(2),
|
m_xml_element_indent(2),
|
||||||
m_tu_instr_suffix(".bi"),
|
m_tu_instr_suffix(".bi"),
|
||||||
m_tu_instr_archive_suffix(".abi")
|
m_tu_instr_archive_suffix(".abi")
|
||||||
|
@ -80,5 +80,18 @@ abigail_get_library_version(std::string& major,
|
||||||
suffix = ABIGAIL_VERSION_SUFFIX;
|
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
|
}//end namespace abigail
|
||||||
|
|
|
@ -1037,6 +1037,18 @@ get_library_version_string()
|
||||||
return 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.
|
/// Execute a shell command and returns its output.
|
||||||
///
|
///
|
||||||
/// @param cmd the shell command to execute.
|
/// @param cmd the shell command to execute.
|
||||||
|
|
|
@ -84,6 +84,7 @@ struct options
|
||||||
vector<string> kabi_whitelist_paths;
|
vector<string> kabi_whitelist_paths;
|
||||||
suppressions_type kabi_whitelist_supprs;
|
suppressions_type kabi_whitelist_supprs;
|
||||||
bool display_version;
|
bool display_version;
|
||||||
|
bool display_abixml_version;
|
||||||
bool check_alt_debug_info_path;
|
bool check_alt_debug_info_path;
|
||||||
bool show_base_name_alt_debug_info_path;
|
bool show_base_name_alt_debug_info_path;
|
||||||
bool write_architecture;
|
bool write_architecture;
|
||||||
|
@ -117,6 +118,7 @@ struct options
|
||||||
|
|
||||||
options()
|
options()
|
||||||
: display_version(),
|
: display_version(),
|
||||||
|
display_abixml_version(),
|
||||||
check_alt_debug_info_path(),
|
check_alt_debug_info_path(),
|
||||||
show_base_name_alt_debug_info_path(),
|
show_base_name_alt_debug_info_path(),
|
||||||
write_architecture(true),
|
write_architecture(true),
|
||||||
|
@ -165,6 +167,7 @@ display_usage(const string& prog_name, ostream& out)
|
||||||
<< " where options can be: \n"
|
<< " where options can be: \n"
|
||||||
<< " --help|-h display this message\n"
|
<< " --help|-h display this message\n"
|
||||||
<< " --version|-v display program version information and exit\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"
|
<< " --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"
|
<< " --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"
|
<< " --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")
|
else if (!strcmp(argv[i], "--version")
|
||||||
|| !strcmp(argv[i], "-v"))
|
|| !strcmp(argv[i], "-v"))
|
||||||
opts.display_version = true;
|
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")
|
else if (!strcmp(argv[i], "--debug-info-dir")
|
||||||
|| !strcmp(argv[i], "-d"))
|
|| !strcmp(argv[i], "-d"))
|
||||||
{
|
{
|
||||||
|
@ -817,7 +823,8 @@ main(int argc, char* argv[])
|
||||||
|
|
||||||
if (!parse_command_line(argc, argv, opts)
|
if (!parse_command_line(argc, argv, opts)
|
||||||
|| (opts.in_file_path.empty()
|
|| (opts.in_file_path.empty()
|
||||||
&& !opts.display_version))
|
&& !opts.display_version
|
||||||
|
&& !opts.display_abixml_version))
|
||||||
{
|
{
|
||||||
if (!opts.wrong_option.empty())
|
if (!opts.wrong_option.empty())
|
||||||
emit_prefix(argv[0], cerr)
|
emit_prefix(argv[0], cerr)
|
||||||
|
@ -834,6 +841,14 @@ main(int argc, char* argv[])
|
||||||
return 0;
|
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());
|
ABG_ASSERT(!opts.in_file_path.empty());
|
||||||
if (opts.corpus_group_for_linux)
|
if (opts.corpus_group_for_linux)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue