[Lldb-commits] [PATCH] D131705: Don't create sections for SHN_ABS symbols in ELF files.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 19 12:13:51 PDT 2022


clayborg added inline comments.


================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:1550
+        } else {
+          strm.IndentMore();
+          strm.Indent("    Value: ");
----------------
alvinhochun wrote:
> This `IndentMore` added is missing a matching `IndentLess` call.
Yes, a fix is needed. Feel free to post a patch, or I will try to get to this soon.


================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:1551-1556
+          strm.Indent("    Value: ");
+          strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetRawValue());
+          if (symbol->GetByteSizeIsValid()) {
+            strm.Indent("    Size: ");
+            strm.Printf("0x%16.16" PRIx64 "\n", symbol->GetByteSize());
+          }
----------------
alvinhochun wrote:
> May I ask, is it expected for this to print only the value and size but not the name of the symbol?
> 
> Also, in some COFF binaries linked by LLD there are a bunch of absolute symbols (e.g. `__guard_flags`) and when they hit this code path all they print is `Value: 0xffffffffffffffff`.
> 
> llvm-readobj shows the symbol as:
> 
> ```
>   Symbol {
>     Name: __guard_flags
>     Value: 2147550464
>     Section: IMAGE_SYM_ABSOLUTE (-1)
>     BaseType: Null (0x0)
>     ComplexType: Null (0x0)
>     StorageClass: External (0x2)
>     AuxSymbolCount: 0
>   }
> ```
> Though neither values are correct. I expect the value to be `0x10500`. I haven't looked into this yet. Any idea what might be going on?
We should be printing the name. I guess in the "symbol->ValueIsAddress()" case it would print the name from the symbolication of the address. Should be an easy fix, feel free to submit a patch, or I can try to get to it when i have some time.

I would look at the lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp and check the "ObjectFilePECOFF::ParseSymtab(Symtab &symtab)" method. It must not be creating the symbols correctly from the symbol table. Any fixes for the PECOFF object file plug-in would be appreciated if you find any issues or things we can do better. Back in the day I had a hard time getting any symbol table the show up in the PECOFF file, but that was a long time ago and I wasn't super familiar with Windows binaries.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131705/new/

https://reviews.llvm.org/D131705



More information about the lldb-commits mailing list