On Tue, Sep 04, 2018 at 08:50:07AM -0700, Stephane Eranian wrote: > > > When we get an exact IP (using PEBS) and were sampling a data related > > > event (say L1 misses), we can get the data type from the instruction > > > itself; that is, through DWARF. We _know_ what type (structure::member) > > > is read/written to. > > > I have been asking this from the compiler people for a long time! > I don't think it is there. I'd like each load/store to be annotated > with a data type + offset > within the type. It would allow data type profiling. This would not be > bulletproof though > because of the accessor function problem: > void incr(int *v) { (*v)++; } > struct foo { int a, int b } bar; > incr(&bar.a);
Cute, yes. Also, array accesses are tricky. But I think even with those caveats it would be _very_ useful. > There are concern with the volume of data that this > would generate. But my argument > is that this is just debug binaries, does not make the stripped binary > any bigger. Right; the alternative is that we build an asm interpreter and follow the data types throughout the function, because DWARF can tell us about the types at a number of places, like function call arguments etc.. That is, of course, a terrible lot of work :/