ease debugging - print pinned bpf prog & map ids am: af617ca0aa
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/bpf/+/18574602 Change-Id: I55e7a90f9bd5825f6252674b09ee03d3553f6505 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
42aba801c2
1 changed files with 20 additions and 2 deletions
|
@ -30,9 +30,9 @@
|
|||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// This is BpfLoader v0.13
|
||||
// This is BpfLoader v0.14
|
||||
#define BPFLOADER_VERSION_MAJOR 0u
|
||||
#define BPFLOADER_VERSION_MINOR 13u
|
||||
#define BPFLOADER_VERSION_MINOR 14u
|
||||
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
|
||||
|
||||
#include "bpf/BpfUtils.h"
|
||||
|
@ -713,6 +713,15 @@ static int createMaps(const char* elfPath, ifstream& elfFile, vector<unique_fd>&
|
|||
if (ret) return -errno;
|
||||
}
|
||||
|
||||
struct bpf_map_info map_info = {};
|
||||
__u32 map_info_len = sizeof(map_info);
|
||||
int rv = bpf_obj_get_info_by_fd(fd, &map_info, &map_info_len);
|
||||
if (rv) {
|
||||
ALOGE("bpf_obj_get_info_by_fd failed, ret: %d [%d]\n", rv, errno);
|
||||
} else {
|
||||
ALOGI("map %s id %d\n", mapPinLoc.c_str(), map_info.id);
|
||||
}
|
||||
|
||||
mapFds.push_back(std::move(fd));
|
||||
}
|
||||
|
||||
|
@ -890,6 +899,15 @@ static int loadCodeSections(const char* elfPath, vector<codeSection>& cs, const
|
|||
}
|
||||
}
|
||||
|
||||
struct bpf_prog_info prog_info = {};
|
||||
__u32 prog_info_len = sizeof(prog_info);
|
||||
int rv = bpf_obj_get_info_by_fd(fd, &prog_info, &prog_info_len);
|
||||
if (rv) {
|
||||
ALOGE("bpf_obj_get_info_by_fd failed, ret: %d [%d]\n", rv, errno);
|
||||
} else {
|
||||
ALOGI("prog %s id %d\n", progPinLoc.c_str(), prog_info.id);
|
||||
}
|
||||
|
||||
cs[i].prog_fd.reset(fd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue