[Lldb-commits] [PATCH] D134517: [lldb][COFF] Load absolute symbols from COFF symbol table

Alvin Wong via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 22 23:55:34 PDT 2022


alvinhochun created this revision.
alvinhochun added reviewers: labath, DavidSpickett, mstorsjo.
Herald added a project: All.
alvinhochun requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Depends on D134426 <https://reviews.llvm.org/D134426>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134517

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


Index: lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
===================================================================
--- lldb/test/Shell/ObjectFile/PECOFF/symbol.yaml
+++ 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 @@
     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
 ...
Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -829,6 +829,9 @@
             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);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134517.462398.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220923/0d2761cd/attachment.bin>


More information about the lldb-commits mailing list