From b5c9107465a144ca655ae587c1fcc7d4ac3ef089 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Thu, 27 Jun 2024 15:34:27 +0200 Subject: [PATCH] use /depot as depot directory in debug info By using GCC's --debug-prefix-map argument, we can make sure that debug archives always refer to source files at /depot. With this change, GDB can be pointed to the correct source-file location by using the `set substitute-path /depot /path/to/local/depot`. Fixes #5260 --- repos/base/mk/global.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repos/base/mk/global.mk b/repos/base/mk/global.mk index fa7689bee4..3c6c0461ae 100644 --- a/repos/base/mk/global.mk +++ b/repos/base/mk/global.mk @@ -124,6 +124,12 @@ endif CC_OPT += -fprofile-arcs -ftest-coverage -fprofile-dir=$(PROFILE_DIR) endif +ifneq ($(findstring /depot/,$(CURDIR)),) +DEBUG_PREFIX = $(shell echo $(CURDIR) | \ + sed -e 's|/depot/.*$$|/depot/|') +CC_OPT += -fdebug-prefix-map=$(DEBUG_PREFIX)=/depot/ +endif + # # Enable the undefined behavior sanitizer if requested #