[Lldb-commits] [PATCH] D70745: [LLDB] [PECOFF] Look for the truncated ".eh_fram" section name

Martin Storsjö via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 26 14:26:59 PST 2019


mstorsjo created this revision.
mstorsjo added reviewers: labath, amccarth.
Herald added a project: LLDB.

COFF section names can either be stored truncated to 8 chars, in the section header, or as a longer section name, stored separately in the string table.

libunwind locates the .eh_frame section by runtime introspection, which only works for section names stored in the section header (as the string table isn't mapped at runtime). To support this behaviour, lld always truncates the section names for sections that will be mapped, like .eh_frame.

The change is simple, but is there any straightforward way of making a test for this? I can detect whether the .eh_frame section was picked up by e.g. `image show-unwind -n <symbol>`, but that requires actually executing a process first. Is there any simpler form of a test that could run without actually executing a process here?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70745

Files:
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp


Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -836,6 +836,7 @@
       static ConstString g_sect_name_dwarf_debug_str(".debug_str");
       static ConstString g_sect_name_dwarf_debug_types(".debug_types");
       static ConstString g_sect_name_eh_frame(".eh_frame");
+      static ConstString g_sect_name_eh_frame_trunc(".eh_fram");
       static ConstString g_sect_name_go_symtab(".gosymtab");
       SectionType section_type = eSectionTypeOther;
       if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_CNT_CODE &&
@@ -894,6 +895,8 @@
         section_type = eSectionTypeDWARFDebugTypes;
       else if (const_sect_name == g_sect_name_eh_frame)
         section_type = eSectionTypeEHFrame;
+      else if (const_sect_name == g_sect_name_eh_frame_trunc)
+        section_type = eSectionTypeEHFrame;
       else if (const_sect_name == g_sect_name_go_symtab)
         section_type = eSectionTypeGoSymtab;
       else if (m_sect_headers[idx].flags & llvm::COFF::IMAGE_SCN_CNT_CODE) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70745.231134.patch
Type: text/x-patch
Size: 1202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191126/8e2af225/attachment.bin>


More information about the lldb-commits mailing list