MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / find_debug_file

Function find_debug_file

src/executor/helpers/debug_file.rs:14–26  ·  view source on GitHub ↗

Search for a separate debug info file, in GDB's order (see [Separate Debug Files]): build-id path first, then `.gnu_debuglink` with CRC32 validation. Build-id wins because it hashes the binary contents, so a match cannot be a false positive, while `.gnu_debuglink` only matches by filename. The searched roots are where Debian/Ubuntu `*-dbg`/`*-dbgsym` packages and NixOS `environment.enableDebugInf

(object: &object::File, binary_path: &Path)

Source from the content-addressed store, hash-verified

12///
13/// [Separate Debug Files]: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html
14pub fn find_debug_file(object: &object::File, binary_path: &Path) -> Option<PathBuf> {
15 let via_known_roots = ["/usr/lib/debug", "/run/current-system/sw/lib/debug"]
16 .iter()
17 .map(Path::new)
18 .filter(|dir| dir.exists())
19 .find_map(|dir| find_debug_file_in(object, binary_path, dir));
20
21 // `.gnu_debuglink` beside the binary (and its `.debug` subdirectory) is part of
22 // GDB's search order regardless of whether a global debug-directory root exists
23 // (see module docs), so it must not be skipped on systems without one, e.g. most
24 // CI runners.
25 via_known_roots.or_else(|| find_debug_file_by_debuglink(object, binary_path, None))
26}
27
28fn find_debug_file_in(
29 object: &object::File,

Callers 3

has_debug_symbolsFunction · 0.85
from_symbolsMethod · 0.85
from_objectMethod · 0.85

Calls 2

find_debug_file_inFunction · 0.85

Tested by

no test coverage detected