Skip to content

Commit 6e4bd65

Browse files
Merge pull request #3086 from adrian-prantl/log-reflection
Add log output for reflection metadata loading.
2 parents 5e5b513 + 6649bd1 commit 6e4bd65

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -624,19 +624,25 @@ bool SwiftLanguageRuntimeImpl::AddModuleToReflectionContext(
624624
obj_file->GetFileSpec().GetFilename().GetCString());
625625
return false;
626626
}
627-
if (HasReflectionInfo(obj_file)) {
628-
// When dealing with ELF, we need to pass in the contents of the on-disk
629-
// file, since the Section Header Table is not present in the child process
630-
if (obj_file->GetPluginName().GetStringRef().equals("elf")) {
631-
DataExtractor extractor;
632-
auto size = obj_file->GetData(0, obj_file->GetByteSize(), extractor);
633-
const uint8_t *file_data = extractor.GetDataStart();
634-
llvm::sys::MemoryBlock file_buffer((void *)file_data, size);
635-
m_reflection_ctx->readELF(swift::remote::RemoteAddress(load_ptr),
636-
llvm::Optional<llvm::sys::MemoryBlock>(file_buffer));
637-
} else {
638-
m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr));
639-
}
627+
bool found = HasReflectionInfo(obj_file);
628+
LLDB_LOGF(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
629+
"%s reflection metadata in \"%s\"", found ? "Adding" : "No",
630+
obj_file->GetFileSpec().GetCString());
631+
if (!found)
632+
return true;
633+
634+
// When dealing with ELF, we need to pass in the contents of the on-disk
635+
// file, since the Section Header Table is not present in the child process
636+
if (obj_file->GetPluginName().GetStringRef().equals("elf")) {
637+
DataExtractor extractor;
638+
auto size = obj_file->GetData(0, obj_file->GetByteSize(), extractor);
639+
const uint8_t *file_data = extractor.GetDataStart();
640+
llvm::sys::MemoryBlock file_buffer((void *)file_data, size);
641+
m_reflection_ctx->readELF(
642+
swift::remote::RemoteAddress(load_ptr),
643+
llvm::Optional<llvm::sys::MemoryBlock>(file_buffer));
644+
} else {
645+
m_reflection_ctx->addImage(swift::remote::RemoteAddress(load_ptr));
640646
}
641647
return true;
642648
}

lldb/test/API/lang/swift/system_framework/TestSwiftSystemFramework.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def test_system_framework(self):
2828
for line in logfile:
2929
if ") rejecting framework path " in line:
3030
pos += 1
31-
elif "/System/Library/Frameworks" in line:
31+
elif ("reflection metadata" not in line) and \
32+
("/System/Library/Frameworks" in line):
3233
neg += 1
3334

3435
self.assertGreater(pos, 0, "sanity check failed")

0 commit comments

Comments
 (0)