tools/perf/util/probe-event.c
Source file repositories/reference/linux-study-clean/tools/perf/util/probe-event.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/probe-event.c- Extension
.c- Size
- 90926 bytes
- Lines
- 3845
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
inttypes.hsys/utsname.hsys/types.hsys/stat.hfcntl.herrno.hstdio.hunistd.hstdlib.hstring.hstdarg.hlimits.helf.hbuild-id.hevent.hnamespaces.hstrlist.hstrfilter.hdebug.hdso.hcolor.hmap.hmaps.hmutex.hsymbol.hapi/fs/fs.htrace-event.hprobe-event.hprobe-finder.hprobe-file.hsession.hstring2.h
Detected Declarations
struct kernel_get_module_map_cb_argsstruct kprobe_blacklist_nodefunction e_snprintffunction init_probe_symbol_mapsfunction exit_probe_symbol_mapsfunction kernel_get_symbol_address_by_namefunction kernel_get_module_map_cbfunction convert_exec_to_groupfunction clear_perf_probe_pointfunction clear_probe_trace_eventsfunction kprobe_warn_out_rangefunction kernel_get_module_dsofunction find_alternative_probe_pointfunction get_alternative_probe_eventfunction get_alternative_line_rangefunction debuginfo_cache__exitfunction get_text_start_addressfunction find_perf_probe_point_from_dwarffunction post_process_probe_trace_pointfunction post_process_offline_probe_trace_eventsfunction add_exec_to_probe_trace_eventsfunction post_process_module_probe_trace_eventsfunction post_process_kernel_probe_trace_eventsfunction arch__post_process_probe_trace_eventsfunction try_to_find_probe_trace_eventsfunction __show_one_linefunction _show_one_linefunction sprint_line_descriptionfunction __show_line_rangefunction intlist__for_each_entryfunction show_line_rangefunction show_available_vars_atfunction show_available_varsfunction debuginfo_cache__exitfunction try_to_find_probe_trace_eventsfunction show_line_rangefunction show_available_varsfunction line_range__clearfunction line_range__initfunction parse_line_numfunction is_c_func_namefunction parse_line_range_descfunction parse_perf_probe_event_namefunction parse_perf_probe_pointfunction parse_perf_probe_argfunction parse_perf_probe_commandfunction perf_probe_with_varfunction perf_probe_event_need_dwarf
Annotated Snippet
struct kernel_get_module_map_cb_args {
const char *module;
struct map *result;
};
static int kernel_get_module_map_cb(struct map *map, void *data)
{
struct kernel_get_module_map_cb_args *args = data;
struct dso *dso = map__dso(map);
const char *short_name = dso__short_name(dso);
u16 short_name_len = dso__short_name_len(dso);
if (strncmp(short_name + 1, args->module, short_name_len - 2) == 0 &&
args->module[short_name_len - 2] == '\0') {
args->result = map__get(map);
return 1;
}
return 0;
}
static struct map *kernel_get_module_map(const char *module)
{
struct kernel_get_module_map_cb_args args = {
.module = module,
.result = NULL,
};
/* A file path -- this is an offline module */
if (module && strchr(module, '/'))
return dso__new_map(module);
if (!module) {
struct map *map = machine__kernel_map(host_machine);
return map__get(map);
}
maps__for_each_map(machine__kernel_maps(host_machine), kernel_get_module_map_cb, &args);
return args.result;
}
struct map *get_target_map(const char *target, struct nsinfo *nsi, bool user)
{
/* Init maps of given executable or kernel */
if (user) {
struct map *map;
struct dso *dso;
map = dso__new_map(target);
dso = map ? map__dso(map) : NULL;
if (dso) {
mutex_lock(dso__lock(dso));
dso__set_nsinfo(dso, nsinfo__get(nsi));
mutex_unlock(dso__lock(dso));
}
return map;
} else {
return kernel_get_module_map(target);
}
}
static int convert_exec_to_group(const char *exec, char **result)
{
char *ptr1, *ptr2, *exec_copy;
char buf[64];
int ret;
exec_copy = strdup(exec);
if (!exec_copy)
return -ENOMEM;
ptr1 = (char *)perf_basename(exec_copy);
if (!ptr1) {
ret = -EINVAL;
goto out;
}
for (ptr2 = ptr1; *ptr2 != '\0'; ptr2++) {
if (!isalnum(*ptr2) && *ptr2 != '_') {
*ptr2 = '\0';
break;
}
}
ret = e_snprintf(buf, sizeof(buf), "%s_%s", PERFPROBE_GROUP, ptr1);
if (ret < 0)
goto out;
*result = strdup(buf);
Annotation
- Immediate include surface: `inttypes.h`, `sys/utsname.h`, `sys/types.h`, `sys/stat.h`, `fcntl.h`, `errno.h`, `stdio.h`, `unistd.h`.
- Detected declarations: `struct kernel_get_module_map_cb_args`, `struct kprobe_blacklist_node`, `function e_snprintf`, `function init_probe_symbol_maps`, `function exit_probe_symbol_maps`, `function kernel_get_symbol_address_by_name`, `function kernel_get_module_map_cb`, `function convert_exec_to_group`, `function clear_perf_probe_point`, `function clear_probe_trace_events`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.