|
@@ -163,7 +163,7 @@ static struct map *kernel_get_module_map(const char *module)
|
|
|
|
|
|
/* A file path -- this is an offline module */
|
|
/* A file path -- this is an offline module */
|
|
if (module && strchr(module, '/'))
|
|
if (module && strchr(module, '/'))
|
|
- return machine__findnew_module_map(host_machine, 0, module);
|
|
|
|
|
|
+ return dso__new_map(module);
|
|
|
|
|
|
if (!module)
|
|
if (!module)
|
|
module = "kernel";
|
|
module = "kernel";
|
|
@@ -173,6 +173,7 @@ static struct map *kernel_get_module_map(const char *module)
|
|
if (strncmp(pos->dso->short_name + 1, module,
|
|
if (strncmp(pos->dso->short_name + 1, module,
|
|
pos->dso->short_name_len - 2) == 0 &&
|
|
pos->dso->short_name_len - 2) == 0 &&
|
|
module[pos->dso->short_name_len - 2] == '\0') {
|
|
module[pos->dso->short_name_len - 2] == '\0') {
|
|
|
|
+ map__get(pos);
|
|
return pos;
|
|
return pos;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -188,15 +189,6 @@ struct map *get_target_map(const char *target, bool user)
|
|
return kernel_get_module_map(target);
|
|
return kernel_get_module_map(target);
|
|
}
|
|
}
|
|
|
|
|
|
-static void put_target_map(struct map *map, bool user)
|
|
|
|
-{
|
|
|
|
- if (map && user) {
|
|
|
|
- /* Only the user map needs to be released */
|
|
|
|
- map__put(map);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
static int convert_exec_to_group(const char *exec, char **result)
|
|
static int convert_exec_to_group(const char *exec, char **result)
|
|
{
|
|
{
|
|
char *ptr1, *ptr2, *exec_copy;
|
|
char *ptr1, *ptr2, *exec_copy;
|
|
@@ -412,7 +404,7 @@ static int find_alternative_probe_point(struct debuginfo *dinfo,
|
|
}
|
|
}
|
|
|
|
|
|
out:
|
|
out:
|
|
- put_target_map(map, uprobes);
|
|
|
|
|
|
+ map__put(map);
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -2869,7 +2861,7 @@ static int find_probe_trace_events_from_map(struct perf_probe_event *pev,
|
|
}
|
|
}
|
|
|
|
|
|
out:
|
|
out:
|
|
- put_target_map(map, pev->uprobes);
|
|
|
|
|
|
+ map__put(map);
|
|
free(syms);
|
|
free(syms);
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
@@ -3362,10 +3354,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
/* Get a symbol map */
|
|
/* Get a symbol map */
|
|
- if (user)
|
|
|
|
- map = dso__new_map(target);
|
|
|
|
- else
|
|
|
|
- map = kernel_get_module_map(target);
|
|
|
|
|
|
+ map = get_target_map(target, user);
|
|
if (!map) {
|
|
if (!map) {
|
|
pr_err("Failed to get a map for %s\n", (target) ? : "kernel");
|
|
pr_err("Failed to get a map for %s\n", (target) ? : "kernel");
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
@@ -3397,9 +3386,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
|
|
}
|
|
}
|
|
|
|
|
|
end:
|
|
end:
|
|
- if (user) {
|
|
|
|
- map__put(map);
|
|
|
|
- }
|
|
|
|
|
|
+ map__put(map);
|
|
exit_probe_symbol_maps();
|
|
exit_probe_symbol_maps();
|
|
|
|
|
|
return ret;
|
|
return ret;
|