]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix typo in DWARF 5 line table readers
authorMark Wielaard <mark@klomp.org>
Sun, 21 Feb 2021 21:45:51 +0000 (22:45 +0100)
committerMark Wielaard <mark@klomp.org>
Sun, 21 Feb 2021 22:20:09 +0000 (23:20 +0100)
This typo meant the directory entry was most often zero, which
happened to be sometimes correct anyway (since zero is the compdir).
So for simple testcases it looked correct. But it would be wrong for
compilation units not in the current compdir. Like files compiled with
a relative of absolute path (and then combined into the same compilation
unit with LTO).

The same typo was in both readdwarf.c (read_dwarf2_lineblock) and
readdwarf3.c (read_filename_table). read_dwarf2_lineblock also had
an extra "dwarf" string in the --debug-dump=line output.

https://bugzilla.redhat.com/show_bug.cgi?id=1927153

coregrind/m_debuginfo/readdwarf.c
coregrind/m_debuginfo/readdwarf3.c

index 88d5d99f17b81225ae869650eb8144c1b5626da4..3996623edba975b3332b28f02652b3405a1ba5ae 100644 (file)
@@ -683,7 +683,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
       directories_count = step_leb128U(&data);
       /* Read the contents of the Directory table.  */
       if (di->ddump_line)
-         VG_(printf)(" dwarf The Directory Table%s\n",
+         VG_(printf)(" The Directory Table%s\n",
                      directories_count == 0 ? " is empty." : ":" );
 
       for (n = 0; n < directories_count; n++) {
@@ -796,7 +796,7 @@ void read_dwarf2_lineblock ( struct _DebugInfo* di,
             if (f == p_ndx)
                name = get_line_str (di, ui, &data, form,
                                     debugstr_img, debuglinestr_img);
-            else if (n == d_ndx)
+            else if (f == d_ndx)
                diridx = get_line_ndx (di, &data, form);
             else
                data = skip_line_form (di, ui, data, form);
index 82bc8f241fc58a1df101ebf81c84bfa34c78093c..60fc4024476fb70b998e5a1bd0d0939f37763657 100644 (file)
@@ -2323,7 +2323,7 @@ void read_filename_table( /*MOD*/XArray* /* of UInt* */ fndn_ix_Table,
             if (f == p_ndx)
                str = get_line_str (cc->di, cc->is_dw64, &c, form,
                                    debugstr_img, debuglinestr_img);
-            else if (n == d_ndx)
+            else if (f == d_ndx)
                dir_xa_ix = get_line_ndx (cc->di, &c, form);
             else
                skip_line_form (cc->di, cc->is_dw64, &c, form);