tools/perf/util/symbol.h
Source file repositories/reference/linux-study-clean/tools/perf/util/symbol.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/symbol.h- Extension
.h- Size
- 8832 bytes
- Lines
- 283
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/refcount.hstdbool.hstdint.hlinux/list.hlinux/rbtree.hstdio.herrno.haddr_location.hpath.hsymbol_conf.hspark.hutil.hlibelf.hgelf.helf.h
Detected Declarations
struct dsostruct mapstruct mapsstruct optionstruct build_idstruct symbolstruct strliststruct intliststruct ref_reloc_symstruct perf_envstruct symsrcstruct kcore_extractstruct sdt_noteenum symbol_tag_includefunction symbol__sizefunction __symbol__join_symfs
Annotated Snippet
struct symbol {
struct rb_node rb_node;
/** Range of symbol [start, end). */
u64 start;
u64 end;
/** Length of the string name. */
u16 namelen;
/** ELF symbol type as defined for st_info. E.g STT_OBJECT or STT_FUNC. */
u8 type:4;
/** ELF binding type as defined for st_info. E.g. STB_WEAK or STB_GLOBAL. */
u8 binding:4;
/** Set true for kernel symbols of idle routines. */
u8 idle:1;
/** Resolvable but tools ignore it (e.g. idle routines). */
u8 ignore:1;
/** Symbol for an inlined function. */
u8 inlined:1;
/** Has symbol__annotate2 been performed. */
u8 annotate2:1;
/** Symbol is an alias of an STT_GNU_IFUNC */
u8 ifunc_alias:1;
/** Architecture specific. Unused except on PPC where it holds st_other. */
u8 arch_sym;
/** The name of length namelen associated with the symbol. */
char name[];
};
void symbol__delete(struct symbol *sym);
void symbols__delete(struct rb_root_cached *symbols);
/* symbols__for_each_entry - iterate over symbols (rb_root)
*
* @symbols: the rb_root of symbols
* @pos: the 'struct symbol *' to use as a loop cursor
* @nd: the 'struct rb_node *' to use as a temporary storage
*/
#define symbols__for_each_entry(symbols, pos, nd) \
for (nd = rb_first_cached(symbols); \
nd && (pos = rb_entry(nd, struct symbol, rb_node)); \
nd = rb_next(nd))
static inline size_t symbol__size(const struct symbol *sym)
{
return sym->end - sym->start;
}
struct strlist;
struct intlist;
static inline int __symbol__join_symfs(char *bf, size_t size, const char *path)
{
if (symbol_conf.symfs_layout_flat)
return path__join(bf, size, symbol_conf.symfs, perf_basename(path));
return path__join(bf, size, symbol_conf.symfs, path);
}
#define symbol__join_symfs(bf, path) __symbol__join_symfs(bf, sizeof(bf), path)
extern int vmlinux_path__nr_entries;
extern char **vmlinux_path;
static inline void *symbol__priv(struct symbol *sym)
{
return ((void *)sym) - symbol_conf.priv_size;
}
struct ref_reloc_sym {
const char *name;
u64 addr;
u64 unrelocated_addr;
};
int dso__load(struct dso *dso, struct map *map);
int dso__load_vmlinux(struct dso *dso, struct map *map,
const char *vmlinux, bool vmlinux_allocated);
int dso__load_vmlinux_path(struct dso *dso, struct map *map);
int __dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
bool no_kcore);
int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map);
void dso__insert_symbol(struct dso *dso,
struct symbol *sym);
void dso__delete_symbol(struct dso *dso,
struct symbol *sym);
struct symbol *dso__find_symbol(struct dso *dso, u64 addr);
struct symbol *dso__find_symbol_nocache(struct dso *dso, u64 addr);
struct symbol *dso__next_symbol_by_name(struct dso *dso, size_t *idx);
Annotation
- Immediate include surface: `linux/types.h`, `linux/refcount.h`, `stdbool.h`, `stdint.h`, `linux/list.h`, `linux/rbtree.h`, `stdio.h`, `errno.h`.
- Detected declarations: `struct dso`, `struct map`, `struct maps`, `struct option`, `struct build_id`, `struct symbol`, `struct strlist`, `struct intlist`, `struct ref_reloc_sym`, `struct perf_env`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
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.