OSDN Git Service

[LLDB] [COFF] Fix handling of symbols with more than one aux symbol
authorMartin Storsjö <martin@martin.st>
Fri, 17 Jul 2020 20:35:45 +0000 (23:35 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 20 Jul 2020 19:42:28 +0000 (22:42 +0300)
Differential Revision: https://reviews.llvm.org/D84070

lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml

index 5feec81..9073672 100644 (file)
@@ -686,7 +686,7 @@ Symtab *ObjectFilePECOFF::GetSymtab() {
 
             if (symbol.naux > 0) {
               i += symbol.naux;
-              offset += symbol_size;
+              offset += symbol.naux * symbol_size;
             }
           }
         }
index 1d79e70..9dbc93b 100644 (file)
@@ -1,6 +1,9 @@
 # RUN: yaml2obj %s > %t
 # RUN: lldb-test symbols %t | FileCheck %s
 
+## The .file symbol isn't checked, but is included to test that the symbol
+## table iteration handles cases with a symbol with more than one aux symbol.
+
 # CHECK: Type File Address/Value {{.*}} Size            Flags           Name
 # CHECK: Code 0x0000000040001000        0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} entry
 # CHECK:      0x0000000040002000        0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} variable
@@ -101,6 +104,13 @@ symbols:
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_STATIC
+  - Name:            .file
+    Value:           0
+    SectionNumber:   -2
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_FILE
+    File:            longfilenameusingtwoauxsymbols
   - Name:            entry
     Value:           0
     SectionNumber:   1