summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-08-11 02:48:45 +0000
committerGreg Clayton <gclayton@apple.com>2011-08-11 02:48:45 +0000
commitaa149cbd863d1722f8e5263cac26b9c9f4461f57 (patch)
tree03b9bb36184a893d7fd5f3c44deb48f4046a28f9 /lldb/source
parent8e4c74bb7c515099d97a330c24a48126c3222a6d (diff)
downloadbcm5719-llvm-aa149cbd863d1722f8e5263cac26b9c9f4461f57.tar.gz
bcm5719-llvm-aa149cbd863d1722f8e5263cac26b9c9f4461f57.zip
Added the ability to remove orphaned module shared pointers from a ModuleList.
This is helping us track down some extra references to ModuleSP objects that are causing things to get kept around for too long. Added a module pointer accessor to target and change a lot of code to use it where it would be more efficient. "taret delete" can now specify "--clean=1" which will cleanup the global module list for any orphaned module in the shared module cache which can save memory and also help track down module reference leaks like we have now. llvm-svn: 137294
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/API/SBProcess.cpp2
-rw-r--r--lldb/source/API/SBTarget.cpp6
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp1
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp9
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp14
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp37
-rw-r--r--lldb/source/Core/Debugger.cpp8
-rw-r--r--lldb/source/Core/ModuleList.cpp28
-rw-r--r--lldb/source/Core/ValueObjectRegister.cpp4
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp8
-rw-r--r--lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp2
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp6
-rw-r--r--lldb/source/Target/Process.cpp11
-rw-r--r--lldb/source/Target/Target.cpp38
-rw-r--r--lldb/source/Target/TargetList.cpp8
-rw-r--r--lldb/source/Target/ThreadPlanCallFunction.cpp14
-rw-r--r--lldb/source/Target/ThreadPlanTracer.cpp8
18 files changed, 128 insertions, 82 deletions
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index 521c1a6c993..180a5afa83f 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -804,7 +804,7 @@ SBProcess::GetDescription (SBStream &description)
{
char path[PATH_MAX];
GetTarget().GetExecutable().GetPath (path, sizeof(path));
- Module *exe_module = m_opaque_sp->GetTarget().GetExecutableModule ().get();
+ Module *exe_module = m_opaque_sp->GetTarget().GetExecutableModulePointer();
const char *exe_name = NULL;
if (exe_module)
exe_name = exe_module->GetFileSpec().GetFilename().AsCString();
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 0367d65c9fb..93d3cf18688 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -459,9 +459,9 @@ SBTarget::GetExecutable ()
SBFileSpec exe_file_spec;
if (m_opaque_sp)
{
- ModuleSP exe_module_sp (m_opaque_sp->GetExecutableModule ());
- if (exe_module_sp)
- exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
+ Module *exe_module = m_opaque_sp->GetExecutableModulePointer();
+ if (exe_module)
+ exe_file_spec.SetFileSpec (exe_module->GetFileSpec());
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index de83d9f8fe7..2e894edae11 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -306,7 +306,6 @@ CommandObjectBreakpointSet::Execute
else if (!m_options.m_func_regexp.empty())
break_type = eSetTypeFunctionRegexp;
- ModuleSP module_sp = target->GetExecutableModule();
Breakpoint *bp = NULL;
FileSpec module_spec;
bool use_module = false;
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index ecc24a6a5a6..ed6c7f9a10e 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -374,17 +374,16 @@ public:
Error error;
const uint32_t argc = args.GetArgumentCount();
Target *target = m_interpreter.GetExecutionContext().target;
- ModuleSP exe_module_sp;
if (target)
{
- exe_module_sp = target->GetExecutableModule();
- if (exe_module_sp)
+ Module *exe_module = target->GetExecutableModulePointer();
+ if (exe_module)
{
- m_options.launch_info.GetExecutableFile () = exe_module_sp->GetFileSpec();
+ m_options.launch_info.GetExecutableFile () = exe_module->GetFileSpec();
char exe_path[PATH_MAX];
if (m_options.launch_info.GetExecutableFile ().GetPath (exe_path, sizeof(exe_path)))
m_options.launch_info.GetArguments().AppendArgument (exe_path);
- m_options.launch_info.GetArchitecture() = exe_module_sp->GetArchitecture();
+ m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
}
}
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 8ccdebb9b6c..2c228808147 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -162,7 +162,7 @@ public:
// If our listener is NULL, users aren't allows to launch
char filename[PATH_MAX];
- const Module *exe_module = target->GetExecutableModule().get();
+ const Module *exe_module = target->GetExecutableModulePointer();
if (exe_module == NULL)
{
@@ -762,22 +762,22 @@ public:
{
// Okay, we're done. Last step is to warn if the executable module has changed:
char new_path[PATH_MAX];
+ ModuleSP new_exec_module_sp (target->GetExecutableModule());
if (!old_exec_module_sp)
{
// We might not have a module if we attached to a raw pid...
- ModuleSP new_module_sp (target->GetExecutableModule());
- if (new_module_sp)
+ if (new_exec_module_sp)
{
- new_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
+ new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path);
}
}
- else if (old_exec_module_sp->GetFileSpec() != target->GetExecutableModule()->GetFileSpec())
+ else if (old_exec_module_sp->GetFileSpec() != new_exec_module_sp->GetFileSpec())
{
char old_path[PATH_MAX];
- old_exec_module_sp->GetFileSpec().GetPath(old_path, PATH_MAX);
- target->GetExecutableModule()->GetFileSpec().GetPath (new_path, PATH_MAX);
+ old_exec_module_sp->GetFileSpec().GetPath (old_path, PATH_MAX);
+ new_exec_module_sp->GetFileSpec().GetPath (new_path, PATH_MAX);
result.AppendWarningWithFormat("Executable module changed from \"%s\" to \"%s\".\n",
old_path, new_path);
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index e0b91692e29..a17cfc88a64 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -26,6 +26,7 @@
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionGroupArchitecture.h"
+#include "lldb/Interpreter/OptionGroupBoolean.h"
#include "lldb/Interpreter/OptionGroupFile.h"
#include "lldb/Interpreter/OptionGroupVariable.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
@@ -52,11 +53,11 @@ DumpTargetInfo (uint32_t target_idx, Target *target, const char *prefix_cstr, bo
{
const ArchSpec &target_arch = target->GetArchitecture();
- ModuleSP exe_module_sp (target->GetExecutableModule ());
+ Module *exe_module = target->GetExecutableModulePointer();
char exe_path[PATH_MAX];
bool exe_valid = false;
- if (exe_module_sp)
- exe_valid = exe_module_sp->GetFileSpec().GetPath (exe_path, sizeof(exe_path));
+ if (exe_module)
+ exe_valid = exe_module->GetFileSpec().GetPath (exe_path, sizeof(exe_path));
if (!exe_valid)
::strcpy (exe_path, "<none>");
@@ -410,12 +411,16 @@ class CommandObjectTargetDelete : public CommandObject
{
public:
CommandObjectTargetDelete (CommandInterpreter &interpreter) :
- CommandObject (interpreter,
- "target delete",
- "Delete one or more targets by target index.",
- NULL,
- 0)
+ CommandObject (interpreter,
+ "target delete",
+ "Delete one or more targets by target index.",
+ NULL,
+ 0),
+ m_option_group (interpreter),
+ m_cleanup_option (LLDB_OPT_SET_1, false, "clean", 'c', 0, eArgTypeNone, "Perform extra cleanup to minimize memory consumption after deleting the target.", false)
{
+ m_option_group.Append (&m_cleanup_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+ m_option_group.Finalize();
}
virtual
@@ -487,12 +492,28 @@ public:
target_list.DeleteTarget(target_sp);
target_sp->Destroy();
}
+ // If "--clean" was specified, prune any orphaned shared modules from
+ // the global shared module list
+ if (m_cleanup_option.GetOptionValue ())
+ {
+ ModuleList::RemoveOrphanSharedModules();
+ }
result.GetOutputStream().Printf("%u targets deleted.\n", (uint32_t)num_targets_to_delete);
result.SetStatus(eReturnStatusSuccessFinishResult);
}
return result.Succeeded();
}
+
+ Options *
+ GetOptions ()
+ {
+ return &m_option_group;
+ }
+
+protected:
+ OptionGroupOptions m_option_group;
+ OptionGroupBoolean m_cleanup_option;
};
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 309afd4e87c..8d13293640e 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1256,17 +1256,17 @@ Debugger::FormatPrompt
(::strncmp (var_name_begin, "file.basename}", strlen("file.basename}")) == 0) ||
(::strncmp (var_name_begin, "file.fullpath}", strlen("file.fullpath}")) == 0))
{
- ModuleSP exe_module_sp (exe_ctx->process->GetTarget().GetExecutableModule());
- if (exe_module_sp)
+ Module *exe_module = exe_ctx->process->GetTarget().GetExecutableModulePointer();
+ if (exe_module)
{
if (var_name_begin[0] == 'n' || var_name_begin[5] == 'f')
{
- format_file_spec.GetFilename() = exe_module_sp->GetFileSpec().GetFilename();
+ format_file_spec.GetFilename() = exe_module->GetFileSpec().GetFilename();
var_success = format_file_spec;
}
else
{
- format_file_spec = exe_module_sp->GetFileSpec();
+ format_file_spec = exe_module->GetFileSpec();
var_success = format_file_spec;
}
}
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 7a4748338e9..cf83d4b4476 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -108,6 +108,28 @@ ModuleList::Remove (ModuleSP &module_sp)
return false;
}
+
+size_t
+ModuleList::RemoveOrphans ()
+{
+ Mutex::Locker locker(m_modules_mutex);
+ collection::reverse_iterator pos = m_modules.rbegin();
+ size_t remove_count = 0;
+ while (pos != m_modules.rend())
+ {
+ if (pos->unique())
+ {
+ pos = m_modules.erase (pos);
+ ++remove_count;
+ }
+ else
+ {
+ ++pos;
+ }
+ }
+ return remove_count;
+}
+
size_t
ModuleList::Remove (ModuleList &module_list)
{
@@ -680,6 +702,12 @@ ModuleList::FindSharedModules
return shared_module_list.FindModules (&in_file_spec, &arch, uuid_ptr, object_name_ptr, matching_module_list);
}
+uint32_t
+ModuleList::RemoveOrphanSharedModules ()
+{
+ return GetSharedModuleList ().RemoveOrphans();
+}
+
Error
ModuleList::GetSharedModule
(
diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp
index db3d559efa3..beada802557 100644
--- a/lldb/source/Core/ValueObjectRegister.cpp
+++ b/lldb/source/Core/ValueObjectRegister.cpp
@@ -307,7 +307,7 @@ ValueObjectRegister::GetClangType ()
Process *process = m_reg_ctx_sp->CalculateProcess ();
if (process)
{
- Module *exe_module = process->GetTarget().GetExecutableModule ().get();
+ Module *exe_module = process->GetTarget().GetExecutableModulePointer();
if (exe_module)
{
m_clang_type = exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize (m_reg_info.encoding,
@@ -338,7 +338,7 @@ ValueObjectRegister::GetClangAST ()
Process *process = m_reg_ctx_sp->CalculateProcess ();
if (process)
{
- Module *exe_module = process->GetTarget().GetExecutableModule ().get();
+ Module *exe_module = process->GetTarget().GetExecutableModulePointer();
if (exe_module)
return exe_module->GetClangASTContext().getASTContext();
}
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
index 92f359bb889..b051cb002ec 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -89,7 +89,7 @@ DynamicLoaderMacOSXDYLD::CreateInstance (Process* process, bool force)
if (!create)
{
create = true;
- Module* exe_module = process->GetTarget().GetExecutableModule().get();
+ Module* exe_module = process->GetTarget().GetExecutableModulePointer();
if (exe_module)
{
ObjectFile *object_file = exe_module->GetObjectFile();
@@ -225,7 +225,7 @@ DynamicLoaderMacOSXDYLD::LocateDYLD()
}
// Check some default values
- Module *executable = m_process->GetTarget().GetExecutableModule().get();
+ Module *executable = m_process->GetTarget().GetExecutableModulePointer();
if (executable)
{
@@ -267,7 +267,7 @@ DynamicLoaderMacOSXDYLD::FindTargetModuleForDYLDImageInfo (const DYLDImageInfo &
{
if (module_sp)
{
- if (image_info.UUIDValid())
+ if (image_info_uuid_is_valid)
{
if (module_sp->GetUUID() != image_info.uuid)
module_sp.reset();
@@ -1217,7 +1217,7 @@ DynamicLoaderMacOSXDYLD::UpdateImageInfosHeaderAndLoadCommands(DYLDImageInfo::co
if (exe_module_sp)
{
- if (exe_module_sp.get() != m_process->GetTarget().GetExecutableModule().get())
+ if (exe_module_sp.get() != m_process->GetTarget().GetExecutableModulePointer())
{
// Don't load dependent images since we are in dyld where we will know
// and find out about all images that are loaded
diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp
index 847d18e4ddf..142a6f17ae6 100644
--- a/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/MacOSX-Kernel/DynamicLoaderMacOSXKernel.cpp
@@ -52,7 +52,7 @@ DynamicLoaderMacOSXKernel::CreateInstance (Process* process, bool force)
bool create = force;
if (!create)
{
- Module* exe_module = process->GetTarget().GetExecutableModule().get();
+ Module* exe_module = process->GetTarget().GetExecutableModulePointer();
if (exe_module)
{
ObjectFile *object_file = exe_module->GetObjectFile();
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 5d4f465e2f4..401fd9a48f9 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -59,14 +59,14 @@ bool
ProcessKDP::CanDebug(Target &target, bool plugin_specified_by_name)
{
// For now we are just making sure the file exists for a given module
- ModuleSP exe_module_sp(target.GetExecutableModule());
- if (exe_module_sp.get())
+ Module *exe_module = target.GetExecutableModulePointer();
+ if (exe_module)
{
const llvm::Triple &triple_ref = target.GetArchitecture().GetTriple();
if (triple_ref.getOS() == llvm::Triple::Darwin &&
triple_ref.getVendor() == llvm::Triple::Apple)
{
- ObjectFile *exe_objfile = exe_module_sp->GetObjectFile();
+ ObjectFile *exe_objfile = exe_module->GetObjectFile();
if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
exe_objfile->GetStrata() == ObjectFile::eStrataKernel)
return true;
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 63967148cb5..558a02aeaae 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -104,9 +104,9 @@ bool
ProcessGDBRemote::CanDebug (Target &target, bool plugin_specified_by_name)
{
// For now we are just making sure the file exists for a given module
- ModuleSP exe_module_sp(target.GetExecutableModule());
- if (exe_module_sp.get())
- return exe_module_sp->GetFileSpec().Exists();
+ Module *exe_module = target.GetExecutableModulePointer();
+ if (exe_module)
+ return exe_module->GetFileSpec().Exists();
// However, if there is no executable module, we return true since we might be preparing to attach.
return true;
}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index a81b68b158f..9876d72f8d7 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2019,7 +2019,7 @@ Process::Launch
m_dyld_ap.reset();
m_process_input_reader.reset();
- Module *exe_module = m_target.GetExecutableModule().get();
+ Module *exe_module = m_target.GetExecutableModulePointer();
if (exe_module)
{
char local_exec_file_path[PATH_MAX];
@@ -2327,8 +2327,7 @@ Process::CompleteAttach ()
ModuleSP module_sp (modules.GetModuleAtIndex(i));
if (module_sp && module_sp->IsExecutable())
{
- ModuleSP target_exe_module_sp (m_target.GetExecutableModule());
- if (target_exe_module_sp != module_sp)
+ if (m_target.GetExecutableModulePointer() != module_sp.get())
m_target.SetExecutableModule (module_sp, false);
break;
}
@@ -3319,11 +3318,11 @@ Process::GetSettingsController ()
void
Process::UpdateInstanceName ()
{
- ModuleSP module_sp = GetTarget().GetExecutableModule();
- if (module_sp)
+ Module *module = GetTarget().GetExecutableModulePointer();
+ if (module)
{
StreamString sstr;
- sstr.Printf ("%s", module_sp->GetFileSpec().GetFilename().AsCString());
+ sstr.Printf ("%s", module->GetFileSpec().GetFilename().AsCString());
GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
sstr.GetData());
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index e65f2d1cc53..600a06bc137 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -98,8 +98,9 @@ Target::Dump (Stream *s, lldb::DescriptionLevel description_level)
}
else
{
- if (GetExecutableModule())
- s->PutCString (GetExecutableModule()->GetFileSpec().GetFilename().GetCString());
+ Module *exe_module = GetExecutableModulePointer();
+ if (exe_module)
+ s->PutCString (exe_module->GetFileSpec().GetFilename().GetCString());
else
s->PutCString ("No executable module.");
}
@@ -437,10 +438,13 @@ Target::EnableBreakpointByID (break_id_t break_id)
ModuleSP
Target::GetExecutableModule ()
{
- ModuleSP executable_sp;
- if (m_images.GetSize() > 0)
- executable_sp = m_images.GetModuleAtIndex(0);
- return executable_sp;
+ return m_images.GetModuleAtIndex(0);
+}
+
+Module*
+Target::GetExecutableModulePointer ()
+{
+ return m_images.GetModulePointerAtIndex(0);
}
void
@@ -915,14 +919,11 @@ Target::ImageSearchPathsChanged
)
{
Target *target = (Target *)baton;
- if (target->m_images.GetSize() > 1)
+ ModuleSP exe_module_sp (target->GetExecutableModule());
+ if (exe_module_sp)
{
- ModuleSP exe_module_sp (target->GetExecutableModule());
- if (exe_module_sp)
- {
- target->m_images.Clear();
- target->SetExecutableModule (exe_module_sp, true);
- }
+ target->m_images.Clear();
+ target->SetExecutableModule (exe_module_sp, true);
}
}
@@ -1013,14 +1014,13 @@ Target::UpdateInstanceName ()
{
StreamString sstr;
- ModuleSP module_sp = GetExecutableModule();
- if (module_sp)
+ Module *exe_module = GetExecutableModulePointer();
+ if (exe_module)
{
sstr.Printf ("%s_%s",
- module_sp->GetFileSpec().GetFilename().AsCString(),
- module_sp->GetArchitecture().GetArchitectureName());
- GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(),
- sstr.GetData());
+ exe_module->GetFileSpec().GetFilename().AsCString(),
+ exe_module->GetArchitecture().GetArchitectureName());
+ GetSettingsController()->RenameInstanceSettings (GetInstanceName().AsCString(), sstr.GetData());
}
}
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 18b05e62995..e8a8ba906a3 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -148,15 +148,15 @@ TargetList::FindTargetWithExecutableAndArchitecture
collection::const_iterator pos, end = m_target_list.end();
for (pos = m_target_list.begin(); pos != end; ++pos)
{
- ModuleSP module_sp ((*pos)->GetExecutableModule());
+ Module *exe_module = (*pos)->GetExecutableModulePointer();
- if (module_sp)
+ if (exe_module)
{
- if (FileSpec::Equal (exe_file_spec, module_sp->GetFileSpec(), full_match))
+ if (FileSpec::Equal (exe_file_spec, exe_module->GetFileSpec(), full_match))
{
if (exe_arch_ptr)
{
- if (*exe_arch_ptr != module_sp->GetArchitecture())
+ if (*exe_arch_ptr != exe_module->GetArchitecture())
continue;
}
target_sp = *pos;
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp
index 8ec93b98735..d2bd858c6dd 100644
--- a/lldb/source/Target/ThreadPlanCallFunction.cpp
+++ b/lldb/source/Target/ThreadPlanCallFunction.cpp
@@ -65,9 +65,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
- ModuleSP executableModuleSP (target.GetExecutableModule());
+ Module *exe_module = target.GetExecutableModulePointer();
- if (!executableModuleSP)
+ if (exe_module == NULL)
{
if (log)
log->Printf ("Can't execute code without an executable module.");
@@ -75,7 +75,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
}
else
{
- ObjectFile *objectFile = executableModuleSP->GetObjectFile();
+ ObjectFile *objectFile = exe_module->GetObjectFile();
if (!objectFile)
{
if (log)
@@ -181,9 +181,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
m_function_sp = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
- ModuleSP executableModuleSP (target.GetExecutableModule());
+ Module *exe_module = target.GetExecutableModulePointer();
- if (!executableModuleSP)
+ if (exe_module == NULL)
{
if (log)
log->Printf ("Can't execute code without an executable module.");
@@ -191,7 +191,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
}
else
{
- ObjectFile *objectFile = executableModuleSP->GetObjectFile();
+ ObjectFile *objectFile = exe_module->GetObjectFile();
if (!objectFile)
{
if (log)
@@ -204,7 +204,7 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
{
if (log)
log->Printf ("Could not find entry point address for executable module \"%s\".",
- executableModuleSP->GetFileSpec().GetFilename().AsCString());
+ exe_module->GetFileSpec().GetFilename().AsCString());
return;
}
}
diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp
index 88564271ff5..177fdab7d1e 100644
--- a/lldb/source/Target/ThreadPlanTracer.cpp
+++ b/lldb/source/Target/ThreadPlanTracer.cpp
@@ -117,12 +117,12 @@ ThreadPlanAssemblyTracer::InitializeTracer()
m_abi = process.GetABI().get();
- ModuleSP exe_module_sp (target.GetExecutableModule());
+ Module *exe_module = target.GetExecutableModulePointer();
- if (exe_module_sp)
+ if (exe_module)
{
- m_intptr_type = TypeFromUser(exe_module_sp->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
- exe_module_sp->GetClangASTContext().getASTContext());
+ m_intptr_type = TypeFromUser(exe_module->GetClangASTContext().GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, arch.GetAddressByteSize() * 8),
+ exe_module->GetClangASTContext().getASTContext());
}
const unsigned int buf_size = 32;
OpenPOWER on IntegriCloud