Avoid over-suppressing fns & vars when analysing the Kernel
authorDodji Seketeli <dodji@redhat.com>
Tue, 19 Feb 2019 15:34:45 +0000 (16:34 +0100)
committerDodji Seketeli <dodji@redhat.com>
Tue, 19 Feb 2019 16:42:56 +0000 (17:42 +0100)
commite9c66d2d75e690ee19778c627a4309489e5f443e
tree667127277b484ff4831fa8da2697bee2e2e25afd
parentc00e2120b901eefb84091802e5173acfcfe3da2c
Avoid over-suppressing fns & vars when analysing the Kernel

When analyzing the Linux Kernel (with e.g abidw) and providing a
symbol whitelist the DWARF reader performs a speed optimization which
is that it does not read the symbol table of the kernel binary.

To know if a function is to be suppressed (because it doesn't belong
to the whitelist, for instance) dwarf_reader::function_is_suppressed
actually tries to see if the address of the function corresponds to
the address of an ELF symbol that is publicly exported, before looking
at if the function was suppressed by a suppression specification.

But then, when a whitelist is provided and the speed optimization of
not reading the symbol table is at play, there is no information about
ELF symbol addressed around.  So dwarf_reader::function_is_suppressed
almost always supposes that the function is suppressed.

This patch fixes that by not trying to look at the address of the
function/variable when the symbol table optimization is on.

* include/abg-dwarf-reader.h (get_ignore_symbol_table): Take a
const read_context&.
* src/abg-dwarf-reader.cc (get_ignore_symbol_table): Likewise.
(function_is_suppressed): When the symbol table optimization is in
flight -- that is, when no symbol table has been loaded -- do not
try to see if a given function symbol was exported at the ELF
level or not.  Just look at if the function was suppressed or not.
(variable_is_suppressed): Likewise for variables.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-dwarf-reader.h
src/abg-dwarf-reader.cc