[Lldb-commits] [lldb] [lldb] Add logging to ObjectFileMachO::ParseSymtab (PR #70490)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 27 11:22:13 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Jonas Devlieghere (JDevlieghere)
<details>
<summary>Changes</summary>
I have a crash when parsing the dyld trie data and I want to ask the originator to send me the (possibly corrupted) binary that's causing this. This patch adds some logging to help pinpoint that file.
---
Full diff: https://github.com/llvm/llvm-project/pull/70490.diff
1 Files Affected:
- (modified) lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp (+6-2)
``````````diff
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index efcfdf5ac2cd37e..db186ab95802017 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2220,9 +2220,12 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
if (!module_sp)
return;
+ Log *log = GetLog(LLDBLog::Symbols);
+
const FileSpec &file = m_file ? m_file : module_sp->GetFileSpec();
const char *file_name = file.GetFilename().AsCString("<Unknown>");
LLDB_SCOPED_TIMERF("ObjectFileMachO::ParseSymtab () module = %s", file_name);
+ LLDB_LOG(log, "Parsing symbol table for {0}", file_name);
Progress progress(llvm::formatv("Parsing symbol table for {0}", file_name));
llvm::MachO::symtab_command symtab_load_command = {0, 0, 0, 0, 0, 0};
@@ -2252,7 +2255,6 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
uint32_t i;
FileSpecList dylib_files;
- Log *log = GetLog(LLDBLog::Symbols);
llvm::StringRef g_objc_v2_prefix_class("_OBJC_CLASS_$_");
llvm::StringRef g_objc_v2_prefix_metaclass("_OBJC_METACLASS_$_");
llvm::StringRef g_objc_v2_prefix_ivar("_OBJC_IVAR_$_");
@@ -2652,7 +2654,9 @@ void ObjectFileMachO::ParseSymtab(Symtab &symtab) {
std::vector<TrieEntryWithOffset> external_sym_trie_entries;
std::set<lldb::addr_t> resolver_addresses;
- if (dyld_trie_data.GetByteSize() > 0) {
+ const size_t dyld_trie_data_size = dyld_trie_data.GetByteSize();
+ if (dyld_trie_data_size > 0) {
+ LLDB_LOG(log, "Parsing {0} bytes of dyld trie data", dyld_trie_data_size);
SectionSP text_segment_sp =
GetSectionList()->FindSectionByName(GetSegmentNameTEXT());
lldb::addr_t text_segment_file_addr = LLDB_INVALID_ADDRESS;
``````````
</details>
https://github.com/llvm/llvm-project/pull/70490
More information about the lldb-commits
mailing list