diff --git a/agent/src/config/config.rs b/agent/src/config/config.rs index dcec6e675fc..10f11cba2b4 100644 --- a/agent/src/config/config.rs +++ b/agent/src/config/config.rs @@ -5276,7 +5276,7 @@ header_fields_flag: "invalid" } #[test] - fn parse_process_matcher() { + fn parse_proc_config() { let yaml = r#" process_matcher: - match_regex: python[2|3].* (.*)\.py @@ -5288,7 +5288,15 @@ process_matcher: ignore: false enabled_features: [ebpf.socket.uprobe.golang, ebpf.profile.on_cpu] "#; - let _proc: Proc = serde_yaml::from_str(yaml).unwrap(); + + let default_matcher_yaml = r#" +enabled: true +"#; + let proc: Proc = serde_yaml::from_str(default_matcher_yaml).unwrap(); + assert_eq!( + proc.process_matcher.get(0), + Some(&ProcessMatcher::default()) + ); } } diff --git a/agent/src/ebpf/user/profile/stringifier.c b/agent/src/ebpf/user/profile/stringifier.c index 0be64ca385d..88d5e28dd6a 100644 --- a/agent/src/ebpf/user/profile/stringifier.c +++ b/agent/src/ebpf/user/profile/stringifier.c @@ -757,7 +757,7 @@ char *resolve_and_gen_stack_trace_str(struct bpf_tracer *t, len += strlen(uprobe_str) + 1; } - if (v->intpstack >= 0) { + if (v->intpstack != 0) { i_trace_str = folded_stack_trace_string(t, v->intpstack, v->tgid, custom_stack_map_name, h, new_cache, info_p, v->timestamp, ignore_libs, true); if (i_trace_str != NULL) { len += strlen(i_trace_str) + strlen(INCOMPLETE_PYTHON_STACK) + 2; diff --git a/agent/src/ebpf/user/table.c b/agent/src/ebpf/user/table.c index 5296a8bd635..0f9ac37a81f 100644 --- a/agent/src/ebpf/user/table.c +++ b/agent/src/ebpf/user/table.c @@ -143,7 +143,7 @@ void insert_prog_to_map(struct bpf_tracer *tracer, const char *map_name, map_name, key, prog_name); } -int bpf_table_fd(struct bpf_tracer *tracer, const char *tb_name) +int bpf_table_get_fd(struct bpf_tracer *tracer, const char *tb_name) { struct ebpf_map *map = ebpf_obj__get_map_by_name(tracer->obj, tb_name); if (map == NULL) { diff --git a/agent/src/ebpf/user/table.h b/agent/src/ebpf/user/table.h index 16bb66ead3d..07e95c10879 100644 --- a/agent/src/ebpf/user/table.h +++ b/agent/src/ebpf/user/table.h @@ -35,5 +35,5 @@ bool bpf_table_delete_key(struct bpf_tracer * tracer, void insert_prog_to_map(struct bpf_tracer *tracer, const char *map_name, const char *prog_name, int key); -int bpf_table_fd(struct bpf_tracer *tracer, const char *tb_name); +int bpf_table_get_fd(struct bpf_tracer *tracer, const char *tb_name); #endif /* DF_BPF_TABLE_H */ diff --git a/agent/src/ebpf/user/unwind_tracer.c b/agent/src/ebpf/user/unwind_tracer.c index 214d9afd053..6b3a14c029a 100644 --- a/agent/src/ebpf/user/unwind_tracer.c +++ b/agent/src/ebpf/user/unwind_tracer.c @@ -202,8 +202,8 @@ int unwind_tracer_init(struct bpf_tracer *tracer) { ebpf_warning("unwinder may not handle in kernel perf events correctly"); } - int process_map_fd = bpf_table_fd(tracer, MAP_PROCESS_SHARD_LIST_NAME); - int shard_map_fd = bpf_table_fd(tracer, MAP_UNWIND_ENTRY_SHARD_NAME); + int process_map_fd = bpf_table_get_fd(tracer, MAP_PROCESS_SHARD_LIST_NAME); + int shard_map_fd = bpf_table_get_fd(tracer, MAP_UNWIND_ENTRY_SHARD_NAME); if (process_map_fd < 0) { ebpf_warning("create unwind table failed: map %s not found", MAP_PROCESS_SHARD_LIST_NAME); return -1; @@ -218,8 +218,8 @@ int unwind_tracer_init(struct bpf_tracer *tracer) { g_unwind_table = table; pthread_mutex_unlock(&g_unwind_table_lock); - int unwind_info_map_fd = bpf_table_fd(tracer, MAP_PYTHON_UNWIND_INFO_NAME); - int offsets_map_fd = bpf_table_fd(tracer, MAP_PYTHON_OFFSETS_NAME); + int unwind_info_map_fd = bpf_table_get_fd(tracer, MAP_PYTHON_UNWIND_INFO_NAME); + int offsets_map_fd = bpf_table_get_fd(tracer, MAP_PYTHON_OFFSETS_NAME); if (unwind_info_map_fd < 0 || offsets_map_fd < 0) { ebpf_warning("Failed to get unwind info map fd or offsets map fd\n"); return -1;