aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Core/Module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/lldb/source/Core/Module.cpp')
-rw-r--r--contrib/llvm-project/lldb/source/Core/Module.cpp79
1 files changed, 52 insertions, 27 deletions
diff --git a/contrib/llvm-project/lldb/source/Core/Module.cpp b/contrib/llvm-project/lldb/source/Core/Module.cpp
index 8f9defabd76f..672d86496bde 100644
--- a/contrib/llvm-project/lldb/source/Core/Module.cpp
+++ b/contrib/llvm-project/lldb/source/Core/Module.cpp
@@ -12,7 +12,6 @@
#include "lldb/Core/AddressResolverFileLine.h"
#include "lldb/Core/DataFileCache.h"
#include "lldb/Core/Debugger.h"
-#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/SearchFilter.h"
@@ -39,6 +38,7 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/FileSpecList.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
@@ -748,8 +748,7 @@ bool Module::LookupInfo::NameMatchesLookupInfo(
// relatively inexpensive since no demangling is actually occuring. See
// Mangled::SetValue for more context.
const bool function_name_may_be_mangled =
- Mangled::GetManglingScheme(function_name.GetStringRef()) !=
- Mangled::eManglingSchemeNone;
+ Mangled::GetManglingScheme(function_name) != Mangled::eManglingSchemeNone;
ConstString demangled_function_name = function_name;
if (function_name_may_be_mangled) {
Mangled mangled_function_name(function_name);
@@ -760,11 +759,10 @@ bool Module::LookupInfo::NameMatchesLookupInfo(
// Otherwise just check that the demangled function name contains the
// demangled user-provided name.
if (Language *language = Language::FindPlugin(language_type))
- return language->DemangledNameContainsPath(m_name.GetStringRef(),
- demangled_function_name);
+ return language->DemangledNameContainsPath(m_name, demangled_function_name);
- llvm::StringRef function_name_ref = demangled_function_name.GetStringRef();
- return function_name_ref.contains(m_name.GetStringRef());
+ llvm::StringRef function_name_ref = demangled_function_name;
+ return function_name_ref.contains(m_name);
}
void Module::LookupInfo::Prune(SymbolContextList &sc_list,
@@ -803,7 +801,7 @@ void Module::LookupInfo::Prune(SymbolContextList &sc_list,
CPlusPlusLanguage::MethodName cpp_method(full_name);
if (cpp_method.IsValid()) {
if (cpp_method.GetContext().empty()) {
- if (cpp_method.GetBasename().compare(m_name.GetStringRef()) != 0) {
+ if (cpp_method.GetBasename().compare(m_name) != 0) {
sc_list.RemoveContextAtIndex(i);
continue;
}
@@ -1026,8 +1024,8 @@ void Module::FindTypes(
FindTypes_Impl(name, CompilerDeclContext(), UINT_MAX,
searched_symbol_files, typesmap);
if (exact_match) {
- typesmap.RemoveMismatchedTypes(type_scope, name.GetStringRef(),
- type_class, exact_match);
+ typesmap.RemoveMismatchedTypes(type_scope, name, type_class,
+ exact_match);
}
}
}
@@ -1049,10 +1047,38 @@ void Module::FindTypes(
symbols->FindTypes(pattern, languages, searched_symbol_files, types);
}
+static Debugger::DebuggerList
+DebuggersOwningModuleRequestingInterruption(Module &module) {
+ Debugger::DebuggerList requestors
+ = Debugger::DebuggersRequestingInterruption();
+ Debugger::DebuggerList interruptors;
+ if (requestors.empty())
+ return interruptors;
+
+ for (auto debugger_sp : requestors) {
+ if (!debugger_sp->InterruptRequested())
+ continue;
+ if (debugger_sp->GetTargetList()
+ .AnyTargetContainsModule(module))
+ interruptors.push_back(debugger_sp);
+ }
+ return interruptors;
+}
+
SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {
if (!m_did_load_symfile.load()) {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (!m_did_load_symfile.load() && can_create) {
+ Debugger::DebuggerList interruptors
+ = DebuggersOwningModuleRequestingInterruption(*this);
+ if (!interruptors.empty()) {
+ for (auto debugger_sp : interruptors) {
+ REPORT_INTERRUPTION(*(debugger_sp.get()),
+ "Interrupted fetching symbols for module {0}",
+ this->GetFileSpec());
+ }
+ return nullptr;
+ }
ObjectFile *obj_file = GetObjectFile();
if (obj_file != nullptr) {
LLDB_SCOPED_TIMER();
@@ -1132,7 +1158,7 @@ void Module::ReportWarningOptimization(
return;
StreamString ss;
- ss << file_name.GetStringRef()
+ ss << file_name
<< " was compiled with optimization - stepping may behave "
"oddly; variables may not be available.";
Debugger::ReportWarning(std::string(ss.GetString()), debugger_id,
@@ -1473,7 +1499,7 @@ bool Module::IsLoadedInTarget(Target *target) {
}
bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
- Stream *feedback_stream) {
+ Stream &feedback_stream) {
if (!target) {
error.SetErrorString("invalid destination Target");
return false;
@@ -1508,17 +1534,16 @@ bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
if (scripting_fspec &&
FileSystem::Instance().Exists(scripting_fspec)) {
if (should_load == eLoadScriptFromSymFileWarn) {
- if (feedback_stream)
- feedback_stream->Printf(
- "warning: '%s' contains a debug script. To run this script "
- "in "
- "this debug session:\n\n command script import "
- "\"%s\"\n\n"
- "To run all discovered debug scripts in this session:\n\n"
- " settings set target.load-script-from-symbol-file "
- "true\n",
- GetFileSpec().GetFileNameStrippingExtension().GetCString(),
- scripting_fspec.GetPath().c_str());
+ feedback_stream.Printf(
+ "warning: '%s' contains a debug script. To run this script "
+ "in "
+ "this debug session:\n\n command script import "
+ "\"%s\"\n\n"
+ "To run all discovered debug scripts in this session:\n\n"
+ " settings set target.load-script-from-symbol-file "
+ "true\n",
+ GetFileSpec().GetFileNameStrippingExtension().GetCString(),
+ scripting_fspec.GetPath().c_str());
return false;
}
StreamString scripting_stream;
@@ -1609,8 +1634,8 @@ std::optional<std::string> Module::RemapSourceFile(llvm::StringRef path) const {
void Module::RegisterXcodeSDK(llvm::StringRef sdk_name,
llvm::StringRef sysroot) {
- XcodeSDK sdk(sdk_name.str());
- auto sdk_path_or_err = HostInfo::GetXcodeSDKPath(sdk);
+ auto sdk_path_or_err =
+ HostInfo::GetSDKRoot(HostInfo::SDKOptions{sdk_name.str()});
if (!sdk_path_or_err) {
Debugger::ReportError("Error while searching for Xcode SDK: " +
@@ -1668,7 +1693,7 @@ uint32_t Module::Hash() {
llvm::raw_string_ostream id_strm(identifier);
id_strm << m_arch.GetTriple().str() << '-' << m_file.GetPath();
if (m_object_name)
- id_strm << '(' << m_object_name.GetStringRef() << ')';
+ id_strm << '(' << m_object_name << ')';
if (m_object_offset > 0)
id_strm << m_object_offset;
const auto mtime = llvm::sys::toTimeT(m_object_mod_time);
@@ -1682,7 +1707,7 @@ std::string Module::GetCacheKey() {
llvm::raw_string_ostream strm(key);
strm << m_arch.GetTriple().str() << '-' << m_file.GetFilename();
if (m_object_name)
- strm << '(' << m_object_name.GetStringRef() << ')';
+ strm << '(' << m_object_name << ')';
strm << '-' << llvm::format_hex(Hash(), 10);
return strm.str();
}