Commit 54afd828 authored by Alastair Robertson's avatar Alastair Robertson

Link to libbcc

parent 290333bc
......@@ -34,3 +34,14 @@ add_executable(bpftrace main.cpp driver.cpp parser.tab.cc lex.yy.cc ast.cpp prin
llvm_map_components_to_libnames(llvm_libs irreader bpfcodegen mcjit)
target_link_libraries(bpftrace ${llvm_libs})
include(ExternalProject)
ExternalProject_Add(bcc
GIT_REPOSITORY https://github.com/iovisor/bcc
STEP_TARGETS build
EXCLUDE_FROM_ALL 1
)
add_dependencies(bpftrace bcc-build)
ExternalProject_Get_Property(bcc source_dir binary_dir)
include_directories(${source_dir}/src/cc)
target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc.so)
#include <unistd.h>
#include "map.h"
#include "libbpf.h"
namespace ebpf {
namespace bpftrace {
int Map::n = 0;
Map::Map() {
// TODO create map here
mapfd_ = n++;
mapfd_ = bpf_create_map(BPF_MAP_TYPE_HASH, 8, 8, 128, 0);
// TODO check mapfd_ != -1
}
Map::~Map() {
......
......@@ -12,7 +12,6 @@ public:
~Map();
int mapfd_;
static int n;
};
} // namespace bpftrace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment