-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[lldb] Add logging to ObjectFileMachO::ParseSymtab #70490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] Add logging to ObjectFileMachO::ParseSymtab #70490
Conversation
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.
|
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesI 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:
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;
|
bulbazord
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine to me, one small question though
| const size_t dyld_trie_data_size = dyld_trie_data.GetByteSize(); | ||
| if (dyld_trie_data_size > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you pull this out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I can reuse the value in the log line below.
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. (cherry picked from commit d3cbf9f)
[lldb] Add logging to ObjectFileMachO::ParseSymtab (llvm#70490)
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.