This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d796b48e4d4: [lldb][NFCI] Methods to load scripting
resources should take a Stream by… (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154883/new/
https://reviews.llvm.org/D154883
Files:
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/Target.h
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/source/Target/Platform.cpp
lldb/source/Target/Target.cpp
Index: lldb/source/Target/Target.cpp
===================================================================
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -1393,8 +1393,8 @@
Target *target) {
Status error;
StreamString feedback_stream;
- if (module_sp && !module_sp->LoadScriptingResourceInTarget(
- target, error, &feedback_stream)) {
+ if (module_sp && !module_sp->LoadScriptingResourceInTarget(target, error,
+ feedback_stream)) {
if (error.AsCString())
target->GetDebugger().GetErrorStream().Printf(
"unable to load scripting data for module %s - error reported was "
Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -158,7 +158,7 @@
FileSpecList
Platform::LocateExecutableScriptingResources(Target *target, Module &module,
- Stream *feedback_stream) {
+ Stream &feedback_stream) {
return FileSpecList();
}
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -69,7 +69,7 @@
FileSpecList
LocateExecutableScriptingResources(Target *target, Module &module,
- Stream *feedback_stream) override;
+ Stream &feedback_stream) override;
Status GetSharedModule(const ModuleSpec &module_spec, Process *process,
lldb::ModuleSP &module_sp,
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -194,7 +194,7 @@
}
FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
- Target *target, Module &module, Stream *feedback_stream) {
+ Target *target, Module &module, Stream &feedback_stream) {
FileSpecList file_list;
if (target &&
target->GetDebugger().GetScriptLanguage() == eScriptLanguagePython) {
@@ -266,33 +266,31 @@
// if we did some replacements of reserved characters, and a
// file with the untampered name exists, then warn the user
// that the file as-is shall not be loaded
- if (feedback_stream) {
- if (module_basename != original_module_basename &&
- FileSystem::Instance().Exists(orig_script_fspec)) {
- const char *reason_for_complaint =
- was_keyword ? "conflicts with a keyword"
- : "contains reserved characters";
- if (FileSystem::Instance().Exists(script_fspec))
- feedback_stream->Printf(
- "warning: the symbol file '%s' contains a debug "
- "script. However, its name"
- " '%s' %s and as such cannot be loaded. LLDB will"
- " load '%s' instead. Consider removing the file with "
- "the malformed name to"
- " eliminate this warning.\n",
- symfile_spec.GetPath().c_str(),
- original_path_string.GetData(), reason_for_complaint,
- path_string.GetData());
- else
- feedback_stream->Printf(
- "warning: the symbol file '%s' contains a debug "
- "script. However, its name"
- " %s and as such cannot be loaded. If you intend"
- " to have this script loaded, please rename '%s' to "
- "'%s' and retry.\n",
- symfile_spec.GetPath().c_str(), reason_for_complaint,
- original_path_string.GetData(), path_string.GetData());
- }
+ if (module_basename != original_module_basename &&
+ FileSystem::Instance().Exists(orig_script_fspec)) {
+ const char *reason_for_complaint =
+ was_keyword ? "conflicts with a keyword"
+ : "contains reserved characters";
+ if (FileSystem::Instance().Exists(script_fspec))
+ feedback_stream.Printf(
+ "warning: the symbol file '%s' contains a debug "
+ "script. However, its name"
+ " '%s' %s and as such cannot be loaded. LLDB will"
+ " load '%s' instead. Consider removing the file with "
+ "the malformed name to"
+ " eliminate this warning.\n",
+ symfile_spec.GetPath().c_str(),
+ original_path_string.GetData(), reason_for_complaint,
+ path_string.GetData());
+ else
+ feedback_stream.Printf(
+ "warning: the symbol file '%s' contains a debug "
+ "script. However, its name"
+ " %s and as such cannot be loaded. If you intend"
+ " to have this script loaded, please rename '%s' to "
+ "'%s' and retry.\n",
+ symfile_spec.GetPath().c_str(), reason_for_complaint,
+ original_path_string.GetData(), path_string.GetData());
}
if (FileSystem::Instance().Exists(script_fspec)) {
Index: lldb/source/Core/ModuleList.cpp
===================================================================
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -1028,7 +1028,7 @@
bool ModuleList::LoadScriptingResourcesInTarget(Target *target,
std::list<Status> &errors,
- Stream *feedback_stream,
+ Stream &feedback_stream,
bool continue_on_error) {
if (!target)
return false;
Index: lldb/source/Core/Module.cpp
===================================================================
--- lldb/source/Core/Module.cpp
+++ lldb/source/Core/Module.cpp
@@ -1499,7 +1499,7 @@
}
bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
- Stream *feedback_stream) {
+ Stream &feedback_stream) {
if (!target) {
error.SetErrorString("invalid destination Target");
return false;
@@ -1534,17 +1534,16 @@
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;
Index: lldb/source/Core/Debugger.cpp
===================================================================
--- lldb/source/Core/Debugger.cpp
+++ lldb/source/Core/Debugger.cpp
@@ -248,7 +248,7 @@
eLoadScriptFromSymFileTrue) {
std::list<Status> errors;
StreamString feedback_stream;
- if (!target_sp->LoadScriptingResources(errors, &feedback_stream)) {
+ if (!target_sp->LoadScriptingResources(errors, feedback_stream)) {
Stream &s = GetErrorStream();
for (auto error : errors) {
s.Printf("%s\n", error.AsCString());
Index: lldb/source/Commands/CommandObjectTarget.cpp
===================================================================
--- lldb/source/Commands/CommandObjectTarget.cpp
+++ lldb/source/Commands/CommandObjectTarget.cpp
@@ -4219,7 +4219,7 @@
Status error;
StreamString feedback_stream;
module_sp->LoadScriptingResourceInTarget(target, error,
- &feedback_stream);
+ feedback_stream);
if (error.Fail() && error.AsCString())
result.AppendWarningWithFormat(
"unable to load scripting data for module %s - error "
Index: lldb/include/lldb/Target/Target.h
===================================================================
--- lldb/include/lldb/Target/Target.h
+++ lldb/include/lldb/Target/Target.h
@@ -939,7 +939,7 @@
LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
bool LoadScriptingResources(std::list<Status> &errors,
- Stream *feedback_stream = nullptr,
+ Stream &feedback_stream,
bool continue_on_error = true) {
return m_images.LoadScriptingResourcesInTarget(
this, errors, feedback_stream, continue_on_error);
Index: lldb/include/lldb/Target/Platform.h
===================================================================
--- lldb/include/lldb/Target/Platform.h
+++ lldb/include/lldb/Target/Platform.h
@@ -286,7 +286,7 @@
// current computers global settings.
virtual FileSpecList
LocateExecutableScriptingResources(Target *target, Module &module,
- Stream *feedback_stream);
+ Stream &feedback_stream);
virtual Status GetSharedModule(
const ModuleSpec &module_spec, Process *process,
Index: lldb/include/lldb/Core/ModuleList.h
===================================================================
--- lldb/include/lldb/Core/ModuleList.h
+++ lldb/include/lldb/Core/ModuleList.h
@@ -440,7 +440,7 @@
bool IsEmpty() const { return !GetSize(); }
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
- Stream *feedback_stream = nullptr,
+ Stream &feedback_stream,
bool continue_on_error = true);
static ModuleListProperties &GetGlobalModuleListProperties();
Index: lldb/include/lldb/Core/Module.h
===================================================================
--- lldb/include/lldb/Core/Module.h
+++ lldb/include/lldb/Core/Module.h
@@ -563,7 +563,7 @@
bool IsLoadedInTarget(Target *target);
bool LoadScriptingResourceInTarget(Target *target, Status &error,
- Stream *feedback_stream = nullptr);
+ Stream &feedback_stream);
/// Get the number of compile units for this module.
///
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits