From f0ed59d3ece5569d63560daac3644b1ed3170600 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Thu, 26 Apr 2018 09:01:17 -0700 Subject: [PATCH] document debug flags --- docs/reference_guide.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/reference_guide.md b/docs/reference_guide.md index e248546aa537..e24ac8a1fde5 100644 --- a/docs/reference_guide.md +++ b/docs/reference_guide.md @@ -758,10 +758,21 @@ Constructors. ### 1. BPF -Syntax: ```BPF({text=BPF_program | src_file=filename} [, usdt_contexts=[USDT_object, ...]] [, cflags=[arg1, ...]])``` +Syntax: ```BPF({text=BPF_program | src_file=filename} [, usdt_contexts=[USDT_object, ...]] [, cflags=[arg1, ...]] [, debug=int])``` Creates a BPF object. This is the main object for defining a BPF program, and interacting with its output. +Exactly one of `text` or `src_file` must be supplied (not both). + +The `cflags` specifies additional arguments to be passed to the compiler, for example `-DMACRO_NAME=value` or `-I/include/path`. The arguments are passed as an array, with each element being an additional argument. Note that strings are not split on whitespace, so each argument must be a different element of the array, e.g. `["-include", "header.h"]`. + +The `debug` flags control debug output, and can be or'ed together: +- `DEBUG_LLVM_IR = 0x1` compiled LLVM IR +- `DEBUG_BPF = 0x2` loaded BPF bytecode and register state on branches +- `DEBUG_PREPROCESSOR = 0x4` pre-processor result +- `DEBUG_SOURCE = 0x8` ASM instructions embedded with source +- `DEBUG_BPF_REGISTER_STATE = 0x10` register state on all instructions in addition to DEBUG_BPF + Examples: ```Python