aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-11-26 09:59:45 +0100
committerTom de Vries <tdevries@suse.de>2021-11-26 09:59:45 +0100
commit4780e5e4933a2497a5aecc4ceabbbb8e82aaf822 (patch)
tree27bd71b7c86c6e12faa9027fa7ee882e50ce68d2
parentc0f9d658279d4d352672e283df53c1072925fc97 (diff)
downloadgdb-4780e5e4933a2497a5aecc4ceabbbb8e82aaf822.zip
gdb-4780e5e4933a2497a5aecc4ceabbbb8e82aaf822.tar.gz
gdb-4780e5e4933a2497a5aecc4ceabbbb8e82aaf822.tar.bz2
[gas] Fix file 0 dir with -gdwarf-5
In out_dir_and_file_list, if file 0 is copied from file 1, only the filename is copied, and the dir and md5 fields are left to their default values. Fix this by adding the copy of the dir and md5 fields. gas/ChangeLog: 2021-11-26 Tom de Vries <tdevries@suse.de> PR 28629 * dwarf2dbg.c (out_dir_and_file_list): When copying file 1 to file 0, also copy dir and md5 fields. * testsuite/gas/i386/dwarf5-line-4.d: Adjust expected output.
-rw-r--r--gas/ChangeLog7
-rw-r--r--gas/dwarf2dbg.c10
-rw-r--r--gas/testsuite/gas/i386/dwarf5-line-4.d2
3 files changed, 16 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8732088..c2886ee 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,10 @@
+2021-11-26 Tom de Vries <tdevries@suse.de>
+
+ PR 28629
+ * dwarf2dbg.c (out_dir_and_file_list): When copying file 1 to file 0,
+ also copy dir and md5 fields.
+ * testsuite/gas/i386/dwarf5-line-4.d: Adjust expected output.
+
2021-11-18 Nick Clifton <nickc@redhat.com>
* as.c (parse_args): Add support for --multibyte-handling.
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 256412f..7300bfe 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -2123,7 +2123,7 @@ out_dir_and_file_list (segT line_seg, int sizeof_offset)
size_t size;
const char *dir;
char *cp;
- unsigned int i;
+ unsigned int i, j;
bool emit_md5 = false;
bool emit_timestamps = true;
bool emit_filesize = true;
@@ -2275,7 +2275,13 @@ out_dir_and_file_list (segT line_seg, int sizeof_offset)
.file 0 directive. If that isn't used, but file 1 is,
then use that as main file name. */
if (DWARF2_LINE_VERSION >= 5 && i == 0 && files_in_use >= 1 && files[0].filename == NULL)
- files[0].filename = files[1].filename;
+ {
+ files[0].filename = files[1].filename;
+ files[0].dir = files[1].dir;
+ if (emit_md5)
+ for (j = 0; i < NUM_MD5_BYTES; ++j)
+ files[0].md5[j] = files[1].md5[j];
+ }
else
files[i].filename = "";
if (DWARF2_LINE_VERSION < 5 || i != 0)
diff --git a/gas/testsuite/gas/i386/dwarf5-line-4.d b/gas/testsuite/gas/i386/dwarf5-line-4.d
index 30e1bb2..a3af48e 100644
--- a/gas/testsuite/gas/i386/dwarf5-line-4.d
+++ b/gas/testsuite/gas/i386/dwarf5-line-4.d
@@ -38,7 +38,7 @@ Raw dump of debug contents of section \.z?debug_line:
The File Name Table \(offset 0x.*, lines 2, columns 2\):
Entry Dir Name
- 0 0 \(indirect line string, offset: 0x.*\): dwarf5-line-4.s
+ 0 1 \(indirect line string, offset: 0x.*\): dwarf5-line-4.s
1 1 \(indirect line string, offset: 0x.*\): dwarf5-line-4.s
Line Number Statements: