[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191015204407.GA16674@krava>
Date: Tue, 15 Oct 2019 22:44:07 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Andrii Nakryiko <andriin@...com>, Yonghong Song <yhs@...com>,
Martin KaFai Lau <kafai@...com>, Daniel Xu <dxu@...uu.xyz>
Subject: Re: [RFC] libbpf: Allow to emit all dependent definitions
On Tue, Oct 15, 2019 at 09:22:35AM -0700, Andrii Nakryiko wrote:
> On Tue, Oct 15, 2019 at 6:03 AM Jiri Olsa <jolsa@...nel.org> wrote:
> >
> > Currently the bpf dumper does not emit definitions
> > of pointers to structs. It only emits forward type
> > declarations.
> >
> > Having 2 structs like:
> >
> > struct B {
> > int b;
> > };
> >
> > struct A {
> > struct B *ptr;
> > };
> >
> > the call to btf_dump__dump_type(id = struct A) dumps:
> >
> > struct B;
> > struct A {
> > struct B *ptr;
> > };
> >
> > It'd ease up bpftrace code if we could dump definitions
> > of all dependent types, like:
> >
> > struct B {
> > int b;
> > };
> > struct A {
> > struct B *ptr;
> > };
> >
> > So we could dereference all the pointers easily, instead
> > of searching for each access member's type and dumping it
> > separately.
> >
> > Adding struct btf_dump_opts::emit_all to do that.
> >
>
> Hey Jiri,
>
> Yeah, Daniel Xu mentioned that this would be useful. I haven't thought
> this through very well yet, but I suspect that this simple change
> might not be enough to make this work. There are cases where you are
> not yet allowed to emit definition and have to emit
> forward-declaration first. I suggest trying to use this on vmlinux BTF
> and see if resulting header files still compiles with both Clang and
> GCC. Do you mind checking?
agh right, my test fails for vmlinux BTF
>
> But also, as we learned over last few months, just adding extra field
> to an opts struct is not backwards-compatible, so we'll need to add
> new API and follow the pattern that we used for
> bpf_object__open_{file,mem).
will check, thanks
jirka
Powered by blists - more mailing lists