scripts/gendwarfksyms/dwarf.c
Source file repositories/reference/linux-study-clean/scripts/gendwarfksyms/dwarf.c
File Facts
- System
- Linux kernel
- Corpus path
scripts/gendwarfksyms/dwarf.c- Extension
.c- Size
- 30197 bytes
- Lines
- 1186
- 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
assert.hinttypes.hstdarg.hgendwarfksyms.h
Detected Declarations
enum kabi_statusfunction Copyrightfunction process_linebreakfunction get_ref_die_attrfunction match_export_symbolfunction is_definition_privatefunction is_kabi_definitionfunction processfunction process_fmtfunction update_fqnfunction process_fqnfunction process_byte_size_attrfunction match_allfunction process_die_containerfunction process_type_attrfunction process_list_commafunction __process_list_typefunction __process_typefunction process_subrange_typefunction process_array_typefunction __process_subroutine_typefunction process_subroutine_typefunction process_variant_typefunction process_variant_part_typefunction get_kabi_statusfunction check_struct_member_kabi_statusfunction check_union_member_kabi_statusfunction get_union_kabi_statusfunction is_kabi_ignoredfunction ___process_structure_typefunction __process_structure_typefunction process_union_typefunction process_enumerator_typefunction process_enumeration_typefunction process_base_typefunction process_unspecified_typefunction process_cachedfunction list_for_each_entryfunction state_initfunction expansion_state_restorefunction expansion_state_savefunction is_expanded_typefunction process_typefunction process_symbolfunction __process_subprogramfunction process_subprogramfunction __process_variablefunction process_variable
Annotated Snippet
if (match(¤t)) {
/* <0 = error, 0 = continue, >0 = stop */
res = checkp(func(state, cache, ¤t));
if (res)
goto out;
}
res = checkp(dwarf_siblingof(¤t, ¤t));
}
res = 0;
out:
if (state)
state->first_list_item = false;
return res;
}
static int process_type(struct state *state, struct die *parent,
Dwarf_Die *die);
static void process_type_attr(struct state *state, struct die *cache,
Dwarf_Die *die)
{
Dwarf_Die type;
if (get_ref_die_attr(die, DW_AT_type, &type)) {
check(process_type(state, cache, &type));
return;
}
/* Compilers can omit DW_AT_type -- print out 'void' to clarify */
process(cache, "base_type void");
}
static void process_list_comma(struct state *state, struct die *cache)
{
if (state->first_list_item) {
state->first_list_item = false;
} else {
process(cache, " ,");
process_linebreak(cache, 0);
}
}
/* Comma-separated with DW_AT_type */
static void __process_list_type(struct state *state, struct die *cache,
Dwarf_Die *die, const char *type)
{
const char *name = get_name_attr(die);
if (stable) {
if (is_kabi_prefix(name))
name = NULL;
state->kabi.orig_name = NULL;
}
process_list_comma(state, cache);
process(cache, type);
process_type_attr(state, cache, die);
if (stable && state->kabi.orig_name)
name = state->kabi.orig_name;
if (name) {
process(cache, " ");
process(cache, name);
}
process_accessibility_attr(cache, die);
process_bit_size_attr(cache, die);
process_data_bit_offset_attr(cache, die);
process_data_member_location_attr(cache, die);
}
#define DEFINE_PROCESS_LIST_TYPE(type) \
static void process_##type##_type(struct state *state, \
struct die *cache, Dwarf_Die *die) \
{ \
__process_list_type(state, cache, die, #type " "); \
}
DEFINE_PROCESS_LIST_TYPE(formal_parameter)
DEFINE_PROCESS_LIST_TYPE(member)
/* Container types with DW_AT_type */
static void __process_type(struct state *state, struct die *cache,
Dwarf_Die *die, const char *type)
{
process(cache, type);
process_fqn(cache, die);
Annotation
- Immediate include surface: `assert.h`, `inttypes.h`, `stdarg.h`, `gendwarfksyms.h`.
- Detected declarations: `enum kabi_status`, `function Copyright`, `function process_linebreak`, `function get_ref_die_attr`, `function match_export_symbol`, `function is_definition_private`, `function is_kabi_definition`, `function process`, `function process_fmt`, `function update_fqn`.
- 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.