[Rpm-maint] [PATCH 2/5] debugedit: Fix handling in caller for errors in called read_dwarf2_line.

Jan Kratochvil jan.kratochvil at redhat.com
Mon Aug 17 19:46:47 UTC 2020


diff --git a/tools/debugedit.c b/tools/debugedit.c
index 8e85847d1..ff72759ca 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -1155,7 +1155,7 @@ get_line_table (DSO *dso, size_t off, struct line_table **table)
     if (lines->table[i].old_idx == off)
       {
 	*table = &lines->table[i];
-	return false;
+	return true;
       }
 
   if (lines->size == lines->used)
@@ -1621,7 +1621,8 @@ read_dwarf2_line (DSO *dso, uint32_t off, char *comp_dir)
     }
 
   dso->lines.debug_lines_len += 4 + table->unit_length + table->size_diff;
-  return table->replace_dirs || table->replace_files;
+  need_stmt_update = table->replace_dirs || table->replace_files;
+  return true;
 }
 
 /* Called during phase one, after the table has been sorted. */
@@ -1939,9 +1940,11 @@ edit_attributes (DSO *dso, unsigned char *ptr, struct abbrev_tag *t, int phase)
      that).  Note that calculating the new size and offsets is done
      separately (at the end of phase zero after all CUs have been
      scanned in dwarf2_edit). */
-  if (phase == 0 && found_list_offs
-      && read_dwarf2_line (dso, list_offs, comp_dir))
-    need_stmt_update = true;
+  if (found_list_offs && ! read_dwarf2_line (dso, list_offs, comp_dir))
+    {
+      free (comp_dir);
+      return NULL;
+    }
 
   free (comp_dir);
 
@@ -2059,7 +2062,10 @@ edit_info (DSO *dso, int phase, struct debug_section *sec)
 
 	  ptr = edit_attributes (dso, ptr, t, phase);
 	  if (ptr == NULL)
-	    break;
+	    {
+	      htab_delete (abbrev);
+	      return 1;
+	    }
 	}
 
       htab_delete (abbrev);



More information about the Rpm-maint mailing list