Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf symbols: we can now read separate debug-info files based on a build ID

Recent GDB (at least on a vanilla Debian box) looks for debug information in

/usr/lib/debug/.build-id/nn/nnnnnnn

where nn/nnnnnn is the build-id of the stripped ELF binary. This is
documented here:

https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html

This was not working in perf because we didn't read the build id until
AFTER we searched for the separate debug information file. This patch
reads the build ID and THEN does the search.

Signed-off-by: Dima Kogan <dima@secretsauce.net>
Link: http://lkml.kernel.org/r/87si6pfwz4.fsf@secretsauce.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Dima Kogan and committed by
Arnaldo Carvalho de Melo
5baecbcd f2f30968

+9
+9
tools/perf/util/symbol.c
··· 1406 1406 struct symsrc ss_[2]; 1407 1407 struct symsrc *syms_ss = NULL, *runtime_ss = NULL; 1408 1408 bool kmod; 1409 + unsigned char build_id[BUILD_ID_SIZE]; 1409 1410 1410 1411 pthread_mutex_lock(&dso->lock); 1411 1412 ··· 1461 1460 dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP || 1462 1461 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE || 1463 1462 dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; 1463 + 1464 + 1465 + /* 1466 + * Read the build id if possible. This is required for 1467 + * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work 1468 + */ 1469 + if (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0) 1470 + dso__set_build_id(dso, build_id); 1464 1471 1465 1472 /* 1466 1473 * Iterate over candidate debug images.