diff options
author | Jan Beulich <jbeulich@suse.com> | 2022-03-23 08:48:02 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2022-03-23 08:48:02 +0100 |
commit | 8728bc3d87b8e785689f234ac1f9b73fe6c1fdd1 (patch) | |
tree | 1b1917a2bf744a00e45aaccc3bb2a061845da3f3 /gas | |
parent | 47513fab28ef21fff8a6218ed3aade16605ed8b4 (diff) | |
download | gdb-8728bc3d87b8e785689f234ac1f9b73fe6c1fdd1.zip gdb-8728bc3d87b8e785689f234ac1f9b73fe6c1fdd1.tar.gz gdb-8728bc3d87b8e785689f234ac1f9b73fe6c1fdd1.tar.bz2 |
gas/Dwarf5: adjust .debug_line file 0 checking
First of all when a table entry has a NULL filename, the two inner if()s
are better done the other way around: The 2nd doesn't depend on what the
first does. This then renders redundant half of the conditions of the
other if() and clarifies that subsequently only entry 0 is dealt with
(indicating that part of the comment was wrong). Finally for there to be
a usable name in slot 1, files_in_use needs to be larger than 1 and slot
1's (rather than slot 0's) name needs to be non-NULL.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/dwarf2dbg.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index c6778fe..c0a052d 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -2271,11 +2271,15 @@ out_dir_and_file_list (segT line_seg, int sizeof_offset) if (files[i].filename == NULL) { - /* Prevent a crash later, particularly for file 1. DWARF5 - uses slot zero, but that is only set explicitly using a - .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) + if (DWARF2_LINE_VERSION < 5 || i != 0) + { + as_bad (_("unassigned file number %ld"), (long) i); + continue; + } + /* DWARF5 uses slot zero, but that is only set explicitly using + a .file 0 directive. If that isn't used, but file 1 is, then + use that as main file name. */ + if (files_in_use > 1 && files[1].filename != NULL) { files[0].filename = files[1].filename; files[0].dir = files[1].dir; @@ -2284,12 +2288,7 @@ out_dir_and_file_list (segT line_seg, int sizeof_offset) files[0].md5[j] = files[1].md5[j]; } else - files[i].filename = ""; - if (DWARF2_LINE_VERSION < 5 || i != 0) - { - as_bad (_("unassigned file number %ld"), (long) i); - continue; - } + files[0].filename = ""; } fullfilename = DWARF2_FILE_NAME (files[i].filename, |