static const struct argp_option opts[] = {
{ "shared", 's', "PATH", 0, "the location of libreadline.so library" },
+ { "verbose", 'v', NULL, 0, "Verbose debug output" },
{ NULL, 'h', NULL, OPTION_HIDDEN, "Show the full help" },
{},
};
static char *libreadline_path = NULL;
+static bool verbose = false;
static error_t parse_arg(int key, char *arg, struct argp_state *state)
{
if (libreadline_path == NULL)
return ARGP_ERR_UNKNOWN;
break;
+ case 'v':
+ verbose = true;
+ break;
case 'h':
argp_state_help(state, stderr, ARGP_HELP_STD_HELP);
break;
return 0;
}
+static int libbpf_print_fn(enum libbpf_print_level level, const char *format, va_list args)
+{
+ if (level == LIBBPF_DEBUG && !verbose)
+ return 0;
+ return vfprintf(stderr, format, args);
+}
+
static void handle_event(void *ctx, int cpu, void *data, __u32 data_size)
{
struct str_t *e = data;
}
libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
+ libbpf_set_print(libbpf_print_fn);
obj = bashreadline_bpf__open_and_load();
if (!obj) {