[llvm] r305597 - [DWARF] Corrected behavior for when no .apple_names section is present in the object.

Spyridoula Gravani via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 15:03:22 PDT 2017


Author: sgravani
Date: Fri Jun 16 17:03:21 2017
New Revision: 305597

URL: http://llvm.org/viewvc/llvm-project?rev=305597&view=rev
Log:
[DWARF] Corrected behavior for when no .apple_names section is present in the object.
The verifier should not output any message in such a case.
Added test case with no .apple_name section in the file to verify new functionality.
Made existing test case more specific.

Added:
    llvm/trunk/test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s
      - copied, changed from r305596, llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s
Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
    llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=305597&r1=305596&r2=305597&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Fri Jun 16 17:03:21 2017
@@ -279,7 +279,6 @@ bool DWARFVerifier::handleDebugLine() {
 
 bool DWARFVerifier::handleAppleNames() {
   NumAppleNamesErrors = 0;
-  OS << "Verifying .apple_names...\n";
 
   DataExtractor AppleNamesSection(DCtx.getAppleNamesSection().Data,
                                   DCtx.isLittleEndian(), 0);
@@ -288,10 +287,11 @@ bool DWARFVerifier::handleAppleNames() {
                                    DCtx.getAppleNamesSection().Relocs);
 
   if (!AppleNames.extract()) {
-    OS << "error: cannot extract .apple_names accelerator table\n";
-    return false;
+    return true;
   }
 
+  OS << "Verifying .apple_names...\n";
+
   // Verify that all buckets have a valid hash index or are empty
   uint32_t NumBuckets = AppleNames.getNumBuckets();
   uint32_t NumHashes = AppleNames.getNumHashes();

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s?rev=305597&r1=305596&r2=305597&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s Fri Jun 16 17:03:21 2017
@@ -3,7 +3,7 @@
 # RUN: | FileCheck %s
 
 # CHECK: Verifying .apple_names...
-# CHECK-NEXT: error:
+# CHECK-NEXT: error: Bucket[0] has invalid hash index: [-2]
 
 # This test is meant to verify that the -verify option 
 # in llvm-dwarfdump, correctly identifies

Copied: llvm/trunk/test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s (from r305596, llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s?p2=llvm/trunk/test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s&p1=llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s&r1=305596&r2=305597&rev=305597&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_buckets.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/no_apple_names_verify_buckets.s Fri Jun 16 17:03:21 2017
@@ -2,12 +2,14 @@
 # RUN: | not llvm-dwarfdump -verify - \
 # RUN: | FileCheck %s
 
-# CHECK: Verifying .apple_names...
-# CHECK-NEXT: error:
+# CHECK-NOT: Verifying .apple_names...
 
 # This test is meant to verify that the -verify option 
-# in llvm-dwarfdump, correctly identifies
-# an invalid hash index for bucket[0] in the .apple_names section. 
+# in llvm-dwarfdump doesn't produce any .apple_names related
+# output when there's no such section int he object.
+# The test was manually modified to exclude the 
+# .apple_names section from the apple_names_verify_buckets.s
+# test file in the same directory.
 
   .section  __TEXT,__text,regular,pure_instructions
   .file 1 "basic.c"
@@ -100,26 +102,6 @@ Ldebug_range:
 Ldebug_macinfo:
 Lcu_macro_begin0:
   .byte 0                       ## End Of Macro List Mark
-  .section  __DWARF,__apple_names,regular,debug
-Lnames_begin:
-  .long 1212240712              ## Header Magic
-  .short  1                       ## Header Version
-  .short  0                       ## Header Hash Function
-  .long 1                       ## Header Bucket Count
-  .long 1                       ## Header Hash Count
-  .long 12                      ## Header Data Length
-  .long 0                       ## HeaderData Die Offset Base
-  .long 1                       ## HeaderData Atom Count
-  .short  1                       ## DW_ATOM_die_offset
-  .short  6                       ## DW_FORM_data4
-  .long -2                      ## Bucket 0 -- error: Bucket[0] has invalid hash index: [-2]
-  .long 177678                  ## Hash in Bucket 0
-  .long LNames0-Lnames_begin    ## Offset in Bucket 0
-LNames0:
-  .long 84                      ## i
-  .long 1                       ## Num DIEs
-  .long 30
-  .long 0
   .section  __DWARF,__apple_objc,regular,debug
 Lobjc_begin:
   .long 1212240712              ## Header Magic




More information about the llvm-commits mailing list