[Lldb-commits] [lldb] 7026b34 - make err msg in MachSymtabSectionInfo::GetSection clear about the file

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 18 16:13:25 PST 2019


Author: Jason Molenda
Date: 2019-12-18T16:13:17-08:00
New Revision: 7026b34702f3f71ff157876831f29c76b3cb8bb1

URL: https://github.com/llvm/llvm-project/commit/7026b34702f3f71ff157876831f29c76b3cb8bb1
DIFF: https://github.com/llvm/llvm-project/commit/7026b34702f3f71ff157876831f29c76b3cb8bb1.diff

LOG: make err msg in MachSymtabSectionInfo::GetSection clear about the file

This error message didn't specify which file was malformed, so
there's some hunting-around required if it comes up.  We have the
filename; include it in the error message.

Added: 
    

Modified: 
    lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index ef6ad1696c47..e730aafbd3e2 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1865,9 +1865,15 @@ class MachSymtabSectionInfo {
           m_section_infos[n_sect].vm_range.SetByteSize(
               section_sp->GetByteSize());
         } else {
+          const char *filename = "<unknown>";
+          SectionSP first_section_sp(m_section_list->GetSectionAtIndex(0));
+          if (first_section_sp)
+            filename = first_section_sp->GetObjectFile()->GetFileSpec().GetPath().c_str();
+
           Host::SystemLog(Host::eSystemLogError,
-                          "error: unable to find section for section %u\n",
-                          n_sect);
+                          "error: unable to find section %d for a symbol in %s, corrupt file?\n",
+                          n_sect, 
+                          filename);
         }
       }
       if (m_section_infos[n_sect].vm_range.Contains(file_addr)) {


        


More information about the lldb-commits mailing list