Fix CU: output of the --debug-dump=decodedline, the problem there

is that both file name and current directory is recorded, however
file name sometimes already contains absolute path. In which case
prefixing it with directory name results in an invalid pathname.

Only append directory name if the file name does not start with '/'.
This seems to DTRT.

Approved by:	emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18290
This commit is contained in:
Maxim Sobolev 2018-11-21 21:46:06 +00:00
parent 53011553fa
commit 65caaa0ed6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=340745

View File

@ -4720,7 +4720,7 @@ dump_dwarf_line_decoded(struct readelf *re)
DW_DLV_OK)
dir = NULL;
printf("CU: ");
if (dir && file)
if (dir && file && file[0] != '/')
printf("%s/", dir);
if (file)
printf("%s", file);