From: Vladimir Mezentsev Date: Sat, 11 Mar 2023 00:16:49 +0000 (-0800) Subject: gprofng: fix the Dwarf reader X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=10577a3b13de151a795fe5f60a64dd2e98bca642;p=binutils-gdb.git 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. --- 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; }