[06/11] abipkgdiff: Add new --verbose-diff option

Message ID 87h65bjc68.fsf@redhat.com
State New
Headers
Series None |

Commit Message

Dodji Seketeli Feb. 3, 2025, 3:11 p.m. UTC
  Hello,

When trying to know where abipkgdiff spends time, it can be useful to
see timed logs of the actual diffing process, including the computing
of the diff and the categorization of the diff nodes.

This patch adds the new --verbose-diff option which does just that.

	* doc/manuals/abipkgdiff.rst: Document the new --verbose-diff
	option.
	* tools/abipkgdiff.cc (options::verbose_diff): New data member.
	(options::options): Initialize the new data member.
	(set_diff_context_from_opts): Activate logging of the diffing
	process when the user issues the --verbose-diff option.
	(parse_command_line): Parse --verbose-diff.  Activate --verbose
	when --verbose-diff is given.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the mainline.
---
 doc/manuals/abipkgdiff.rst | 6 ++++++
 tools/abipkgdiff.cc        | 9 +++++++++
 2 files changed, 15 insertions(+)
  

Patch

diff --git a/doc/manuals/abipkgdiff.rst b/doc/manuals/abipkgdiff.rst
index 5f499ae1..cba6fddb 100644
--- a/doc/manuals/abipkgdiff.rst
+++ b/doc/manuals/abipkgdiff.rst
@@ -513,6 +513,12 @@  Options
     Emit verbose progress messages.
 
 
+  * ``--verbose-diff``
+
+    Emit timed verbose progress messages about the diffing process.
+    This option implies the --verbose one.
+
+
   * ``--self-check``
 
     This is used to test the underlying Libabigail library.  When in
diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index 602271ff..c55ae577 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -188,6 +188,7 @@  public:
   string	devel_package2;
   size_t	num_workers;
   bool		verbose;
+  bool		verbose_diff;
   bool		drop_private_types;
   bool		show_relative_offset_changes;
   bool		no_default_suppression;
@@ -236,6 +237,7 @@  public:
       abignore(true),
       parallel(true),
       verbose(),
+      verbose_diff(),
       drop_private_types(),
       show_relative_offset_changes(true),
       no_default_suppression(),
@@ -919,6 +921,7 @@  display_usage(const string& prog_name, ostream& out)
     << " --no-assume-odr-for-cplusplus  do not assume the ODR to speed-up the"
     "analysis of the binary\n"
     << " --verbose                      emit verbose progress messages\n"
+    << " --verbose-diff                 emit verbose diff progress messages\n"
     << " --self-check                   perform a sanity check by comparing "
     "binaries inside the input package against their ABIXML representation\n"
 #ifdef WITH_CTF
@@ -1276,6 +1279,7 @@  set_diff_context_from_opts(diff_context_sptr ctxt,
     (opts.show_added_syms);
   ctxt->show_symbols_unreferenced_by_debug_info
     (opts.show_symbols_not_referenced_by_debug_info);
+  ctxt->do_log(opts.verbose_diff);
 
   if (!opts.show_harmless_changes)
     ctxt->switch_categories_off(get_default_harmless_categories_bitmap());
@@ -3634,6 +3638,11 @@  parse_command_line(int argc, char* argv[], options& opts)
 	opts.assume_odr_for_cplusplus = false;
       else if (!strcmp(argv[i], "--verbose"))
 	opts.verbose = true;
+      else if (!strcmp(argv[i], "--verbose-diff"))
+	{
+	  opts.verbose_diff = true;
+	  opts.verbose = true;
+	}
       else if (!strcmp(argv[i], "--no-abignore"))
 	opts.abignore = false;
       else if (!strcmp(argv[i], "--no-parallel"))