[PATCH] D86867: [obj2yaml] Add support for dumping the .debug_str section.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 01:46:59 PDT 2020


jhenderson added inline comments.


================
Comment at: llvm/tools/obj2yaml/elf2yaml.cpp:209
+      if (SecName == "debug_str")
+        return !(RawSec->EntSize && (uint64_t)*RawSec->EntSize == 1) ||
+               RawSec->Flags.getValueOr(ELFYAML::ELF_SHF(0)) !=
----------------
grimar wrote:
> Higuoxing wrote:
> > jhenderson wrote:
> > > I'm struggling with this code. Under what circumstances can `RawSec->EntSize` by None here? Similar question for the Flags below.
> > I check it because `EntSize` and `Flags` are `Optional` values. It seems that you are right, I cannot create a test case that make them `None`. Could you please tell me why they cannot be `None` here?
> Well. I haven't debugged this, but I *think* they can be None.
> 
> Looking on the code, we have:
> 
> ```
> Error ELFDumper<ELFT>::dumpCommonSection(const Elf_Shdr *Shdr,
>                                          ELFYAML::Section &S) {
> ...
>   if (Shdr->sh_entsize != getDefaultShEntSize<ELFT>(S.Type))
>     S.EntSize = static_cast<llvm::yaml::Hex64>(Shdr->sh_entsize);
> ```
> 
> So i'd expect to have `None` value when `sh_entsize == 0`. Isn't it true?
@grimar is more familiar with this code than I am, so perhaps he can explain. I unfortunately have higher priority work that needs doing today, or I'd go digging myself!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86867



More information about the llvm-commits mailing list