Bug 19621 - Add a way to detect if debug info is empty/missing for the command-line tools
Summary: Add a way to detect if debug info is empty/missing for the command-line tools
Status: RESOLVED FIXED
Alias: None
Product: libabigail
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-12 09:39 UTC by Michi Henning
Modified: 2019-01-10 11:36 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michi Henning 2016-02-12 09:39:46 UTC
I'm pasting some test from the mailing list discussion below. It would be really nice to have a way to find out whether I'm accidentally running the tool against libs that weren't compiled with -g.

One thing to keep in mind that the exit status will rapidly run out of bits, so it might be worth thinking about some other way to communicate such details to the caller.

---------

One thing I have to deal with is that the unit tests may be run with release mode locally, in which case the binaries are compiled without -g.

I can run abidw on the shared lib, but the ABI dump that is generated doesn’t contain any useful info for doing a real ABI compliance test. When I run

   abidiff baseline_with_debug_dump current_without_debug_dump

abidiff tells me that everything is fine. This is awkward because it gives me a possibly false negative. The code that was compiled might indeed break the ABI but, because it was compiled without -g, abidiff gives the wrong answer.

Currently, I’m using this as a work-around:
# If the current lib doesn't contain debug info, we can't run the test.
info_file=$(mktemp)
readelf --debug-dump=info @CMAKE_BINARY_DIR@/${libname}.so >$info_file
[ $? -ne 0 ] && exit 1
[ -s $info_file ]
no_debug_info=$?
rm -f $info_file
[ $no_debug_info -eq 1 ] && {
   echo "${progname}: Skipping ABI test because ${libname}.so was compiled without -g"
   exit 0
}

But this is quite awkward and costly, and I need to drag binutils into my build, which I otherwise wouldn’t need.
Comment 1 Dodji Seketeli 2019-01-10 11:36:03 UTC
abidiff now contains the --fail-no-debug-info option to do just that.
If no debug info was found, the tool just fails rather than saying that everything is fine.

Thank you for taking the time to file this issue and sorry for the inconvenience.