Skip to content

Commit

Permalink
Move BCC debug options to an installed header file
Browse files Browse the repository at this point in the history
  • Loading branch information
palmtenor committed Nov 9, 2017
1 parent 94d15bc commit 73e2f2d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
15 changes: 15 additions & 0 deletions src/cc/bpf_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ class Type;
}

namespace ebpf {

// Options to enable different debug logging.
enum {
// Debug output compiled LLVM IR.
DEBUG_LLVM_IR = 0x1,
// Debug output loaded BPF bytecode and register state on branches.
DEBUG_BPF = 0x2,
// Debug output pre-processor result.
DEBUG_PREPROCESSOR = 0x4,
// Debug output ASM instructions embedded with source.
DEBUG_SOURCE = 0x8,
// Debug output register state on all instructions in addition to DEBUG_BPF.
DEBUG_BPF_REGISTER_STATE = 0x10,
};

class TableDesc;
class TableStorage;
class BLoader;
Expand Down
14 changes: 0 additions & 14 deletions src/cc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@

namespace ebpf {

// debug flags
enum {
// Debug output compiled LLVM IR.
DEBUG_LLVM_IR = 0x1,
// Debug output loaded BPF bytecode and register state on branches.
DEBUG_BPF = 0x2,
// Debug output pre-processor result.
DEBUG_PREPROCESSOR = 0x4,
// Debug output ASM instructions embedded with source.
DEBUG_SOURCE = 0x8,
// Debug output register state on all instructions in addition to DEBUG_BPF.
DEBUG_BPF_REGISTER_STATE = 0x16,
};

template <class T, class... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(Args &&... args) {
Expand Down
3 changes: 2 additions & 1 deletion src/cc/frontends/clang/b_frontend_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include <clang/Rewrite/Core/Rewriter.h>

#include "b_frontend_action.h"
#include "loader.h"
#include "bpf_module.h"
#include "common.h"
#include "loader.h"
#include "table_storage.h"

#include "libbpf.h"
Expand Down
2 changes: 1 addition & 1 deletion src/cc/frontends/clang/loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

#include <llvm/IR/Module.h>

#include "common.h"
#include "bcc_exception.h"
#include "bpf_module.h"
#include "exported_files.h"
#include "kbuild_helper.h"
#include "b_frontend_action.h"
Expand Down
2 changes: 1 addition & 1 deletion src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _get_num_open_probes():
# Debug output ASM instructions embedded with source.
DEBUG_SOURCE = 0x8
#Debug output register state on all instructions in addition to DEBUG_BPF.
DEBUG_BPF_REGISTER_STATE = 0x16
DEBUG_BPF_REGISTER_STATE = 0x10

class SymbolCache(object):
def __init__(self, pid):
Expand Down

0 comments on commit 73e2f2d

Please sign in to comment.