mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 01:51:34 +00:00
701677b957
addr2line may fail to send expected values causing perf to wait indefinitely. Add a 1 second timeout (twice the timeout for reading from /proc/pid/maps) so that such reads don't cause perf to appear to lock up. There are already checks that the file for addr2line contains a debug section but this isn't always sufficient. The problem was observed when a valid elf file would set the configuration for binutils addr2line, then a later read of vmlinux with ELF debug sections would cause a failing write/read which would block indefinitely. As a service to future readers, if the io hits eof or an error, cleanup the addr2line process. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Yang Jihong <yangjihong1@huawei.com> Link: https://lore.kernel.org/r/20230608061812.3715566-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
59 lines
1.9 KiB
C
59 lines
1.9 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef PERF_SRCLINE_H
|
|
#define PERF_SRCLINE_H
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/types.h>
|
|
|
|
struct dso;
|
|
struct symbol;
|
|
|
|
extern int addr2line_timeout_ms;
|
|
extern bool srcline_full_filename;
|
|
char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
|
|
bool show_sym, bool show_addr, u64 ip);
|
|
char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym,
|
|
bool show_sym, bool show_addr, bool unwind_inlines,
|
|
u64 ip);
|
|
void zfree_srcline(char **srcline);
|
|
char *get_srcline_split(struct dso *dso, u64 addr, unsigned *line);
|
|
|
|
/* insert the srcline into the DSO, which will take ownership */
|
|
void srcline__tree_insert(struct rb_root_cached *tree, u64 addr, char *srcline);
|
|
/* find previously inserted srcline */
|
|
char *srcline__tree_find(struct rb_root_cached *tree, u64 addr);
|
|
/* delete all srclines within the tree */
|
|
void srcline__tree_delete(struct rb_root_cached *tree);
|
|
|
|
extern char *srcline__unknown;
|
|
#define SRCLINE_UNKNOWN srcline__unknown
|
|
|
|
struct inline_list {
|
|
struct symbol *symbol;
|
|
char *srcline;
|
|
struct list_head list;
|
|
};
|
|
|
|
struct inline_node {
|
|
u64 addr;
|
|
struct list_head val;
|
|
struct rb_node rb_node;
|
|
};
|
|
|
|
/* parse inlined frames for the given address */
|
|
struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr,
|
|
struct symbol *sym);
|
|
/* free resources associated to the inline node list */
|
|
void inline_node__delete(struct inline_node *node);
|
|
|
|
/* insert the inline node list into the DSO, which will take ownership */
|
|
void inlines__tree_insert(struct rb_root_cached *tree,
|
|
struct inline_node *inlines);
|
|
/* find previously inserted inline node list */
|
|
struct inline_node *inlines__tree_find(struct rb_root_cached *tree, u64 addr);
|
|
/* delete all nodes within the tree of inline_node s */
|
|
void inlines__tree_delete(struct rb_root_cached *tree);
|
|
|
|
#endif /* PERF_SRCLINE_H */
|