tools/perf/util/debuginfo.c
Source file repositories/reference/linux-study-clean/tools/perf/util/debuginfo.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/debuginfo.c- Extension
.c- Size
- 4738 bytes
- Lines
- 213
- 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
errno.hfcntl.hstdio.hstdlib.hstring.hunistd.hlinux/zalloc.hbuild-id.hdso.hdebug.hdebuginfo.hsymbol.helfutils/debuginfod.h
Detected Declarations
function debuginfo__init_offline_dwarffunction debuginfo__deletefunction debuginfo__get_text_offsetfunction get_source_from_debuginfod
Annotated Snippet
if (strcmp(p, ".text") == 0) {
/* OK, get the section header */
scn = elf_getscn(elf, shndx);
if (!scn)
return -ENOENT;
shdr = gelf_getshdr(scn, &mem);
if (!shdr)
return -ENOENT;
*offs = shdr->sh_addr;
if (adjust_offset)
*offs -= shdr->sh_offset;
}
}
return 0;
}
#ifdef HAVE_DEBUGINFOD_SUPPORT
int get_source_from_debuginfod(const char *raw_path,
const char *sbuild_id, char **new_path)
{
debuginfod_client *c = debuginfod_begin();
const char *p = raw_path;
int fd;
if (!c)
return -ENOMEM;
fd = debuginfod_find_source(c, (const unsigned char *)sbuild_id,
0, p, new_path);
pr_debug("Search %s from debuginfod -> %d\n", p, fd);
if (fd >= 0)
close(fd);
debuginfod_end(c);
if (fd < 0) {
pr_debug("Failed to find %s in debuginfod (%s)\n",
raw_path, sbuild_id);
return -ENOENT;
}
pr_debug("Got a source %s\n", *new_path);
return 0;
}
#endif /* HAVE_DEBUGINFOD_SUPPORT */
Annotation
- Immediate include surface: `errno.h`, `fcntl.h`, `stdio.h`, `stdlib.h`, `string.h`, `unistd.h`, `linux/zalloc.h`, `build-id.h`.
- Detected declarations: `function debuginfo__init_offline_dwarf`, `function debuginfo__delete`, `function debuginfo__get_text_offset`, `function get_source_from_debuginfod`.
- 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.