tools/perf/util/symbol_fprintf.c
Source file repositories/reference/linux-study-clean/tools/perf/util/symbol_fprintf.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/symbol_fprintf.c- Extension
.c- Size
- 1842 bytes
- Lines
- 74
- 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
elf.hinttypes.hstdio.hdso.hmap.hsymbol.h
Detected Declarations
function symbol__fprintffunction __symbol__fprintf_symname_offsfunction symbol__fprintf_symname_offsfunction __symbol__fprintf_symnamefunction symbol__fprintf_symnamefunction dso__fprintf_symbols_by_name
Annotated Snippet
if (al && print_offsets) {
if (al->addr < sym->end)
offset = al->addr - sym->start;
else
offset = al->addr - map__start(al->map) - sym->start;
length += fprintf(fp, "+0x%lx", offset);
}
return length;
} else if (al && unknown_as_addr)
return fprintf(fp, "[%#" PRIx64 "]", al->addr);
else
return fprintf(fp, "[unknown]");
}
size_t symbol__fprintf_symname_offs(const struct symbol *sym,
const struct addr_location *al,
FILE *fp)
{
return __symbol__fprintf_symname_offs(sym, al, false, true, fp);
}
size_t __symbol__fprintf_symname(const struct symbol *sym,
const struct addr_location *al,
bool unknown_as_addr, FILE *fp)
{
return __symbol__fprintf_symname_offs(sym, al, unknown_as_addr, false, fp);
}
size_t symbol__fprintf_symname(const struct symbol *sym, FILE *fp)
{
return __symbol__fprintf_symname_offs(sym, NULL, false, false, fp);
}
size_t dso__fprintf_symbols_by_name(struct dso *dso,
FILE *fp)
{
size_t ret = 0;
for (size_t i = 0; i < dso__symbol_names_len(dso); i++) {
struct symbol *pos = dso__symbol_names(dso)[i];
ret += fprintf(fp, "%s\n", pos->name);
}
return ret;
}
Annotation
- Immediate include surface: `elf.h`, `inttypes.h`, `stdio.h`, `dso.h`, `map.h`, `symbol.h`.
- Detected declarations: `function symbol__fprintf`, `function __symbol__fprintf_symname_offs`, `function symbol__fprintf_symname_offs`, `function __symbol__fprintf_symname`, `function symbol__fprintf_symname`, `function dso__fprintf_symbols_by_name`.
- 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.