summaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorRichard Earnshaw <richard.earnshaw@arm.com>2002-07-17 12:17:18 +0000
committerRichard Earnshaw <richard.earnshaw@arm.com>2002-07-17 12:17:18 +0000
commit0e8a209748b8ce62d087472111283b143d78841a (patch)
treef70d9bebdf111e37a8f8570dc467eb159a2bbc91 /bfd/dwarf2.c
parent98092dc2237dd2f46c50efcc3fdb18279f7d73b2 (diff)
downloadgdb-0e8a209748b8ce62d087472111283b143d78841a.tar.gz
From: Ian Rickards <irickard@arm.com>
* dwarf2.c (concat_filename): If we can't establish the directory just return the filename.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 005a21f7d3b..9c5e7b8d173 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -856,13 +856,18 @@ concat_filename (table, file)
filename = table->files[file - 1].name;
if (IS_ABSOLUTE_PATH(filename))
return filename;
-
else
{
char* dirname = (table->files[file - 1].dir
? table->dirs[table->files[file - 1].dir - 1]
: table->comp_dir);
- return (char*) concat (dirname, "/", filename, NULL);
+
+ /* Not all tools set DW_AT_comp_dir, so dirname may be unknown. The
+ best we can do is return the filename part. */
+ if (dirname == NULL)
+ return filename;
+ else
+ return (char*) concat (dirname, "/", filename, NULL);
}
}