Open agrandi opened 3 years ago
Hello!
Is it optimized out from the binary by the compiler?
Good question! I am not even sure if the struct definition will appear in the binary. From my understanding, the information about the struct members should come from the struct definition in the header file, right?
It is not part of the stripped binary. But I mean the binary with debug-info (extra .debug_info
section).
Let's check this by:
abi-dumper ./your_library.so --extra-info=./DEBUG_DUMP
grep -nR your_struct_type_name ./DEBUG_DUMP
If it's not part of the debug-info then abi-dumper
cannot extract it. Probably the compiler (GCC, Clang, etc.) can have an option to include such data types to the debug-info (see -fkeep-inline-functions
for example).
Thanks! I think we are on the right track. I checked the content of the DEBUG_DUMP and the struct that is passed as void *
is not included. On the other hand, I confirmed that other structs that are explicitly passed as arguments to my functions are included, for example:
DEBUG_DUMP/debug_info:72: name (strp) "stats_data"
I'll investigate the gcc options to see if there is anything useful there.
This looks promising: -fno-eliminate-unused-debug-types
Source: https://stackoverflow.com/questions/35324109/gdb-see-unused-struct-typedef
Let me run some test and I'll get back to you.
It works for me. Probably we need to add this option to abi-dumper documentation near the -g -Og
.
Good idea! That would be very useful for future reference.
Hello and thanks a lot for developing this great set of tools!
I am using this to check a C library that exposes a large number of symbols in its public interface. Some of these symbols are struct definitions that are not directly used in any of the public functions.
For example, in one of my header files I have the following:
The type of
void *o
depends on the value of the first argumenttype
. Thestruct data
is one of the possible argument types and it will be casted inside the function.The problem is that non-backward compatible changes to
struct data
are not detected and flagged as error by the tool. In fact, it looks likestruct data
is not even part of the dump. So far I tried to add the options-all -dump-static
to the abi-dumper as well as-ext
to the abi-compliance-checker. However these do not seem to work.The only way to detect these changes is to add a dummy function that explicitly takes an argument of type
struct data
.This is not very friendly and convenient to use. Is there any other option that I should try?
Thanks!