]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ctf: duplicate-detect dependent types properly
authorNick Alcock <nick.alcock@oracle.com>
Mon, 15 Dec 2014 19:08:01 +0000 (19:08 +0000)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:55 +0000 (15:29 +0100)
commit943c00a49fc900ed8f145f8402936cdbac97a4be
treede8f122d84dd1acf8f26a4baed21a9fc53360aa7
parent6447d0200cfab699ccbdaa44d63481622748604a
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>
scripts/dwarf2ctf/dwarf2ctf.c