[applied] abi{dw,diff}: Better error messages when alternate debuginfo not found
Commit Message
Hello,
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 <dodji@redhat.com>
---
tools/abidiff.cc | 10 ++++++----
tools/abidw.cc | 22 +++++++++++++++++-----
2 files changed, 23 insertions(+), 9 deletions(-)
@@ -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)
@@ -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();