bpf2go: add compdb export#1987
Draft
stepbrobd wants to merge 5 commits into
Draft
Conversation
Signed-off-by: Yifei Sun <ysun@hey.com>
Signed-off-by: Yifei Sun <ysun@hey.com>
Contributor
|
Hi, could you elaborate on the issue with |
Author
|
for example a specific version of vmlinux headers, or libbpf and xdp headers that look like this
if i edit the files directly with nvim, clangd can't find the symbols and just generating massive list of errors, and this compdb change basically will create compile_commands.json entries at user specified location on for example (i copied from my source and i'm still working on the upstream patch, the final outcome will be more like package probe
//go:generate go tool bpfgen --ident rfm --output-dir . --pkg-config libbpf --compdb ../compile_commands.json ../bpf/rfm_tc.c$ cat compile_commands.json
[
{
"directory": "/home/ysun/Workspace/rfm/bpf",
"file": "/home/ysun/Workspace/rfm/bpf/rfm_tc.c",
"arguments": [
"clang",
"--target=bpf",
"-O2",
"-g",
"-Wall",
"-Wno-missing-declarations",
"-I/home/ysun/Workspace/rfm/bpf/include",
"-I/home/ysun/Workspace/rfm/bpf/include/vmlinux/x86",
"-D__TARGET_ARCH_x86",
"-I/nix/store/0y6byys2fd1xzq66vld217g7y69kvqa1-libbpf-1.6.3/include",
"-c",
"/home/ysun/Workspace/rfm/bpf/rfm_tc.c"
]
}
] |
Signed-off-by: Yifei Sun <ysun@hey.com>
Signed-off-by: Yifei Sun <ysun@hey.com>
Signed-off-by: Yifei Sun <ysun@hey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i was trying to use bpf2go in my project where the dev is happening in a nixos machine
the library paths are at non-conventional locations and my editor/lsp wasn't able to find them and not really providing useful suggestions
i temporarily worked around this by adding a similar compdb wrapper around bpf2go (https://github.com/stepbrobd/rfm/blob/3c86b1ec512c83f46f7d7ad7ee88fa1f64efce44/cmd/bpfgen/main.go#L31) to generate compile_commands.json in the project root and i think this could be useful to someone else