tools/perf/util/llvm-c-helpers.h
Source file repositories/reference/linux-study-clean/tools/perf/util/llvm-c-helpers.h
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/llvm-c-helpers.h- Extension
.h- Size
- 1959 bytes
- Lines
- 61
- 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/compiler.h
Detected Declarations
struct dsostruct llvm_a2l_frame
Annotated Snippet
struct llvm_a2l_frame {
char* filename;
char* funcname;
unsigned int line;
};
/*
* Implement addr2line() using libLLVM. LLVM is a C++ API, and
* many of the linux/ headers cannot be included in a C++ compile unit,
* so we need to make a little bridge code here. llvm_addr2line() will
* convert the inline frame information from LLVM's internal structures
* and put them into a flat array given in inline_frames. The caller
* is then responsible for taking that array and convert it into perf's
* regular inline frame structures (which depend on e.g. struct list_head).
*
* If the address could not be resolved, or an error occurred (e.g. OOM),
* returns 0. Otherwise, returns the number of inline frames (which means 1
* if the address was not part of an inlined function). If unwind_inlines
* is set and the return code is nonzero, inline_frames will be set to
* a newly allocated array with that length. The caller is then responsible
* for freeing both the strings and the array itself.
*/
int llvm_addr2line(const char* dso_name,
u64 addr,
char** file,
unsigned int* line,
bool unwind_inlines,
struct llvm_a2l_frame** inline_frames);
/*
* Simple symbolizers for addresses; will convert something like
* 0x12345 to "func+0x123". Will return NULL if no symbol was found.
*
* The returned value must be freed by the caller, with free().
*/
char *llvm_name_for_code(struct dso *dso, const char *dso_name, u64 addr);
char *llvm_name_for_data(struct dso *dso, const char *dso_name, u64 addr);
#ifdef __cplusplus
}
#endif
#endif /* __PERF_LLVM_C_HELPERS */
Annotation
- Immediate include surface: `linux/compiler.h`.
- Detected declarations: `struct dso`, `struct llvm_a2l_frame`.
- 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.