scripts/gendwarfksyms/gendwarfksyms.h
Source file repositories/reference/linux-study-clean/scripts/gendwarfksyms/gendwarfksyms.h
File Facts
- System
- Linux kernel
- Corpus path
scripts/gendwarfksyms/gendwarfksyms.h- Extension
.h- Size
- 7161 bytes
- Lines
- 291
- Domain
- Support Tooling And Documentation
- Bucket
- scripts
- 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
dwarf.helfutils/libdw.helfutils/libdwfl.hstdlib.hstdio.hhash.hhashtable.hxalloc.h
Detected Declarations
struct symbol_addrstruct symbolstruct die_fragmentstruct diestruct cachestruct expansion_statestruct kabi_statestruct stateenum symbol_stateenum die_stateenum die_fragment_typefunction addr_hashfunction cache_mark_expandedfunction cache_was_expanded
Annotated Snippet
struct symbol_addr {
uint32_t section;
Elf64_Addr address;
};
struct symbol {
const char *name;
struct symbol_addr addr;
struct hlist_node addr_hash;
struct hlist_node name_hash;
enum symbol_state state;
uintptr_t die_addr;
uintptr_t ptr_die_addr;
unsigned long crc;
};
typedef void (*symbol_callback_t)(struct symbol *, void *arg);
bool is_symbol_ptr(const char *name);
int symbol_read_exports(FILE *file);
void symbol_read_symtab(int fd);
struct symbol *symbol_get(const char *name);
void symbol_set_ptr(struct symbol *sym, Dwarf_Die *ptr);
void symbol_set_die(struct symbol *sym, Dwarf_Die *die);
void symbol_set_crc(struct symbol *sym, unsigned long crc);
void symbol_for_each(symbol_callback_t func, void *arg);
void symbol_print_versions(void);
void symbol_free(void);
/*
* die.c
*/
enum die_state {
DIE_INCOMPLETE,
DIE_FQN,
DIE_UNEXPANDED,
DIE_COMPLETE,
DIE_SYMBOL,
DIE_LAST = DIE_SYMBOL
};
enum die_fragment_type {
FRAGMENT_EMPTY,
FRAGMENT_STRING,
FRAGMENT_LINEBREAK,
FRAGMENT_DIE
};
struct die_fragment {
enum die_fragment_type type;
union {
char *str;
int linebreak;
uintptr_t addr;
} data;
struct list_head list;
};
#define CASE_CONST_TO_STR(name) \
case name: \
return #name;
static inline const char *die_state_name(enum die_state state)
{
switch (state) {
CASE_CONST_TO_STR(DIE_INCOMPLETE)
CASE_CONST_TO_STR(DIE_FQN)
CASE_CONST_TO_STR(DIE_UNEXPANDED)
CASE_CONST_TO_STR(DIE_COMPLETE)
CASE_CONST_TO_STR(DIE_SYMBOL)
}
error("unexpected die_state: %d", state);
}
struct die {
enum die_state state;
bool mapped;
char *fqn;
int tag;
uintptr_t addr;
struct list_head fragments;
struct hlist_node hash;
};
typedef void (*die_map_callback_t)(struct die *, void *arg);
int __die_map_get(uintptr_t addr, enum die_state state, struct die **res);
struct die *die_map_get(Dwarf_Die *die, enum die_state state);
Annotation
- Immediate include surface: `dwarf.h`, `elfutils/libdw.h`, `elfutils/libdwfl.h`, `stdlib.h`, `stdio.h`, `hash.h`, `hashtable.h`, `xalloc.h`.
- Detected declarations: `struct symbol_addr`, `struct symbol`, `struct die_fragment`, `struct die`, `struct cache`, `struct expansion_state`, `struct kabi_state`, `struct state`, `enum symbol_state`, `enum die_state`.
- Atlas domain: Support Tooling And Documentation / scripts.
- 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.