summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonard Mosescu <mosescu@google.com>2018-08-07 18:00:30 +0000
committerLeonard Mosescu <mosescu@google.com>2018-08-07 18:00:30 +0000
commit9ba51579fb331697c09441fdb1f77f267ff82c77 (patch)
treedf66cfef5f309badcb1e2c40acbf0c1f9e1db6f5
parent57e6dd72226a50bf72b37e9b233561ac1a4b25b7 (diff)
downloadbcm5719-llvm-9ba51579fb331697c09441fdb1f77f267ff82c77.tar.gz
bcm5719-llvm-9ba51579fb331697c09441fdb1f77f267ff82c77.zip
Misc module/dwarf logging improvements
This change improves the logging for the lldb.module category to note a few interesting cases: 1. Local object file found, but specs not matching 2. Local object file not found, using a placeholder module The handling and logging for the cases wehre we fail to load compressed dwarf symbols is also improved. Differential Revision: https://reviews.llvm.org/D50274 llvm-svn: 339161
-rw-r--r--lldb/lit/Modules/compressed-sections.yaml3
-rw-r--r--lldb/source/Core/Module.cpp8
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp29
-rw-r--r--lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp6
-rw-r--r--lldb/source/Target/Process.cpp6
5 files changed, 33 insertions, 19 deletions
diff --git a/lldb/lit/Modules/compressed-sections.yaml b/lldb/lit/Modules/compressed-sections.yaml
index c75dc857522..3a0805c06d6 100644
--- a/lldb/lit/Modules/compressed-sections.yaml
+++ b/lldb/lit/Modules/compressed-sections.yaml
@@ -28,5 +28,4 @@ Sections:
# CHECK-NEXT: Type: regular
# CHECK-NEXT: VM size: 0
# CHECK-NEXT: File size: 8
-# CHECK-NEXT: Data:
-# CHECK-NEXT: DEADBEEF BAADF00D
+# CHECK-NEXT: Data: ()
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 3b1a4fd7be0..b078cd30aea 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -162,9 +162,13 @@ Module::Module(const ModuleSpec &module_spec)
// fill any ivars in so we don't accidentally grab the wrong file later since
// they don't match...
ModuleSpec matching_module_spec;
- if (modules_specs.FindMatchingModuleSpec(module_spec, matching_module_spec) ==
- 0)
+ if (!modules_specs.FindMatchingModuleSpec(module_spec,
+ matching_module_spec)) {
+ if (log) {
+ log->Printf("Found local object file but the specs didn't match");
+ }
return;
+ }
if (module_spec.GetFileSpec())
m_mod_time = FileSystem::GetModificationTime(module_spec.GetFileSpec());
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 8701908378f..6a81746ffe4 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -1390,7 +1390,7 @@ ObjectFileELF::RefineModuleDetailsFromNote(lldb_private::DataExtractor &data,
arch_spec.GetTriple().getOS() == llvm::Triple::OSType::UnknownOS)
// In case of MIPSR6, the LLDB_NT_OWNER_GNU note is missing for some
// cases (e.g. compile with -nostdlib) Hence set OS to Linux
- arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
+ arch_spec.GetTriple().setOS(llvm::Triple::OSType::Linux);
}
}
@@ -1494,7 +1494,7 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl &section_headers,
const uint32_t sub_type = subTypeFromElfHeader(header);
arch_spec.SetArchitecture(eArchTypeELF, header.e_machine, sub_type,
header.e_ident[EI_OSABI]);
-
+
// Validate if it is ok to remove GetOsFromOSABI. Note, that now the OS is
// determined based on EI_OSABI flag and the info extracted from ELF notes
// (see RefineModuleDetailsFromNote). However in some cases that still
@@ -3385,8 +3385,6 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
if (section->GetObjectFile() != this)
return section->GetObjectFile()->ReadSectionData(section, section_data);
- Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_MODULES);
-
size_t result = ObjectFile::ReadSectionData(section, section_data);
if (result == 0 || !section->Test(SHF_COMPRESSED))
return result;
@@ -3397,20 +3395,27 @@ size_t ObjectFileELF::ReadSectionData(Section *section,
size_t(section_data.GetByteSize())},
GetByteOrder() == eByteOrderLittle, GetAddressByteSize() == 8);
if (!Decompressor) {
- LLDB_LOG_ERROR(log, Decompressor.takeError(),
- "Unable to initialize decompressor for section {0}",
- section->GetName());
- return result;
+ GetModule()->ReportWarning(
+ "Unable to initialize decompressor for section '%s': %s",
+ section->GetName().GetCString(),
+ llvm::toString(Decompressor.takeError()).c_str());
+ section_data.Clear();
+ return 0;
}
+
auto buffer_sp =
std::make_shared<DataBufferHeap>(Decompressor->getDecompressedSize(), 0);
- if (auto Error = Decompressor->decompress(
+ if (auto error = Decompressor->decompress(
{reinterpret_cast<char *>(buffer_sp->GetBytes()),
size_t(buffer_sp->GetByteSize())})) {
- LLDB_LOG_ERROR(log, std::move(Error), "Decompression of section {0} failed",
- section->GetName());
- return result;
+ GetModule()->ReportWarning(
+ "Decompression of section '%s' failed: %s",
+ section->GetName().GetCString(),
+ llvm::toString(std::move(error)).c_str());
+ section_data.Clear();
+ return 0;
}
+
section_data.SetData(buffer_sp);
return buffer_sp->GetByteSize();
}
diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index 86ee2122a97..95229b9934d 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -365,6 +365,12 @@ void ProcessMinidump::ReadModuleList() {
// This enables most LLDB functionality involving address-to-module
// translations (ex. identifing the module for a stack frame PC) and
// modules/sections commands (ex. target modules list, ...)
+ if (log) {
+ log->Printf("Unable to locate the matching object file, creating a "
+ "placeholder module for: %s",
+ name.getValue().c_str());
+ }
+
auto placeholder_module =
std::make_shared<PlaceholderModule>(module_spec);
placeholder_module->CreateImageSection(module, GetTarget());
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 48888bbc1e2..f3c07832654 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -5842,7 +5842,7 @@ void Process::ModulesDidLoad(ModuleList &module_list) {
// that loaded.
// Iterate over a copy of this language runtime list in case the language
- // runtime ModulesDidLoad somehow causes the language riuntime to be
+ // runtime ModulesDidLoad somehow causes the language runtime to be
// unloaded.
LanguageRuntimeCollection language_runtimes(m_language_runtimes);
for (const auto &pair : language_runtimes) {
@@ -6095,7 +6095,7 @@ void Process::MapSupportedStructuredDataPlugins(
// For each StructuredDataPlugin, if the plugin handles any of the types in
// the supported_type_names, map that type name to that plugin. Stop when
// we've consumed all the type names.
- // FIXME: should we return an error if there are type names nobody
+ // FIXME: should we return an error if there are type names nobody
// supports?
for (uint32_t plugin_index = 0; !const_type_names.empty(); plugin_index++) {
auto create_instance =
@@ -6103,7 +6103,7 @@ void Process::MapSupportedStructuredDataPlugins(
plugin_index);
if (!create_instance)
break;
-
+
// Create the plugin.
StructuredDataPluginSP plugin_sp = (*create_instance)(*this);
if (!plugin_sp) {
OpenPOWER on IntegriCloud