Re: [PATCH v5 0/3] Use BTF to trim return values

From: Donglin Peng

Date: Thu Sep 03 2026 - 12:28:52 EST


On Wed, Sep 2, 2026 at 10:55 PM Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
>
> On Wed, 2 Sep 2026 11:25:29 +0800
> Peng Donglin <dolinux.peng@xxxxxxxxx> wrote:
>
> > >> - Do not print a return value for functions with a void return type.
> > >> - Trim integer, enum, struct, and union values to the available return
> > >> value width when the BTF type provides suitable size information.
> > >> - Format integer, enum, and boolean values according to their BTF
> > >> encoding.
> > >> - Mark values as "(trunc)" when the return type is wider than the
> > >> value captured by the function graph tracer.
> > >
> > > Hmm, I really don't like the "(trunc)" If it's the real return type, then
> > > it should just print what the real size is. No need to state it was truncated.
> >
> > Thanks, I agree. We can remove the "(trunc)" suffix and print the actual
> > type information instead, for example:
> >
> > ret=0x5[struct:0x10]
> >
> > This would indicate that the return type is a struct with a size of 0x10
> > bytes.
>
> Hmm, shouldn't both the actually applied size and the true size be displayed?
> e.g.
>
> ret=0x5 (in 8 bytes, true size: 16 bytes)

Thanks, this is a good suggestion. To keep the trace concise, would this work?

ret=0x5 (8/16B)

The suffix shows captured size and true BTF size, only when they differ.
WDYT?

>
> Thank you,
>
> >
> > Would this be acceptable?
> >
> > >
>
> --
> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>