abipkgdiff: Emit error when no vmlinux is found in debug package
authorDodji Seketeli <dodji@redhat.com>
Mon, 27 Feb 2023 17:38:26 +0000 (18:38 +0100)
committerDodji Seketeli <dodji@redhat.com>
Tue, 28 Feb 2023 10:33:42 +0000 (11:33 +0100)
When given linux kernel packages to analyze using DWARF, the tool
expects the (uncompressed) vmlinux binary to be found in the debug
info package.

This patch emits an error message when no vmlinux binary is found in
the debug info package in that case.

* tools/abipkgdiff.cc (compare_prepared_linux_kernel_packages):
When no vmlinux binary is found in the debug info package, emit an
error message.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tools/abipkgdiff.cc

index 8383ae98fc523db002706d5fed0a2d689ddc3ada..a4b4f1a130bbf76623ee13cb775cc15b733e8119 100644 (file)
@@ -3107,11 +3107,25 @@ compare_prepared_linux_kernel_packages(package& first_package,
 
   string vmlinux_path1, vmlinux_path2;
 
-  if (!get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
-    return abigail::tools_utils::ABIDIFF_ERROR;
+  if (!vmlinux_path1.empty()
+      && !get_vmlinux_path_from_kernel_dist(debug_dir1, vmlinux_path1))
+    {
+      emit_prefix("abipkgdiff", cerr)
+       << "Could not find vmlinux in debuginfo package '"
+       << first_package.path()
+       << "\n";
+      return abigail::tools_utils::ABIDIFF_ERROR;
+    }
 
-  if (!get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
-    return abigail::tools_utils::ABIDIFF_ERROR;
+  if (!vmlinux_path2.empty()
+      && !get_vmlinux_path_from_kernel_dist(debug_dir2, vmlinux_path2))
+    {
+      emit_prefix("abipkgdiff", cerr)
+       << "Could not find vmlinux in debuginfo package '"
+       << second_package.path()
+       << "\n";
+      return abigail::tools_utils::ABIDIFF_ERROR;
+    }
 
   string dist_root1 = first_package.extracted_dir_path();
   string dist_root2 = second_package.extracted_dir_path();