From f65d1b8c47c5d08002ad209831a292e503162b33 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Thu, 15 Dec 2016 11:35:44 +0100
Subject: [PATCH] Set debug-file-directory when using a sysroot

debug-file-directory is the directory where gdb goes to look for
detached debug symbols (the non buildid kind). It's interaction with the
sysroot bits are bit.. odd.. For each debug-file-directory path it will
look in ${path}/${sysroot}/<debuglink> and ${path}/debuglink, both of
which are mostly useless  for sysroots.

Explicitely set the path to ${sysroot}/usr/lib/debug to set gdb
straight.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D5304
---
 tools/ade | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/ade b/tools/ade
index 8afb996..474320d 100755
--- a/tools/ade
+++ b/tools/ade
@@ -222,6 +222,8 @@ class Debugger:
         cmds = []
         if isinstance(self.target, Sysroot):
             cmds.append("set sysroot {}".format(self.target.path))
+            cmds.append("set debug-file-directory {}".format(
+                os.path.join(self.target.path, 'usr', 'lib', 'debug')))
         cmds.append("set solib-search-path {}".format(libdir))
         cmds.append("file {}{}".format(debugdir, server.app))
         cmds.append("target remote {}".format(server.get_info()))
-- 
GitLab