[Lldb-commits] [PATCH] D35784: [LLDB][MIPS] The symbol with NOTYPE doesn't contain any valid address

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 9 11:01:23 PDT 2017


clayborg added a comment.

I think a better solution is to not give the symbol's address a valid section in the first place. This would be done in ObjectFileELF.cpp when . It doesn't seem like the section is valid because $debug_ranges627 shouldn't have an address that matches something in .text. It just doesn't make sense.

My proposed fix would be in ObjectFileElf.cpp in ObjectFileELF::ParseSymbols(). The current code looks like:

  Elf64_Half section_idx = symbol.st_shndx;
  
  switch (section_idx) {
  case SHN_ABS:
    symbol_type = eSymbolTypeAbsolute;
    break;
  case SHN_UNDEF:
    symbol_type = eSymbolTypeUndefined;
    break;
  default:
    symbol_section_sp = section_list->GetSectionAtIndex(section_idx);
    break;
  }

It could be fixed with:

  Elf64_Half section_idx = symbol.st_shndx;
  
  switch (section_idx) {
  case SHN_ABS:
    symbol_type = eSymbolTypeAbsolute;
    break;
  case SHN_UNDEF:
    symbol_type = eSymbolTypeUndefined;
    break;
  default:
    if (symbol.getType() != STT_NOTYPE)
      symbol_section_sp = section_list->GetSectionAtIndex(section_idx);
    break;
  }


https://reviews.llvm.org/D35784





More information about the lldb-commits mailing list