ctf: duplicate-detect dependent types properly
dwarf2ctf's duplicate-detection machinery takes care to spot and mark members of
structures reliably, but does not take quite the same care with dependent types.
Code such as that in drivers/net/wireless/brcm80211/brcmsmac/phy_shim.c:
struct wlapi_timer *wlapi_init_timer(struct phy_shim_info *physhim,
void (*fn)(struct brcms_phy *pi),
void *arg, const char *name);
where no definition of struct brcms_phy is already in scope, produces this
DWARF for the "fn" pointer:
[ b0426] subroutine_type
prototyped (flag)
sibling (ref4) [ b0438]
[ b042c] formal_parameter
type (ref4) [ b0438]
[ b0431] structure_type
name (strp) "brcms_phy"
declaration (flag)
[ b043e] pointer_type
byte_size (data1) 8
type (ref4) [ b0426]
The pointer is marked as seen, since it is at the top level, but the
structure_type, because it is inside a subroutine_type, does not. Type emission
then recurses through dependent types and crashes horribly.
The fix is to recurse through dependent types (via a type_id() callback) when
marking things as seen.
Unfortunately this slows down dwarf2ctf quite a lot: speedups are next on the
agenda.
Orabug:
20229431
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>