[Lldb-commits] [lldb] r342633 - [NFC] Turn "load dependent files" boolean into an enum
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Sep 20 02:09:06 PDT 2018
Author: jdevlieghere
Date: Thu Sep 20 02:09:05 2018
New Revision: 342633
URL: http://llvm.org/viewvc/llvm-project?rev=342633&view=rev
Log:
[NFC] Turn "load dependent files" boolean into an enum
This is an NFC commit to refactor the "load dependent files" parameter
from a boolean to an enum value. We want to be able to specify a
default, in which case we decide whether or not to load the dependent
files based on whether the target is an executable or not (i.e. a
dylib).
This is a dependency for D51934.
Differential revision: https://reviews.llvm.org/D51859
Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/TargetList.h
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Core/DynamicLoader.cpp
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Process.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/tools/lldb-test/lldb-test.cpp
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Thu Sep 20 02:09:05 2018
@@ -61,6 +61,12 @@ typedef enum LoadCWDlldbinitFile {
eLoadCWDlldbinitWarn
} LoadCWDlldbinitFile;
+typedef enum LoadDependentFiles {
+ eLoadDependentsDefault,
+ eLoadDependentsYes,
+ eLoadDependentsNo,
+} LoadDependentFiles;
+
//----------------------------------------------------------------------
// TargetProperties
//----------------------------------------------------------------------
@@ -682,7 +688,6 @@ public:
const BreakpointOptions &options,
const BreakpointName::Permissions &permissions);
void ApplyNameToBreakpoints(BreakpointName &bp_name);
-
// This takes ownership of the name obj passed in.
void AddBreakpointName(BreakpointName *bp_name);
@@ -770,9 +775,9 @@ public:
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
/// returned.
//------------------------------------------------------------------
- lldb::addr_t GetOpcodeLoadAddress(
- lldb::addr_t load_addr,
- AddressClass addr_class = AddressClass::eInvalid) const;
+ lldb::addr_t
+ GetOpcodeLoadAddress(lldb::addr_t load_addr,
+ AddressClass addr_class = AddressClass::eInvalid) const;
// Get load_addr as breakable load address for this target. Take a addr and
// check if for any reason there is a better address than this to put a
@@ -843,14 +848,16 @@ public:
/// A shared pointer reference to the module that will become
/// the main executable for this process.
///
- /// @param[in] get_dependent_files
+ /// @param[in] load_dependent_files
/// If \b true then ask the object files to track down any
/// known dependent files.
///
/// @see ObjectFile::GetDependentModules (FileSpecList&)
/// @see Process::GetImages()
//------------------------------------------------------------------
- void SetExecutableModule(lldb::ModuleSP &module_sp, bool get_dependent_files);
+ void SetExecutableModule(
+ lldb::ModuleSP &module_sp,
+ LoadDependentFiles load_dependent_files = eLoadDependentsDefault);
bool LoadScriptingResources(std::list<Status> &errors,
Stream *feedback_stream = nullptr,
Modified: lldb/trunk/include/lldb/Target/TargetList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/TargetList.h?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/TargetList.h (original)
+++ lldb/trunk/include/lldb/Target/TargetList.h Thu Sep 20 02:09:05 2018
@@ -92,7 +92,8 @@ public:
/// An error object that indicates success or failure
//------------------------------------------------------------------
Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
- llvm::StringRef triple_str, bool get_dependent_modules,
+ llvm::StringRef triple_str,
+ LoadDependentFiles get_dependent_modules,
const OptionGroupPlatform *platform_options,
lldb::TargetSP &target_sp);
@@ -103,7 +104,8 @@ public:
/// platform you will be using
//------------------------------------------------------------------
Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path,
- const ArchSpec &arch, bool get_dependent_modules,
+ const ArchSpec &arch,
+ LoadDependentFiles get_dependent_modules,
lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp);
//------------------------------------------------------------------
@@ -217,12 +219,13 @@ private:
Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
llvm::StringRef triple_str,
- bool get_dependent_files,
+ LoadDependentFiles load_dependent_files,
const OptionGroupPlatform *platform_options,
lldb::TargetSP &target_sp, bool is_dummy_target);
Status CreateTargetInternal(Debugger &debugger, llvm::StringRef user_exe_path,
- const ArchSpec &arch, bool get_dependent_modules,
+ const ArchSpec &arch,
+ LoadDependentFiles get_dependent_modules,
lldb::PlatformSP &platform_sp,
lldb::TargetSP &target_sp, bool is_dummy_target);
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Thu Sep 20 02:09:05 2018
@@ -558,7 +558,8 @@ lldb::SBTarget SBDebugger::CreateTarget(
platform_options.SetPlatformName(platform_name);
sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, target_triple, add_dependent_modules,
+ *m_opaque_sp, filename, target_triple,
+ add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo,
&platform_options, target_sp);
if (sb_error.Success())
@@ -587,7 +588,8 @@ SBDebugger::CreateTargetWithFileAndTarge
if (m_opaque_sp) {
const bool add_dependent_modules = true;
Status error(m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, target_triple, add_dependent_modules, nullptr,
+ *m_opaque_sp, filename, target_triple,
+ add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
target_sp));
sb_target.SetSP(target_sp);
}
@@ -613,7 +615,8 @@ SBTarget SBDebugger::CreateTargetWithFil
const bool add_dependent_modules = true;
error = m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, arch_cstr, add_dependent_modules, nullptr,
+ *m_opaque_sp, filename, arch_cstr,
+ add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
target_sp);
if (error.Success()) {
@@ -638,7 +641,9 @@ SBTarget SBDebugger::CreateTarget(const
Status error;
const bool add_dependent_modules = true;
error = m_opaque_sp->GetTargetList().CreateTarget(
- *m_opaque_sp, filename, "", add_dependent_modules, nullptr, target_sp);
+ *m_opaque_sp, filename, "",
+ add_dependent_modules ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
+ target_sp);
if (error.Success()) {
m_opaque_sp->GetTargetList().SetSelectedTarget(target_sp.get());
Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Sep 20 02:09:05 2018
@@ -459,7 +459,7 @@ protected:
Status error;
error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(
- m_interpreter.GetDebugger(), "", "", false,
+ m_interpreter.GetDebugger(), "", "", eLoadDependentsNo,
nullptr, // No platform options
new_target_sp);
target = new_target_sp.get();
Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Sep 20 02:09:05 2018
@@ -262,7 +262,8 @@ protected:
const bool get_dependent_files =
m_add_dependents.GetOptionValue().GetCurrentValue();
Status error(debugger.GetTargetList().CreateTarget(
- debugger, file_path, arch_cstr, get_dependent_files, nullptr,
+ debugger, file_path, arch_cstr,
+ get_dependent_files ? eLoadDependentsYes : eLoadDependentsNo, nullptr,
target_sp));
if (target_sp) {
Modified: lldb/trunk/source/Core/DynamicLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DynamicLoader.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Core/DynamicLoader.cpp (original)
+++ lldb/trunk/source/Core/DynamicLoader.cpp Thu Sep 20 02:09:05 2018
@@ -101,8 +101,7 @@ ModuleSP DynamicLoader::GetTargetExecuta
if (executable.get() != target.GetExecutableModulePointer()) {
// Don't load dependent images since we are in dyld where we will
// know and find out about all images that are loaded
- const bool get_dependent_images = false;
- target.SetExecutableModule(executable, get_dependent_images);
+ target.SetExecutableModule(executable, eLoadDependentsNo);
}
}
}
Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Sep 20 02:09:05 2018
@@ -848,7 +848,7 @@ bool DynamicLoaderDarwinKernel::KextImag
target.GetImages().AppendIfNeeded(m_module_sp);
if (IsKernel() &&
target.GetExecutableModulePointer() != m_module_sp.get()) {
- target.SetExecutableModule(m_module_sp, false);
+ target.SetExecutableModule(m_module_sp, eLoadDependentsNo);
}
}
}
Modified: lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp Thu Sep 20 02:09:05 2018
@@ -205,8 +205,7 @@ ModuleSP DynamicLoaderHexagonDYLD::GetTa
if (executable.get() != target.GetExecutableModulePointer()) {
// Don't load dependent images since we are in dyld where we will know and
// find out about all images that are loaded
- const bool get_dependent_images = false;
- target.SetExecutableModule(executable, get_dependent_images);
+ target.SetExecutableModule(executable, eLoadDependentsNo);
}
return executable;
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Thu Sep 20 02:09:05 2018
@@ -555,8 +555,7 @@ void DynamicLoaderDarwin::UpdateSpecialB
target.GetImages().AppendIfNeeded(exe_module_sp);
UpdateImageLoadAddress(exe_module_sp.get(), image_infos[exe_idx]);
if (exe_module_sp.get() != target.GetExecutableModulePointer()) {
- const bool get_dependent_images = false;
- target.SetExecutableModule(exe_module_sp, get_dependent_images);
+ target.SetExecutableModule(exe_module_sp, eLoadDependentsNo);
}
}
}
Modified: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp Thu Sep 20 02:09:05 2018
@@ -975,9 +975,8 @@ void DynamicLoaderMacOSXDYLD::UpdateImag
// re-add it back to make sure it is always in the list.
ModuleSP dyld_module_sp(GetDYLDModule());
- const bool get_dependent_images = false;
m_process->GetTarget().SetExecutableModule(exe_module_sp,
- get_dependent_images);
+ eLoadDependentsNo);
if (dyld_module_sp) {
if (target.GetImages().AppendIfNeeded(dyld_module_sp)) {
Modified: lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp Thu Sep 20 02:09:05 2018
@@ -756,7 +756,7 @@ void DynamicLoaderPOSIXDYLD::ResolveExec
return;
}
- target.SetExecutableModule(module_sp, false);
+ target.SetExecutableModule(module_sp, eLoadDependentsNo);
}
bool DynamicLoaderPOSIXDYLD::AlwaysRelyOnEHUnwindInfo(
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Thu Sep 20 02:09:05 2018
@@ -274,9 +274,9 @@ lldb::ProcessSP PlatformFreeBSD::Attach(
TargetSP new_target_sp;
ArchSpec emptyArchSpec;
- error = debugger.GetTargetList().CreateTarget(debugger, "", emptyArchSpec,
- false, m_remote_platform_sp,
- new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", emptyArchSpec, eLoadDependentsNo, m_remote_platform_sp,
+ new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Sep 20 02:09:05 2018
@@ -302,8 +302,8 @@ PlatformLinux::DebugProcess(ProcessLaunc
if (target == nullptr) {
LLDB_LOG(log, "creating new target");
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
if (error.Fail()) {
LLDB_LOG(log, "failed to create new target: {0}", error);
return process_sp;
Modified: lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp Thu Sep 20 02:09:05 2018
@@ -271,8 +271,8 @@ PlatformNetBSD::DebugProcess(ProcessLaun
if (target == nullptr) {
LLDB_LOG(log, "creating new target");
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
if (error.Fail()) {
LLDB_LOG(log, "failed to create new target: {0}", error);
return process_sp;
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Thu Sep 20 02:09:05 2018
@@ -813,8 +813,8 @@ lldb::ProcessSP PlatformPOSIX::Attach(Pr
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- NULL, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, NULL, new_target_sp);
target = new_target_sp.get();
if (log)
log->Printf("PlatformPOSIX::%s created new target", __FUNCTION__);
Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp Thu Sep 20 02:09:05 2018
@@ -470,8 +470,8 @@ lldb::ProcessSP PlatformWindows::Attach(
FileSpec emptyFileSpec;
ArchSpec emptyArchSpec;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
target = new_target_sp.get();
}
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Thu Sep 20 02:09:05 2018
@@ -488,8 +488,8 @@ lldb::ProcessSP PlatformRemoteGDBServer:
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- NULL, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, NULL, new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
@@ -574,8 +574,8 @@ lldb::ProcessSP PlatformRemoteGDBServer:
if (target == NULL) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- NULL, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, NULL, new_target_sp);
target = new_target_sp.get();
} else
error.Clear();
Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Sep 20 02:09:05 2018
@@ -319,7 +319,7 @@ Status ProcessKDP::DoConnectRemote(Strea
// Make sure you don't already have the right module loaded
// and they will be uniqued
if (exe_module_sp.get() != module_sp.get())
- target.SetExecutableModule(module_sp, false);
+ target.SetExecutableModule(module_sp, eLoadDependentsNo);
}
}
}
Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Thu Sep 20 02:09:05 2018
@@ -254,7 +254,7 @@ Status ProcessElfCore::DoLoadCore() {
if (exe_module_spec.GetFileSpec()) {
exe_module_sp = GetTarget().GetSharedModule(exe_module_spec);
if (exe_module_sp)
- GetTarget().SetExecutableModule(exe_module_sp, false);
+ GetTarget().SetExecutableModule(exe_module_sp, eLoadDependentsNo);
}
}
}
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Sep 20 02:09:05 2018
@@ -4802,7 +4802,7 @@ size_t ProcessGDBRemote::LoadModules(Loa
return true;
lldb::ModuleSP module_copy_sp = module_sp;
- target.SetExecutableModule(module_copy_sp, false);
+ target.SetExecutableModule(module_copy_sp, eLoadDependentsNo);
return false;
});
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Sep 20 02:09:05 2018
@@ -1822,8 +1822,8 @@ lldb::ProcessSP Platform::ConnectProcess
if (!target) {
TargetSP new_target_sp;
- error = debugger.GetTargetList().CreateTarget(debugger, "", "", false,
- nullptr, new_target_sp);
+ error = debugger.GetTargetList().CreateTarget(
+ debugger, "", "", eLoadDependentsNo, nullptr, new_target_sp);
target = new_target_sp.get();
}
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Sep 20 02:09:05 2018
@@ -3215,7 +3215,8 @@ void Process::CompleteAttach() {
}
}
if (new_executable_module_sp) {
- GetTarget().SetExecutableModule(new_executable_module_sp, false);
+ GetTarget().SetExecutableModule(new_executable_module_sp,
+ eLoadDependentsNo);
if (log) {
ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
log->Printf(
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Thu Sep 20 02:09:05 2018
@@ -1422,7 +1422,7 @@ void Target::DidExec() {
}
void Target::SetExecutableModule(ModuleSP &executable_sp,
- bool get_dependent_files) {
+ LoadDependentFiles load_dependent_files) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TARGET));
ClearModules(false);
@@ -1446,8 +1446,20 @@ void Target::SetExecutableModule(ModuleS
FileSpecList dependent_files;
ObjectFile *executable_objfile = executable_sp->GetObjectFile();
+ bool load_dependens;
+ switch (load_dependent_files) {
+ case eLoadDependentsDefault:
+ load_dependens = executable_sp->IsExecutable();
+ break;
+ case eLoadDependentsYes:
+ load_dependens = true;
+ break;
+ case eLoadDependentsNo:
+ load_dependens = false;
+ break;
+ }
- if (executable_objfile && get_dependent_files) {
+ if (executable_objfile && load_dependens) {
executable_objfile->GetDependentModules(dependent_files);
for (uint32_t i = 0; i < dependent_files.GetSize(); i++) {
FileSpec dependent_file_spec(
@@ -1552,7 +1564,7 @@ bool Target::SetArchitecture(const ArchS
nullptr, nullptr);
if (!error.Fail() && executable_sp) {
- SetExecutableModule(executable_sp, true);
+ SetExecutableModule(executable_sp, eLoadDependentsYes);
return true;
}
}
@@ -2122,7 +2134,7 @@ void Target::ImageSearchPathsChanged(con
Target *target = (Target *)baton;
ModuleSP exe_module_sp(target->GetExecutableModule());
if (exe_module_sp)
- target->SetExecutableModule(exe_module_sp, true);
+ target->SetExecutableModule(exe_module_sp, eLoadDependentsYes);
}
TypeSystem *Target::GetScratchTypeSystemForLanguage(Status *error,
Modified: lldb/trunk/source/Target/TargetList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/TargetList.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/source/Target/TargetList.cpp (original)
+++ lldb/trunk/source/Target/TargetList.cpp Thu Sep 20 02:09:05 2018
@@ -58,27 +58,27 @@ TargetList::~TargetList() {
Status TargetList::CreateTarget(Debugger &debugger,
llvm::StringRef user_exe_path,
llvm::StringRef triple_str,
- bool get_dependent_files,
+ LoadDependentFiles load_dependent_files,
const OptionGroupPlatform *platform_options,
TargetSP &target_sp) {
return CreateTargetInternal(debugger, user_exe_path, triple_str,
- get_dependent_files, platform_options, target_sp,
+ load_dependent_files, platform_options, target_sp,
false);
}
Status TargetList::CreateTarget(Debugger &debugger,
llvm::StringRef user_exe_path,
const ArchSpec &specified_arch,
- bool get_dependent_files,
+ LoadDependentFiles load_dependent_files,
PlatformSP &platform_sp, TargetSP &target_sp) {
return CreateTargetInternal(debugger, user_exe_path, specified_arch,
- get_dependent_files, platform_sp, target_sp,
+ load_dependent_files, platform_sp, target_sp,
false);
}
Status TargetList::CreateTargetInternal(
Debugger &debugger, llvm::StringRef user_exe_path,
- llvm::StringRef triple_str, bool get_dependent_files,
+ llvm::StringRef triple_str, LoadDependentFiles load_dependent_files,
const OptionGroupPlatform *platform_options, TargetSP &target_sp,
bool is_dummy_target) {
Status error;
@@ -292,7 +292,7 @@ Status TargetList::CreateTargetInternal(
platform_arch = arch;
error = TargetList::CreateTargetInternal(
- debugger, user_exe_path, platform_arch, get_dependent_files, platform_sp,
+ debugger, user_exe_path, platform_arch, load_dependent_files, platform_sp,
target_sp, is_dummy_target);
return error;
}
@@ -315,14 +315,14 @@ Status TargetList::CreateDummyTarget(Deb
lldb::TargetSP &target_sp) {
PlatformSP host_platform_sp(Platform::GetHostPlatform());
return CreateTargetInternal(
- debugger, (const char *)nullptr, specified_arch_name, false,
+ debugger, (const char *)nullptr, specified_arch_name, eLoadDependentsNo,
(const OptionGroupPlatform *)nullptr, target_sp, true);
}
Status TargetList::CreateTargetInternal(Debugger &debugger,
llvm::StringRef user_exe_path,
const ArchSpec &specified_arch,
- bool get_dependent_files,
+ LoadDependentFiles load_dependent_files,
lldb::PlatformSP &platform_sp,
lldb::TargetSP &target_sp,
bool is_dummy_target) {
@@ -401,7 +401,7 @@ Status TargetList::CreateTargetInternal(
return error;
}
target_sp.reset(new Target(debugger, arch, platform_sp, is_dummy_target));
- target_sp->SetExecutableModule(exe_module_sp, get_dependent_files);
+ target_sp->SetExecutableModule(exe_module_sp, load_dependent_files);
if (user_exe_path_is_bundle)
exe_module_sp->GetFileSpec().GetPath(resolved_bundle_exe_path,
sizeof(resolved_bundle_exe_path));
Modified: lldb/trunk/tools/lldb-test/lldb-test.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-test/lldb-test.cpp?rev=342633&r1=342632&r2=342633&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-test/lldb-test.cpp (original)
+++ lldb/trunk/tools/lldb-test/lldb-test.cpp Thu Sep 20 02:09:05 2018
@@ -222,10 +222,9 @@ static Error make_string_error(const cha
TargetSP opts::createTarget(Debugger &Dbg, const std::string &Filename) {
TargetSP Target;
- Status ST =
- Dbg.GetTargetList().CreateTarget(Dbg, Filename, /*triple*/ "",
- /*get_dependent_modules*/ false,
- /*platform_options*/ nullptr, Target);
+ Status ST = Dbg.GetTargetList().CreateTarget(
+ Dbg, Filename, /*triple*/ "", eLoadDependentsNo,
+ /*platform_options*/ nullptr, Target);
if (ST.Fail()) {
errs() << formatv("Failed to create target '{0}: {1}\n", Filename, ST);
exit(1);
More information about the lldb-commits
mailing list