From: Dodji Seketeli Date: Tue, 11 Apr 2023 09:36:15 +0000 (+0200) Subject: abi{dw,diff}: Better error messages when alternate debuginfo not found X-Git-Tag: upstream/2.3~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=acb456a9c20c6985d2f536cb1f752064214b87f9;p=platform%2Fupstream%2Flibabigail.git abi{dw,diff}: Better error messages when alternate debuginfo not found When the alternate debug info referenced by the main debug info file is missing, both abidw and abidiff fail to explain what is happening to the user. The patch adds explicit error messages to those two programs in that case. * tools/abidiff.cc (handle_error): Handle cases where the fe_iface::STATUS[_ALT]_DEBUG_INFO_NOT_FOUND bits are set. Refer to the alternate debug info file in the error message. * tools/abidw.cc (load_corpus_and_write_abixml): Do not clear the reader before emitting the error message, rather clear it after. Also, refer to the alternate debug info file in the error message. Signed-off-by: Dodji Seketeli --- diff --git a/tools/abidiff.cc b/tools/abidiff.cc index d2fa5b63..427c1f19 100644 --- a/tools/abidiff.cc +++ b/tools/abidiff.cc @@ -1047,7 +1047,9 @@ handle_error(abigail::fe_iface::status status_code, const string& prog_name, const options& opts) { - if (!(status_code & abigail::fe_iface::STATUS_OK)) + if (!(status_code & abigail::fe_iface::STATUS_OK) + || status_code & abigail::fe_iface::STATUS_DEBUG_INFO_NOT_FOUND + || status_code & abigail::fe_iface::STATUS_ALT_DEBUG_INFO_NOT_FOUND) { emit_prefix(prog_name, cerr) << "failed to read input file " << opts.file1 << "\n"; @@ -1110,10 +1112,10 @@ handle_error(abigail::fe_iface::status status_code, emit_prefix(prog_name, cerr) << "could not find the alternate debug info file"; - if (rdr->alternate_dwarf_debug_info()) + if (!rdr->alternate_dwarf_debug_info_path().empty()) cerr << " at: " - << rdr->alternate_dwarf_debug_info_path() - << "\n"; + << rdr->alternate_dwarf_debug_info_path(); + cerr << "\n"; } if (status_code & abigail::fe_iface::STATUS_NO_SYMBOLS_FOUND) diff --git a/tools/abidw.cc b/tools/abidw.cc index ddb3846e..eead7889 100644 --- a/tools/abidw.cc +++ b/tools/abidw.cc @@ -662,11 +662,6 @@ load_corpus_and_write_abixml(char* argv[], emit_prefix(argv[0], cerr) << "read corpus from elf file in: " << t << "\n"; - // Clear some resources to gain back some space. - t.start(); - reader.reset(); - t.stop(); - if (opts.do_log) emit_prefix(argv[0], cerr) << "reset reader ELF in: " << t << "\n"; @@ -709,10 +704,27 @@ load_corpus_and_write_abixml(char* argv[], emit_prefix(argv[0], cerr) << "Could not read ELF symbol information from " << opts.in_file_path << "\n"; + else if (s & fe_iface::STATUS_ALT_DEBUG_INFO_NOT_FOUND) + { + emit_prefix(argv[0], cerr) + << "Could not read alternate debug info file"; + if (!reader->alternate_dwarf_debug_info_path().empty()) + cerr << " '" << reader->alternate_dwarf_debug_info_path() << "'"; + cerr << " for '" + << opts.in_file_path << "'.\n"; + emit_prefix(argv[0], cerr) + << "You might have forgotten to install some " + "additional needed debug info\n"; + } return 1; } + // Clear some resources to gain back some space. + t.start(); + reader.reset(); + t.stop(); + // Now create a write context and write out an ABI XML description // of the read corpus. t.start();