summaryrefslogtreecommitdiff
path: root/source/Host/common/Symbols.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Host/common/Symbols.cpp')
-rw-r--r--source/Host/common/Symbols.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/source/Host/common/Symbols.cpp b/source/Host/common/Symbols.cpp
index e7bdf084d385a..3f70fdc4bf951 100644
--- a/source/Host/common/Symbols.cpp
+++ b/source/Host/common/Symbols.cpp
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "lldb/Host/Symbols.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/DataBuffer.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
@@ -109,25 +109,25 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
// Remove the binary name from the FileSpec
parent_dirs.RemoveLastPathComponent();
- // Add a ".dSYM" name to each directory component of the path, stripping
- // off components. e.g. we may have a binary like
+ // Add a ".dSYM" name to each directory component of the path,
+ // stripping off components. e.g. we may have a binary like
// /S/L/F/Foundation.framework/Versions/A/Foundation
// and
// /S/L/F/Foundation.framework.dSYM
//
// so we'll need to start with /S/L/F/Foundation.framework/Versions/A,
// add the .dSYM part to the "A", and if that doesn't exist, strip off
- // the "A" and try it again with "Versions", etc., until we find a dSYM
- // bundle or we've stripped off enough path components that there's no
- // need to continue.
+ // the "A" and try it again with "Versions", etc., until we find a
+ // dSYM bundle or we've stripped off enough path components that
+ // there's no need to continue.
for (int i = 0; i < 4; i++) {
- // Does this part of the path have a "." character - could it be a bundle's
- // top level directory?
+ // Does this part of the path have a "." character - could it be a
+ // bundle's top level directory?
const char *fn = parent_dirs.GetFilename().AsCString();
if (fn == nullptr)
- break;
- if (::strchr (fn, '.') != nullptr) {
+ break;
+ if (::strchr(fn, '.') != nullptr) {
dsym_fspec = parent_dirs;
dsym_fspec.RemoveLastPathComponent();
@@ -140,16 +140,17 @@ static bool LocateDSYMInVincinityOfExecutable(const ModuleSpec &module_spec,
dsym_fspec.AppendPathComponent("Contents");
dsym_fspec.AppendPathComponent("Resources");
dsym_fspec.AppendPathComponent("DWARF");
- dsym_fspec.AppendPathComponent(exec_fspec->GetFilename().AsCString());
+ dsym_fspec.AppendPathComponent(
+ exec_fspec->GetFilename().AsCString());
if (dsym_fspec.Exists() &&
- FileAtPathContainsArchAndUUID(
- dsym_fspec, module_spec.GetArchitecturePtr(),
- module_spec.GetUUIDPtr())) {
- if (log) {
- log->Printf("dSYM with matching UUID & arch found at %s",
- dsym_fspec.GetPath().c_str());
- }
- return true;
+ FileAtPathContainsArchAndUUID(
+ dsym_fspec, module_spec.GetArchitecturePtr(),
+ module_spec.GetUUIDPtr())) {
+ if (log) {
+ log->Printf("dSYM with matching UUID & arch found at %s",
+ dsym_fspec.GetPath().c_str());
+ }
+ return true;
}
}
parent_dirs.RemoveLastPathComponent();
@@ -231,7 +232,8 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
#ifndef LLVM_ON_WIN32
#if defined(__NetBSD__)
// Add /usr/libdata/debug directory.
- debug_file_search_paths.AppendIfUnique(FileSpec("/usr/libdata/debug", true));
+ debug_file_search_paths.AppendIfUnique(
+ FileSpec("/usr/libdata/debug", true));
#else
// Add /usr/lib/debug directory.
debug_file_search_paths.AppendIfUnique(FileSpec("/usr/lib/debug", true));
@@ -285,7 +287,11 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
if (num_specs == 1) {
ModuleSpec mspec;
if (specs.GetModuleSpecAtIndex(0, mspec)) {
- if (mspec.GetUUID() == module_uuid)
+ // Skip the uuids check if module_uuid is invalid.
+ // For example, this happens for *.dwp files since
+ // at the moment llvm-dwp doesn't output build ids,
+ // nor does binutils dwp.
+ if (!module_uuid.IsValid() || module_uuid == mspec.GetUUID())
return file_spec;
}
}