]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
dwarflint: Check for empty but present .dwarf_str
authorPetr Machata <pmachata@redhat.com>
Tue, 4 Aug 2009 13:46:26 +0000 (15:46 +0200)
committerPetr Machata <pmachata@redhat.com>
Tue, 4 Aug 2009 13:49:24 +0000 (15:49 +0200)
src/dwarflint.c

index b888d16e31ee2c2f9a5cdde6cc17f4ce620d0aff..bab48a6faa068cfbdebe56181cd6230b644b0134 100644 (file)
@@ -1239,6 +1239,16 @@ process_file (Elf *elf, const char *fname, bool only_one)
     /* Hard error, not a message.  We can't debug without this.  */
     wr_error (NULL, ".debug_abbrev data not found.\n");
 
+  Elf_Data *str_data = NULL;
+  if (SEC(str) != NULL)
+    {
+      str_data = SEC(str)->data;
+      if (str_data == NULL)
+       wr_message (mc_impact_4 | mc_acc_suboptimal | mc_elf,
+                   &WHERE (sec_str, NULL),
+                   ": the section is present but empty.\n");
+    }
+
   struct cu_coverage *cu_coverage = NULL;
   if (abbrev_chain != NULL)
     {
@@ -1246,7 +1256,7 @@ process_file (Elf *elf, const char *fname, bool only_one)
        {
          cu_coverage = calloc (1, sizeof (struct cu_coverage));
          cu_chain = check_info_structural (&file, SEC(info), abbrev_chain,
-                                           SEC(str)->data, cu_coverage);
+                                           str_data, cu_coverage);
          if (cu_chain != NULL && do_high_level)
            check_expected_trees (hlctx);
        }