[Lldb-commits] [lldb] 7ebff6a - [lldb][COFF] Load absolute symbols from COFF symbol table

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 28 02:58:21 PDT 2022


Author: Alvin Wong
Date: 2022-09-28T12:57:11+03:00
New Revision: 7ebff6ab26aa03423c61e0370377f11725184199

URL: https://github.com/llvm/llvm-project/commit/7ebff6ab26aa03423c61e0370377f11725184199
DIFF: https://github.com/llvm/llvm-project/commit/7ebff6ab26aa03423c61e0370377f11725184199.diff

LOG: [lldb][COFF] Load absolute symbols from COFF symbol table

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D134517

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 0a2777a193c8..ff824332bdd8 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -830,6 +830,9 @@ void ObjectFilePECOFF::AppendFromCOFFSymbolTable(
             symbol.SetType(exported->GetType());
         }
       }
+    } else if (section_number == llvm::COFF::IMAGE_SYM_ABSOLUTE) {
+      symbol.GetAddressRef() = Address(coff_sym_ref.getValue());
+      symbol.SetType(lldb::eSymbolTypeAbsolute);
     }
     symtab.AddSymbol(symbol);
   }

diff  --git a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
index 8bda82c6b4a0..4a663a84a493 100644
--- a/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
+++ b/lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
@@ -4,9 +4,10 @@
 ## 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
+# 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
+# CHECK: Absolute 0x00000000deadbeef        0x{{[0-9a-f]+}} 0x{{[0-9a-f]+}} absolute_symbol
 
 --- !COFF
 OptionalHeader:
@@ -123,4 +124,10 @@ symbols:
     SimpleType:      IMAGE_SYM_TYPE_NULL
     ComplexType:     IMAGE_SYM_DTYPE_NULL
     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
+  - Name:            absolute_symbol
+    Value:           0xdeadbeef
+    SectionNumber:   -1
+    SimpleType:      IMAGE_SYM_TYPE_NULL
+    ComplexType:     IMAGE_SYM_DTYPE_NULL
+    StorageClass:    IMAGE_SYM_CLASS_STATIC
 ...


        


More information about the lldb-commits mailing list