From 10577a3b13de151a795fe5f60a64dd2e98bca642 Mon Sep 17 00:00:00 2001 From: Vladimir Mezentsev Date: Fri, 10 Mar 2023 16:16:49 -0800 Subject: [PATCH] gprofng: fix the Dwarf reader gprofng/ChangeLog 2023-03-10 Vladimir Mezentsev gprofng/src/DwarfLib.cc (DwrLineRegs::getPath): Add a DW_AT_comp_dir string if the directoty table has relative names. --- gprofng/src/DwarfLib.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gprofng/src/DwarfLib.cc b/gprofng/src/DwarfLib.cc index 64003797d25..90c3e6e95a2 100644 --- a/gprofng/src/DwarfLib.cc +++ b/gprofng/src/DwarfLib.cc @@ -1779,7 +1779,15 @@ DwrLineRegs::getPath (int fn) } if (dir == NULL || *dir == 0) return fnp->path; - fnp->path = canonical_path (dbe_sprintf ("%s/%s", dir, fnp->fname)); + + char *dir1 = NULL; + if (*dir != '/') + dir1 = dir_names->get(0)->fname; + if (dir1 && *dir != 0) + fnp->path = dbe_sprintf ("%s/%s/%s", dir1, dir, fnp->fname); + else + fnp->path = dbe_sprintf ("%s/%s", dir, fnp->fname); + fnp->path = canonical_path (fnp->path); return fnp->path; } -- 2.30.2