finally I made #gcc plugin to collect struct/classes fields & virtual methods calls cross-references, part 1: redplait.blogspot.com/2023/0… plugin src: github.com/redplait/dwarfdum…
1
5
20
isn't -fdump-lang-class good enough to associate vtable offsets with methods?
1
no, it can show you vtables but not where are their methods called from
1
Replying to @real_redp
i see, for call sites i'd look at gimple instead, IMHO it's easier to find and analyze those GIMPLE_CALLs to vmethods (OBJ_TYPE_REF models the target of the call).

Jul 31, 2023 · 8:37 AM UTC

1
Replying to @paxteam
you cannot be sure that code at GIMPLE stage will be places in real native code. this is general compilers problem, llvm has it too - see for example blog.trailofbits.com/2023/07… from OBJ_TYPE_REF you can extract types of object and called method but not name of method
1
why does DCE matter? you can just discard the information you don't need? as for the method name, you can extract the base class info from the 'this' arg type then parsing TYPE_BINFO/BINFO_VIRTUALS/etc will get you method names.
1