[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciTKe4O-23j10wC8DUbX_cmNewbLwZq99kMh_1ZA+5e0w@mail.gmail.com>
Date: Tue, 24 Oct 2023 22:58:05 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Jason Merrill <jason@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
linux-perf-users@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Stephane Eranian <eranian@...gle.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
linux-toolchains@...r.kernel.org,
linux-trace-devel@...r.kernel.org,
Ben Woodard <woodard@...hat.com>,
Joe Mario <jmario@...hat.com>,
Kees Cook <keescook@...omium.org>,
David Blaikie <blaikie@...gle.com>,
Xu Liu <xliuprof@...gle.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [RFC 00/48] perf tools: Introduce data type profiling (v1)
Hello,
On Tue, Oct 24, 2023 at 8:07 PM Jason Merrill <jason@...hat.com> wrote:
>
> On Thu, Oct 12, 2023 at 12:44 PM Namhyung Kim <namhyung@...nel.org> wrote:
>>
>> On Thu, Oct 12, 2023 at 2:13 AM Peter Zijlstra <peterz@...radead.org> wrote:
>>
>> > > This can generate instructions like below.
>> > >
>> > > ...
>> > > 0x123456: mov 0x18(%rdi), %rcx
>> > > 0x12345a: mov 0x10(%rcx), %rax <=== sample
>> > > 0x12345e: test %rax, %rax
>> > > 0x123461: je <...>
>> > > ...
>> > >
>> > > And imagine we have a sample at 0x12345a. Then it cannot find a
>> > > variable for %rcx since DWARF didn't generate one (it only knows about
>> > > 'bar'). Without compiler support, all it can do is to track the code
>> > > execution in each instruction and propagate the type info in each
>> > > register and stack location by following the memory access.
>> >
>> > Right, this has more or less been the 'excuse' for why doing this has
>> > been 'difficult' for the past 10+ years :/
>>
>> I'm sure I missed some cases, but I managed to make it work on
>> usual cases. We can improve it by handling it more cases and
>> instructions but it'd be great if we have a better support from the
>> toolchains.
>
>
> How helpful would it be for the compiler to generate an unnamed DW_TAG_variable for the temporary in %rcx?
That'd be fantastic, and that's exactly what I'm asking. :)
>
>>
>> > > Actually I found a discussion in the DWARF mailing list to support
>> > > "inverted location lists" and it seems a perfect fit for this project.
>> > > It'd be great if new DWARF would provide a way to lookup variable and
>> > > type info using a concrete location info (like a register number).
>> > >
>> > > https://lists.dwarfstd.org/pipermail/dwarf-discuss/2023-June/002278.html
>> >
>> > Stephane was going to talk to tools people about this over 10 years ago
>> > :-)
>>
>> Hope that they would make some progress.
>
>
> This seems expensive in debug info size for a lookup optimization; better IMO to construct the reverse lookup table from the existing information, as it sounds like you are doing. Though it would be good to cache that table between runs, and ideally share it with other interested tools.
Probably. Then it still needs a standard way to express such data.
Maybe we can have an option to generate the table.
Thanks,
Namhyung
Powered by blists - more mailing lists