summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2014-11-17 19:39:20 +0000
committerGreg Clayton <gclayton@apple.com>2014-11-17 19:39:20 +0000
commit8012cadbf32335457b8a4ea85783850249ccb805 (patch)
tree4528f3cbc28b5193812febb3926688ed1d6042e6
parent41d03bc540c7240554fc8945a02fb1d03a78b626 (diff)
downloadbcm5719-llvm-8012cadbf32335457b8a4ea85783850249ccb805.tar.gz
bcm5719-llvm-8012cadbf32335457b8a4ea85783850249ccb805.zip
Fixed more fallout from running the test suite remotely on iOS devices.
Fixed include: - Change Platform::ResolveExecutable(...) to take a ModuleSpec instead of a FileSpec + ArchSpec to help resolve executables correctly when we have just a path + UUID (no arch). - Add the ability to set the listener in SBLaunchInfo and SBAttachInfo in case you don't want to use the debugger as the default listener. - Modified all places that use the SBLaunchInfo/SBAttachInfo and the internal ProcessLaunchInfo/ProcessAttachInfo to not take a listener as a parameter since it is in the launch/attach info now - Load a module's sections by default when removing a module from a target. Since we create JIT modules for expressions and helper functions, we could end up with stale data in the section load list if a module was removed from the target as the section load list would still have entries for the unloaded module. Target now has the following functions to help unload all sections a single or multiple modules: size_t Target::UnloadModuleSections (const ModuleList &module_list); size_t Target::UnloadModuleSections (const lldb::ModuleSP &module_sp); llvm-svn: 222167
-rw-r--r--lldb/include/lldb/API/SBListener.h10
-rw-r--r--lldb/include/lldb/API/SBTarget.h49
-rw-r--r--lldb/include/lldb/Target/Platform.h5
-rw-r--r--lldb/include/lldb/Target/Process.h25
-rw-r--r--lldb/include/lldb/Target/ProcessLaunchInfo.h18
-rw-r--r--lldb/include/lldb/Target/Target.h9
-rw-r--r--lldb/scripts/Python/interface/SBTarget.i12
-rw-r--r--lldb/source/API/SBListener.cpp6
-rw-r--r--lldb/source/API/SBTarget.cpp31
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp3
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp2
-rw-r--r--lldb/source/Host/macosx/Host.mm20
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp60
-rw-r--r--lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h4
-rw-r--r--lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp47
-rw-r--r--lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h5
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp61
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.h4
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp61
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h5
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp136
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h7
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp36
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h3
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp10
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h2
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp50
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.h4
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp12
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h5
-rw-r--r--lldb/source/Symbol/ClangASTContext.cpp7
-rw-r--r--lldb/source/Target/Platform.cpp16
-rw-r--r--lldb/source/Target/Process.cpp9
-rw-r--r--lldb/source/Target/ProcessLaunchInfo.cpp13
-rw-r--r--lldb/source/Target/StackFrameList.cpp15
-rw-r--r--lldb/source/Target/Target.cpp40
-rw-r--r--lldb/source/Target/TargetList.cpp4
37 files changed, 505 insertions, 301 deletions
diff --git a/lldb/include/lldb/API/SBListener.h b/lldb/include/lldb/API/SBListener.h
index 4a11ec1072f..58a8fe9a55b 100644
--- a/lldb/include/lldb/API/SBListener.h
+++ b/lldb/include/lldb/API/SBListener.h
@@ -99,13 +99,23 @@ public:
HandleBroadcastEvent (const lldb::SBEvent &event);
protected:
+ friend class SBAttachInfo;
friend class SBBroadcaster;
friend class SBCommandInterpreter;
friend class SBDebugger;
+ friend class SBLaunchInfo;
friend class SBTarget;
SBListener (lldb_private::Listener &listener);
+ SBListener (const lldb::ListenerSP &listener_sp);
+
+ lldb::ListenerSP
+ GetSP ()
+ {
+ return m_opaque_sp;
+ }
+
private:
lldb_private::Listener *
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index dd875cdf8a3..3d37c0731fe 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -51,7 +51,7 @@ public:
SBFileSpec
GetExecutableFile ();
-
+
//----------------------------------------------------------------------
/// Set the executable file that will be used to launch the process and
/// optionally set it as the first argument in the argument vector.
@@ -77,7 +77,29 @@ public:
//----------------------------------------------------------------------
void
SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
-
+
+
+ //----------------------------------------------------------------------
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ //----------------------------------------------------------------------
+ SBListener
+ GetListener ();
+
+ //----------------------------------------------------------------------
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ //----------------------------------------------------------------------
+ void
+ SetListener (SBListener &listener);
+
uint32_t
GetNumArguments ();
@@ -258,7 +280,28 @@ public:
bool
ParentProcessIDIsValid();
-
+
+ //----------------------------------------------------------------------
+ /// Get the listener that will be used to receive process events.
+ ///
+ /// If no listener has been set via a call to
+ /// SBLaunchInfo::SetListener(), then an invalid SBListener will be
+ /// returned (SBListener::IsValid() will return false). If a listener
+ /// has been set, then the valid listener object will be returned.
+ //----------------------------------------------------------------------
+ SBListener
+ GetListener ();
+
+ //----------------------------------------------------------------------
+ /// Set the listener that will be used to receive process events.
+ ///
+ /// By default the SBDebugger, which has a listener, that the SBTarget
+ /// belongs to will listen for the process events. Calling this function
+ /// allows a different listener to be used to listen for process events.
+ //----------------------------------------------------------------------
+ void
+ SetListener (SBListener &listener);
+
protected:
friend class SBTarget;
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index fa54b4a1c62..ca4e57c13bd 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -141,8 +141,7 @@ namespace lldb_private {
/// a suitable executable, \b false otherwise.
//------------------------------------------------------------------
virtual Error
- ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &arch,
+ ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr);
@@ -413,7 +412,6 @@ namespace lldb_private {
DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
Error &error);
//------------------------------------------------------------------
@@ -438,7 +436,6 @@ namespace lldb_private {
Attach (ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
Error &error) = 0;
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h
index 9a959bff33e..e0f083b1232 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -228,6 +228,8 @@ class ProcessAttachInfo : public ProcessInstanceInfo
public:
ProcessAttachInfo() :
ProcessInstanceInfo(),
+ m_listener_sp(),
+ m_hijack_listener_sp(),
m_plugin_name (),
m_resume_count (0),
m_wait_for_launch (false),
@@ -239,6 +241,8 @@ public:
ProcessAttachInfo (const ProcessLaunchInfo &launch_info) :
ProcessInstanceInfo(),
+ m_listener_sp(),
+ m_hijack_listener_sp(),
m_plugin_name (),
m_resume_count (0),
m_wait_for_launch (false),
@@ -249,6 +253,7 @@ public:
ProcessInfo::operator= (launch_info);
SetProcessPluginName (launch_info.GetProcessPluginName());
SetResumeCount (launch_info.GetResumeCount());
+ SetListener(launch_info.GetListener());
SetHijackListener(launch_info.GetHijackListener());
m_detach_on_error = launch_info.GetDetachOnError();
}
@@ -364,8 +369,26 @@ public:
{
m_detach_on_error = enable;
}
-
+
+ // Get and set the actual listener that will be used for the process events
+ lldb::ListenerSP
+ GetListener () const
+ {
+ return m_listener_sp;
+ }
+
+ void
+ SetListener (const lldb::ListenerSP &listener_sp)
+ {
+ m_listener_sp = listener_sp;
+ }
+
+
+ Listener &
+ GetListenerForProcess (Debugger &debugger);
+
protected:
+ lldb::ListenerSP m_listener_sp;
lldb::ListenerSP m_hijack_listener_sp;
std::string m_plugin_name;
uint32_t m_resume_count; // How many times do we resume after launching
diff --git a/lldb/include/lldb/Target/ProcessLaunchInfo.h b/lldb/include/lldb/Target/ProcessLaunchInfo.h
index 94e4eb05fdf..897704488e5 100644
--- a/lldb/include/lldb/Target/ProcessLaunchInfo.h
+++ b/lldb/include/lldb/Target/ProcessLaunchInfo.h
@@ -179,6 +179,22 @@ namespace lldb_private
return *m_pty;
}
+ // Get and set the actual listener that will be used for the process events
+ lldb::ListenerSP
+ GetListener () const
+ {
+ return m_listener_sp;
+ }
+
+ void
+ SetListener (const lldb::ListenerSP &listener_sp)
+ {
+ m_listener_sp = listener_sp;
+ }
+
+ Listener &
+ GetListenerForProcess (Debugger &debugger);
+
lldb::ListenerSP
GetHijackListener () const
{
@@ -191,7 +207,6 @@ namespace lldb_private
m_hijack_listener_sp = listener_sp;
}
-
void
SetLaunchEventData (const char *data)
{
@@ -225,6 +240,7 @@ namespace lldb_private
void *m_monitor_callback_baton;
bool m_monitor_signals;
std::string m_event_data; // A string passed to the plugin launch, having no meaning to the upper levels of lldb.
+ lldb::ListenerSP m_listener_sp;
lldb::ListenerSP m_hijack_listener_sp;
};
}
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index 322ce5aa806..7282ddfe25d 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -607,8 +607,7 @@ public:
Destroy();
Error
- Launch (Listener &listener,
- ProcessLaunchInfo &launch_info,
+ Launch (ProcessLaunchInfo &launch_info,
Stream *stream); // Optional stream to receive first stop info
//------------------------------------------------------------------
@@ -1147,6 +1146,12 @@ public:
lldb::addr_t load_addr,
bool warn_multiple = false);
+ size_t
+ UnloadModuleSections (const lldb::ModuleSP &module_sp);
+
+ size_t
+ UnloadModuleSections (const ModuleList &module_list);
+
bool
SetSectionUnloaded (const lldb::SectionSP &section_sp);
diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i
index bce19d60096..e44bc6e0bbc 100644
--- a/lldb/scripts/Python/interface/SBTarget.i
+++ b/lldb/scripts/Python/interface/SBTarget.i
@@ -38,6 +38,12 @@ public:
void
SetExecutableFile (lldb::SBFileSpec exe_file, bool add_as_first_arg);
+ lldb::SBListener
+ GetListener ();
+
+ void
+ SetListener (lldb::SBListener &listener);
+
uint32_t
GetNumArguments ();
@@ -205,6 +211,12 @@ public:
bool
ParentProcessIDIsValid();
+
+ lldb::SBListener
+ GetListener ();
+
+ void
+ SetListener (lldb::SBListener &listener);
};
diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp
index bad9ba82bc9..87318739a3a 100644
--- a/lldb/source/API/SBListener.cpp
+++ b/lldb/source/API/SBListener.cpp
@@ -69,6 +69,12 @@ SBListener::SBListener (Listener &listener) :
{
}
+SBListener::SBListener (const lldb::ListenerSP &listener_sp) :
+ m_opaque_sp (listener_sp),
+ m_opaque_ptr (listener_sp.get())
+{
+}
+
SBListener::~SBListener ()
{
}
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 4179ac45211..92c27df1c6e 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -133,6 +133,18 @@ SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg)
m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg);
}
+SBListener
+SBLaunchInfo::GetListener ()
+{
+ return SBListener(m_opaque_sp->GetListener());
+}
+
+void
+SBLaunchInfo::SetListener (SBListener &listener)
+{
+ m_opaque_sp->SetListener(listener.GetSP());
+}
+
uint32_t
SBLaunchInfo::GetNumArguments ()
{
@@ -520,6 +532,17 @@ SBAttachInfo::ParentProcessIDIsValid()
return m_opaque_sp->ParentProcessIDIsValid();
}
+SBListener
+SBAttachInfo::GetListener ()
+{
+ return SBListener(m_opaque_sp->GetListener());
+}
+
+void
+SBAttachInfo::SetListener (SBListener &listener)
+{
+ m_opaque_sp->SetListener(listener.GetSP());
+}
//----------------------------------------------------------------------
// SBTarget constructor
@@ -751,9 +774,9 @@ SBTarget::Launch
launch_info.GetEnvironmentEntries ().SetArguments (envp);
if (listener.IsValid())
- error.SetError (target_sp->Launch(listener.ref(), launch_info, NULL));
- else
- error.SetError (target_sp->Launch(target_sp->GetDebugger().GetListener(), launch_info, NULL));
+ launch_info.SetListener(listener.GetSP());
+
+ error.SetError (target_sp->Launch(launch_info, NULL));
sb_process.SetSP(target_sp->GetProcessSP());
}
@@ -817,7 +840,7 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
if (arch_spec.IsValid())
launch_info.GetArchitecture () = arch_spec;
- error.SetError (target_sp->Launch (target_sp->GetDebugger().GetListener(), launch_info, NULL));
+ error.SetError (target_sp->Launch (launch_info, NULL));
sb_process.SetSP(target_sp->GetProcessSP());
}
else
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index 45355a0dd2a..d176d52cb48 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -1347,7 +1347,6 @@ protected:
ProcessSP process_sp (platform_sp->DebugProcess (m_options.launch_info,
debugger,
target,
- debugger.GetListener(),
error));
if (process_sp && process_sp->IsAlive())
{
@@ -1933,7 +1932,7 @@ public:
{
Error err;
ProcessSP remote_process_sp =
- platform_sp->Attach(m_options.attach_info, m_interpreter.GetDebugger(), NULL, m_interpreter.GetDebugger().GetListener(), err);
+ platform_sp->Attach(m_options.attach_info, m_interpreter.GetDebugger(), NULL, err);
if (err.Fail())
{
result.AppendError(err.AsCString());
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index b5ca44f3d6e..897e39051f3 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -260,7 +260,7 @@ protected:
}
StreamString stream;
- Error error = target->Launch(debugger.GetListener(), m_options.launch_info, &stream);
+ Error error = target->Launch(m_options.launch_info, &stream);
if (error.Success())
{
diff --git a/lldb/source/Host/macosx/Host.mm b/lldb/source/Host/macosx/Host.mm
index 228305e0814..186a76f1dcf 100644
--- a/lldb/source/Host/macosx/Host.mm
+++ b/lldb/source/Host/macosx/Host.mm
@@ -42,6 +42,7 @@
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -1306,17 +1307,14 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
Error error;
char exe_path[PATH_MAX];
PlatformSP host_platform_sp (Platform::GetHostPlatform ());
-
- const ArchSpec &arch_spec = launch_info.GetArchitecture();
-
- FileSpec exe_spec(launch_info.GetExecutableFile());
-
- FileSpec::FileType file_type = exe_spec.GetFileType();
+
+ ModuleSpec exe_module_spec(launch_info.GetExecutableFile(), launch_info.GetArchitecture());
+
+ FileSpec::FileType file_type = exe_module_spec.GetFileSpec().GetFileType();
if (file_type != FileSpec::eFileTypeRegular)
{
lldb::ModuleSP exe_module_sp;
- error = host_platform_sp->ResolveExecutable (exe_spec,
- arch_spec,
+ error = host_platform_sp->ResolveExecutable (exe_module_spec,
exe_module_sp,
NULL);
@@ -1324,12 +1322,12 @@ Host::LaunchProcess (ProcessLaunchInfo &launch_info)
return error;
if (exe_module_sp)
- exe_spec = exe_module_sp->GetFileSpec();
+ exe_module_spec.GetFileSpec() = exe_module_sp->GetFileSpec();
}
- if (exe_spec.Exists())
+ if (exe_module_spec.GetFileSpec().Exists())
{
- exe_spec.GetPath (exe_path, sizeof(exe_path));
+ exe_module_spec.GetFileSpec().GetPath (exe_path, sizeof(exe_path));
}
else
{
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index b26847ed954..3b38a581993 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -180,8 +180,7 @@ PlatformFreeBSD::RunShellCommand (const char *command,
Error
-PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformFreeBSD::ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
@@ -189,35 +188,33 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
// Nothing special to do here, just use the actual file and architecture
char exe_path[PATH_MAX];
- FileSpec resolved_exe_file (exe_file);
+ ModuleSpec resolved_module_spec(module_spec);
if (IsHost())
{
- // If we have "ls" as the exe_file, resolve the executable location based on
+ // If we have "ls" as the module_spec's file, resolve the executable location based on
// the current path variables
- if (!resolved_exe_file.Exists())
+ if (!resolved_module_spec.GetFileSpec().Exists())
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- resolved_exe_file.SetFile(exe_path, true);
+ module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
+ resolved_module_spec.GetFileSpec().SetFile(exe_path, true);
}
- if (!resolved_exe_file.Exists())
- resolved_exe_file.ResolveExecutableLocation ();
+ if (!resolved_module_spec.GetFileSpec().Exists())
+ resolved_module_spec.GetFileSpec().ResolveExecutableLocation ();
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- error.SetErrorStringWithFormat("unable to find executable for '%s'", exe_path);
+ error.SetErrorStringWithFormat("unable to find executable for '%s'", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
else
{
if (m_remote_platform_sp)
{
- error = m_remote_platform_sp->ResolveExecutable (exe_file,
- exe_arch,
+ error = m_remote_platform_sp->ResolveExecutable (module_spec,
exe_module_sp,
module_search_paths_ptr);
}
@@ -226,25 +223,24 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
// We may connect to a process and use the provided executable (Don't use local $PATH).
// Resolve any executable within a bundle on MacOSX
- Host::ResolveExecutableInBundle (resolved_exe_file);
+ Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
- if (resolved_exe_file.Exists()) {
+ if (resolved_module_spec.GetFileSpec().Exists())
+ {
error.Clear();
}
else
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", exe_path);
+ error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
if (error.Success())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- if (module_spec.GetArchitecture().IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
@@ -254,8 +250,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
{
exe_module_sp.reset();
error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
- exe_file.GetPath().c_str(),
- exe_arch.GetArchitectureName());
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
+ resolved_module_spec.GetArchitecture().GetArchitectureName());
}
}
else
@@ -264,10 +260,9 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
StreamString arch_names;
- ArchSpec platform_arch;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
@@ -283,21 +278,21 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (platform_arch.GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
@@ -514,7 +509,6 @@ lldb::ProcessSP
PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target,
- Listener &listener,
Error &error)
{
lldb::ProcessSP process_sp;
@@ -542,7 +536,7 @@ PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info,
// The freebsd always currently uses the GDB remote debugger plug-in
// so even when debugging locally we are debugging remotely!
// Just like the darwin plugin.
- process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+ process_sp = target->CreateProcess (attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL);
if (process_sp)
error = process_sp->Attach (attach_info);
@@ -551,7 +545,7 @@ PlatformFreeBSD::Attach(ProcessAttachInfo &attach_info,
else
{
if (m_remote_platform_sp)
- process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, listener, error);
+ process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, error);
else
error.SetErrorString ("the platform is not currently connected");
}
diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
index 15591da889d..ce3f8cfad97 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
@@ -80,8 +80,7 @@ public:
uint32_t timeout_sec);
virtual lldb_private::Error
- ResolveExecutable (const lldb_private::FileSpec &exe_file,
- const lldb_private::ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
@@ -135,7 +134,6 @@ public:
Attach(lldb_private::ProcessAttachInfo &attach_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target,
- lldb_private::Listener &listener,
lldb_private::Error &error);
// FreeBSD processes can not be launched by spawning and attaching.
diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
index fa3d8e4a3e1..b3729e2976d 100644
--- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
+++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp
@@ -97,27 +97,25 @@ PlatformKalimba::Terminate ()
}
Error
-PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
- lldb::ModuleSP &exe_module_sp,
- const FileSpecList *module_search_paths_ptr)
+PlatformKalimba::ResolveExecutable (const ModuleSpec &ms,
+ lldb::ModuleSP &exe_module_sp,
+ const FileSpecList *module_search_paths_ptr)
{
Error error;
char exe_path[PATH_MAX];
- FileSpec resolved_exe_file (exe_file);
+ ModuleSpec resolved_module_spec(ms);
- if (!resolved_exe_file.Exists())
+ if (!resolved_module_spec.GetFileSpec().Exists())
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
+ resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
error.SetErrorStringWithFormat("unable to find executable for '%s'", exe_path);
}
if (error.Success())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- if (exe_arch.IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -126,7 +124,7 @@ PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
{
// If we failed, it may be because the vendor and os aren't known. If that is the
// case, try setting them to the host architecture and give it another try.
- llvm::Triple &module_triple = module_spec.GetArchitecture().GetTriple();
+ llvm::Triple &module_triple = resolved_module_spec.GetArchitecture().GetTriple();
bool is_vendor_specified = (module_triple.getVendor() != llvm::Triple::UnknownVendor);
bool is_os_specified = (module_triple.getOS() != llvm::Triple::UnknownOS);
if (!is_vendor_specified || !is_os_specified)
@@ -138,7 +136,7 @@ PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
if (!is_os_specified)
module_triple.setOSName (host_triple.getOSName());
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -151,8 +149,8 @@ PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
{
exe_module_sp.reset();
error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
- exe_file.GetPath().c_str(),
- exe_arch.GetArchitectureName());
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
+ resolved_module_spec.GetArchitecture().GetArchitectureName());
}
}
else
@@ -161,9 +159,9 @@ PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
StreamString arch_names;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -179,21 +177,21 @@ PlatformKalimba::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
@@ -298,10 +296,9 @@ PlatformKalimba::LaunchProcess (ProcessLaunchInfo &launch_info)
lldb::ProcessSP
PlatformKalimba::Attach(ProcessAttachInfo &attach_info,
- Debugger &debugger,
- Target *target,
- Listener &listener,
- Error &error)
+ Debugger &debugger,
+ Target *target,
+ Error &error)
{
lldb::ProcessSP process_sp;
if (IsHost())
@@ -311,7 +308,7 @@ PlatformKalimba::Attach(ProcessAttachInfo &attach_info,
else
{
if (m_remote_platform_sp)
- process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, listener, error);
+ process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, error);
else
error.SetErrorString ("the platform is not currently connected");
}
diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h
index 6cb4441879d..ebf955b7873 100644
--- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h
+++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.h
@@ -58,8 +58,7 @@ namespace lldb_private {
// lldb_private::Platform functions
//------------------------------------------------------------
virtual Error
- ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr) override;
@@ -91,7 +90,7 @@ namespace lldb_private {
virtual lldb::ProcessSP
Attach(ProcessAttachInfo &attach_info, Debugger &debugger,
- Target *target, Listener &listener, Error &error) override;
+ Target *target, Error &error) override;
// Kalimba processes can not be launched by spawning and attaching.
virtual bool
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 1519c5b3789..ec14ae3e829 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -269,8 +269,7 @@ PlatformLinux::Terminate ()
}
Error
-PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformLinux::ResolveExecutable (const ModuleSpec &ms,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
@@ -278,35 +277,33 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
// Nothing special to do here, just use the actual file and architecture
char exe_path[PATH_MAX];
- FileSpec resolved_exe_file (exe_file);
+ ModuleSpec resolved_module_spec (ms);
if (IsHost())
{
// If we have "ls" as the exe_file, resolve the executable location based on
// the current path variables
- if (!resolved_exe_file.Exists())
+ if (!resolved_module_spec.GetFileSpec().Exists())
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- resolved_exe_file.SetFile(exe_path, true);
+ resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
+ resolved_module_spec.GetFileSpec().SetFile(exe_path, true);
}
- if (!resolved_exe_file.Exists())
- resolved_exe_file.ResolveExecutableLocation ();
+ if (!resolved_module_spec.GetFileSpec().Exists())
+ resolved_module_spec.GetFileSpec().ResolveExecutableLocation ();
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- error.SetErrorStringWithFormat("unable to find executable for '%s'", exe_path);
+ error.SetErrorStringWithFormat("unable to find executable for '%s'", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
else
{
if (m_remote_platform_sp)
{
- error = m_remote_platform_sp->ResolveExecutable (exe_file,
- exe_arch,
+ error = m_remote_platform_sp->ResolveExecutable (ms,
exe_module_sp,
NULL);
}
@@ -314,7 +311,7 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
{
// We may connect to a process and use the provided executable (Don't use local $PATH).
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", exe_path);
@@ -323,10 +320,9 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
if (error.Success())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- if (exe_arch.IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -335,7 +331,7 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
{
// If we failed, it may be because the vendor and os aren't known. If that is the
// case, try setting them to the host architecture and give it another try.
- llvm::Triple &module_triple = module_spec.GetArchitecture().GetTriple();
+ llvm::Triple &module_triple = resolved_module_spec.GetArchitecture().GetTriple();
bool is_vendor_specified = (module_triple.getVendor() != llvm::Triple::UnknownVendor);
bool is_os_specified = (module_triple.getOS() != llvm::Triple::UnknownOS);
if (!is_vendor_specified || !is_os_specified)
@@ -347,7 +343,7 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
if (!is_os_specified)
module_triple.setOSName (host_triple.getOSName());
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -360,8 +356,8 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
{
exe_module_sp.reset();
error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
- exe_file.GetPath().c_str(),
- exe_arch.GetArchitectureName());
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
+ resolved_module_spec.GetArchitecture().GetArchitectureName());
}
}
else
@@ -370,9 +366,9 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
StreamString arch_names;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -388,21 +384,21 @@ PlatformLinux::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
@@ -638,10 +634,9 @@ PlatformLinux::CanDebugProcess ()
// approach on MacOSX.
lldb::ProcessSP
PlatformLinux::DebugProcess (ProcessLaunchInfo &launch_info,
- Debugger &debugger,
- Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
- Error &error)
+ Debugger &debugger,
+ Target *target, // Can be NULL, if NULL create a new target, else use existing one
+ Error &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
if (log)
@@ -649,7 +644,7 @@ PlatformLinux::DebugProcess (ProcessLaunchInfo &launch_info,
// If we're a remote host, use standard behavior from parent class.
if (!IsHost ())
- return PlatformPOSIX::DebugProcess (launch_info, debugger, target, listener, error);
+ return PlatformPOSIX::DebugProcess (launch_info, debugger, target, error);
//
// For local debugging, we'll insist on having ProcessGDBRemote create the process.
@@ -714,7 +709,7 @@ PlatformLinux::DebugProcess (ProcessLaunchInfo &launch_info,
// Now create the gdb-remote process.
if (log)
log->Printf ("PlatformLinux::%s having target create process with gdb-remote plugin", __FUNCTION__);
- process_sp = target->CreateProcess (listener, "gdb-remote", nullptr);
+ process_sp = target->CreateProcess (launch_info.GetListenerForProcess(debugger), "gdb-remote", nullptr);
if (!process_sp)
{
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
index 3bbe3a5737b..19b397ffa9b 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
@@ -61,8 +61,7 @@ namespace lldb_private {
// lldb_private::Platform functions
//------------------------------------------------------------
Error
- ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr) override;
@@ -99,7 +98,6 @@ namespace lldb_private {
DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target *target,
- Listener &listener,
Error &error) override;
void
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 94e3a9c2627..fb48c01230b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -157,8 +157,7 @@ PlatformDarwin::LocateExecutableScriptingResources (Target *target,
}
Error
-PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformDarwin::ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
@@ -166,45 +165,40 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
// Nothing special to do here, just use the actual file and architecture
char exe_path[PATH_MAX];
- FileSpec resolved_exe_file (exe_file);
-
+ ModuleSpec resolved_module_spec(module_spec);
+
if (IsHost())
{
// If we have "ls" as the exe_file, resolve the executable loation based on
// the current path variables
- if (resolved_exe_file.Exists())
- {
-
- }
- else
+ if (!resolved_module_spec.GetFileSpec().Exists())
{
- exe_file.GetPath (exe_path, sizeof(exe_path));
- resolved_exe_file.SetFile(exe_path, true);
+ module_spec.GetFileSpec().GetPath (exe_path, sizeof(exe_path));
+ resolved_module_spec.GetFileSpec().SetFile(exe_path, true);
}
- if (!resolved_exe_file.Exists())
- resolved_exe_file.ResolveExecutableLocation ();
+ if (!resolved_module_spec.GetFileSpec().Exists())
+ resolved_module_spec.GetFileSpec().ResolveExecutableLocation ();
// Resolve any executable within a bundle on MacOSX
- Host::ResolveExecutableInBundle (resolved_exe_file);
+ Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
{
- const uint32_t permissions = resolved_exe_file.GetPermissions();
+ const uint32_t permissions = resolved_module_spec.GetFileSpec().GetPermissions();
if (permissions && (permissions & eFilePermissionsEveryoneR) == 0)
- error.SetErrorStringWithFormat ("executable '%s' is not readable", resolved_exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat ("executable '%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
else
- error.SetErrorStringWithFormat ("unable to find executable for '%s'", resolved_exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat ("unable to find executable for '%s'", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
else
{
if (m_remote_platform_sp)
{
- error = m_remote_platform_sp->ResolveExecutable (exe_file,
- exe_arch,
+ error = m_remote_platform_sp->ResolveExecutable (module_spec,
exe_module_sp,
module_search_paths_ptr);
}
@@ -213,22 +207,21 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
// We may connect to a process and use the provided executable (Don't use local $PATH).
// Resolve any executable within a bundle on MacOSX
- Host::ResolveExecutableInBundle (resolved_exe_file);
+ Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
- error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", resolved_exe_file.GetFilename().AsCString(""));
+ error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", resolved_module_spec.GetFileSpec().GetFilename().AsCString(""));
}
}
if (error.Success())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- if (module_spec.GetArchitecture().IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
@@ -238,8 +231,8 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
{
exe_module_sp.reset();
error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
- exe_file.GetPath().c_str(),
- exe_arch.GetArchitectureName());
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
+ resolved_module_spec.GetArchitecture().GetArchitectureName());
}
}
else
@@ -248,9 +241,9 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
StreamString arch_names;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- error = GetSharedModule (module_spec,
+ error = GetSharedModule (resolved_module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
@@ -266,21 +259,21 @@ PlatformDarwin::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index b847153af99..e717e68ebf1 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -28,10 +28,9 @@ public:
// lldb_private::Platform functions
//------------------------------------------------------------
virtual lldb_private::Error
- ResolveExecutable (const lldb_private::FileSpec &exe_file,
- const lldb_private::ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
- const lldb_private::FileSpecList *module_search_paths_ptr);
+ const lldb_private::FileSpecList *module_search_paths_ptr) override;
virtual lldb_private::Error
ResolveSymbolFile (lldb_private::Target &target,
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
index b8169852598..53aa24f35ae 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp
@@ -172,7 +172,8 @@ PlatformRemoteiOS::PlatformRemoteiOS () :
m_device_support_directory(),
m_device_support_directory_for_os_version (),
m_build_update(),
- m_last_module_sdk_idx(UINT32_MAX)
+ m_last_module_sdk_idx (UINT32_MAX),
+ m_connected_module_sdk_idx (UINT32_MAX)
{
}
@@ -209,32 +210,24 @@ PlatformRemoteiOS::GetStatus (Stream &strm)
Error
-PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformRemoteiOS::ResolveExecutable (const ModuleSpec &ms,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
Error error;
// Nothing special to do here, just use the actual file and architecture
- FileSpec resolved_exe_file (exe_file);
-
- // If we have "ls" as the exe_file, resolve the executable loation based on
- // the current path variables
- // TODO: resolve bare executables in the Platform SDK
-// if (!resolved_exe_file.Exists())
-// resolved_exe_file.ResolveExecutableLocation ();
+ ModuleSpec resolved_module_spec(ms);
// Resolve any executable within a bundle on MacOSX
// TODO: verify that this handles shallow bundles, if not then implement one ourselves
- Host::ResolveExecutableInBundle (resolved_exe_file);
+ Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
{
- if (exe_arch.IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -248,11 +241,9 @@ PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file,
// found so ask the platform for the architectures that we should be
// using (in the correct order) and see if we can find a match that way
StreamString arch_names;
- ArchSpec platform_arch;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- ModuleSpec module_spec (resolved_exe_file, platform_arch);
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -268,28 +259,28 @@ PlatformRemoteiOS::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (platform_arch.GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
else
{
error.SetErrorStringWithFormat ("'%s' does not exist",
- exe_file.GetPath().c_str());
+ resolved_module_spec.GetFileSpec().GetPath().c_str());
}
return error;
@@ -315,13 +306,28 @@ PlatformRemoteiOS::UpdateSDKDirectoryInfosInNeeded()
const bool find_directories = true;
const bool find_files = false;
const bool find_other = false;
+
+ SDKDirectoryInfoCollection builtin_sdk_directory_infos;
FileSpec::EnumerateDirectory (m_device_support_directory.c_str(),
find_directories,
find_files,
find_other,
GetContainedFilesIntoVectorOfStringsCallback,
- &m_sdk_directory_infos);
-
+ &builtin_sdk_directory_infos);
+
+ // Only add SDK directories that have symbols in them, some SDKs only contain
+ // developer disk images and no symbols, so they aren't useful to us.
+ FileSpec sdk_symbols_symlink_fspec;
+ for (const auto &sdk_directory_info : builtin_sdk_directory_infos)
+ {
+ sdk_symbols_symlink_fspec = sdk_directory_info.directory;
+ sdk_symbols_symlink_fspec.AppendPathComponent("Symbols");
+ if (sdk_symbols_symlink_fspec.Exists())
+ {
+ m_sdk_directory_infos.push_back(sdk_directory_info);
+ }
+ }
+
const uint32_t num_installed = m_sdk_directory_infos.size();
FileSpec local_sdk_cache("~/Library/Developer/Xcode/iOS DeviceSupport", true);
if (local_sdk_cache.Exists())
@@ -686,32 +692,50 @@ PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec,
// with the right UUID.
const FileSpec &platform_file = module_spec.GetFileSpec();
- FileSpec local_file;
- const UUID *module_uuid_ptr = module_spec.GetUUIDPtr();
Error error;
char platform_file_path[PATH_MAX];
if (platform_file.GetPath(platform_file_path, sizeof(platform_file_path)))
{
- FileSpec local_file;
+ ModuleSpec platform_module_spec(module_spec);
+ UpdateSDKDirectoryInfosInNeeded();
+
UpdateSDKDirectoryInfosInNeeded();
const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+
+ // If we are connected we migth be able to correctly deduce the SDK directory
+ // using the OS build.
+ const uint32_t connected_sdk_idx = GetConnectedSDKIndex ();
+ if (connected_sdk_idx < num_sdk_infos)
+ {
+ if (GetFileInSDK (platform_file_path, connected_sdk_idx, platform_module_spec.GetFileSpec()))
+ {
+ module_sp.reset();
+ error = ResolveExecutable (platform_module_spec,
+ module_sp,
+ NULL);
+ if (module_sp)
+ {
+ m_last_module_sdk_idx = connected_sdk_idx;
+ error.Clear();
+ return error;
+ }
+ }
+ }
+
// Try the last SDK index if it is set as most files from an SDK
// will tend to be valid in that same SDK.
if (m_last_module_sdk_idx < num_sdk_infos)
{
- if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, local_file))
+ if (GetFileInSDK (platform_file_path, m_last_module_sdk_idx, platform_module_spec.GetFileSpec()))
{
- //printf ("sdk[%u] last: '%s'\n", m_last_module_sdk_idx, local_file.GetPath().c_str());
module_sp.reset();
- error = ResolveExecutable (local_file,
- module_spec.GetArchitecture(),
+ error = ResolveExecutable (platform_module_spec,
module_sp,
NULL);
- if (module_sp && ((module_uuid_ptr == NULL) || (module_sp->GetUUID() == *module_uuid_ptr)))
+ if (module_sp)
{
- //printf ("sdk[%u] last found\n", m_last_module_sdk_idx);
error.Clear();
return error;
}
@@ -727,20 +751,16 @@ PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec,
// it above
continue;
}
- if (GetFileInSDK (platform_file_path, sdk_idx, local_file))
+ if (GetFileInSDK (platform_file_path, sdk_idx, platform_module_spec.GetFileSpec()))
{
//printf ("sdk[%u]: '%s'\n", sdk_idx, local_file.GetPath().c_str());
- error = ResolveExecutable (local_file,
- module_spec.GetArchitecture(),
- module_sp,
- NULL);
- if (module_sp && ((module_uuid_ptr == NULL) || (module_sp->GetUUID() == *module_uuid_ptr)))
+ error = ResolveExecutable (platform_module_spec, module_sp, NULL);
+ if (module_sp)
{
// Remember the index of the last SDK that we found a file
// in in case the wrong SDK was selected.
m_last_module_sdk_idx = sdk_idx;
- //printf ("sdk[%u]: found (setting last to %u)\n", sdk_idx, m_last_module_sdk_idx);
error.Clear();
return error;
}
@@ -756,7 +776,7 @@ PlatformRemoteiOS::GetSharedModule (const ModuleSpec &module_spec,
return error;
const bool always_create = false;
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (module_spec,
module_sp,
module_search_paths_ptr,
old_module_sp_ptr,
@@ -774,3 +794,33 @@ PlatformRemoteiOS::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch
{
return ARMGetSupportedArchitectureAtIndex (idx, arch);
}
+
+uint32_t
+PlatformRemoteiOS::GetConnectedSDKIndex ()
+{
+ if (IsConnected())
+ {
+ if (m_connected_module_sdk_idx == UINT32_MAX)
+ {
+ std::string build;
+ if (GetRemoteOSBuildString(build))
+ {
+ const uint32_t num_sdk_infos = m_sdk_directory_infos.size();
+ for (uint32_t i=0; i<num_sdk_infos; ++i)
+ {
+ const SDKDirectoryInfo &sdk_dir_info = m_sdk_directory_infos[i];
+ if (strstr(sdk_dir_info.directory.GetFilename().AsCString(""), build.c_str()))
+ {
+ m_connected_module_sdk_idx = i;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ m_connected_module_sdk_idx = UINT32_MAX;
+ }
+ return m_connected_module_sdk_idx;
+}
+
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
index 47ea6a6cc91..9df723cb785 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h
@@ -67,8 +67,7 @@ public:
// lldb_private::Platform functions
//------------------------------------------------------------
virtual lldb_private::Error
- ResolveExecutable (const lldb_private::FileSpec &exe_file,
- const lldb_private::ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
@@ -114,6 +113,7 @@ protected:
std::string m_device_support_directory_for_os_version;
std::string m_build_update;
uint32_t m_last_module_sdk_idx;
+ uint32_t m_connected_module_sdk_idx;
bool
UpdateSDKDirectoryInfosInNeeded();
@@ -154,6 +154,9 @@ protected:
FindFileInAllSDKs (const lldb_private::FileSpec &platform_file,
lldb_private::FileSpecList &file_list);
+ uint32_t
+ GetConnectedSDKIndex ();
+
private:
DISALLOW_COPY_AND_ASSIGN (PlatformRemoteiOS);
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
index caa4a303903..a6ffce7c952 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -172,16 +172,15 @@ PlatformiOSSimulator::GetStatus (Stream &strm)
Error
-PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformiOSSimulator::ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
Error error;
// Nothing special to do here, just use the actual file and architecture
- FileSpec resolved_exe_file (exe_file);
-
+ ModuleSpec resolved_module_spec(module_spec);
+
// If we have "ls" as the exe_file, resolve the executable loation based on
// the current path variables
// TODO: resolve bare executables in the Platform SDK
@@ -190,14 +189,13 @@ PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file,
// Resolve any executable within a bundle on MacOSX
// TODO: verify that this handles shallow bundles, if not then implement one ourselves
- Host::ResolveExecutableInBundle (resolved_exe_file);
+ Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec());
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
{
- ModuleSpec module_spec(resolved_exe_file, exe_arch);
- if (exe_arch.IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -212,12 +210,12 @@ PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file,
// using (in the correct order) and see if we can find a match that way
StreamString arch_names;
ArchSpec platform_arch;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
// Only match x86 with x86 and x86_64 with x86_64...
- if (!exe_arch.IsValid() || exe_arch.GetCore() == module_spec.GetArchitecture().GetCore())
+ if (!module_spec.GetArchitecture().IsValid() || module_spec.GetArchitecture().GetCore() == resolved_module_spec.GetArchitecture().GetCore())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -239,23 +237,23 @@ PlatformiOSSimulator::ResolveExecutable (const FileSpec &exe_file,
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
else
{
error.SetErrorStringWithFormat ("'%s' does not exist",
- exe_file.GetPath().c_str());
+ module_spec.GetFileSpec().GetPath().c_str());
}
return error;
@@ -379,12 +377,12 @@ PlatformiOSSimulator::GetSharedModule (const ModuleSpec &module_spec,
// then we attempt to get a shared module for the right architecture
// with the right UUID.
Error error;
- FileSpec local_file;
+ ModuleSpec platform_module_spec (module_spec);
const FileSpec &platform_file = module_spec.GetFileSpec();
- error = GetSymbolFile (platform_file, module_spec.GetUUIDPtr(), local_file);
+ error = GetSymbolFile (platform_file, module_spec.GetUUIDPtr(), platform_module_spec.GetFileSpec());
if (error.Success())
{
- error = ResolveExecutable (local_file, module_spec.GetArchitecture(), module_sp, module_search_paths_ptr);
+ error = ResolveExecutable (platform_module_spec, module_sp, module_search_paths_ptr);
}
else
{
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
index 37869754751..efbf0d118f3 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.h
@@ -65,8 +65,7 @@ public:
// lldb_private::Platform functions
//------------------------------------------------------------
virtual lldb_private::Error
- ResolveExecutable (const lldb_private::FileSpec &exe_file,
- const lldb_private::ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 9b434733b7c..b1be0f5b1fe 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -794,7 +794,6 @@ lldb::ProcessSP
PlatformPOSIX::Attach (ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target,
- Listener &listener,
Error &error)
{
lldb::ProcessSP process_sp;
@@ -835,7 +834,7 @@ PlatformPOSIX::Attach (ProcessAttachInfo &attach_info,
}
- process_sp = target->CreateProcess (listener, attach_info.GetProcessPluginName(), NULL);
+ process_sp = target->CreateProcess (attach_info.GetListenerForProcess(debugger), attach_info.GetProcessPluginName(), NULL);
if (process_sp)
{
@@ -852,7 +851,7 @@ PlatformPOSIX::Attach (ProcessAttachInfo &attach_info,
else
{
if (m_remote_platform_sp)
- process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, listener, error);
+ process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, error);
else
error.SetErrorString ("the platform is not currently connected");
}
@@ -863,7 +862,6 @@ lldb::ProcessSP
PlatformPOSIX::DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
Error &error)
{
ProcessSP process_sp;
@@ -874,12 +872,12 @@ PlatformPOSIX::DebugProcess (ProcessLaunchInfo &launch_info,
// We still need to reap it from lldb but if we let the monitor thread also set the exit status, we set up a
// race between debugserver & us for who will find out about the debugged process's death.
launch_info.GetFlags().Set(eLaunchFlagDontSetExitStatus);
- process_sp = Platform::DebugProcess (launch_info, debugger, target, listener, error);
+ process_sp = Platform::DebugProcess (launch_info, debugger, target, error);
}
else
{
if (m_remote_platform_sp)
- process_sp = m_remote_platform_sp->DebugProcess (launch_info, debugger, target, listener, error);
+ process_sp = m_remote_platform_sp->DebugProcess (launch_info, debugger, target, error);
else
error.SetErrorString ("the platform is not currently connected");
}
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h
index cd055ba02ee..aae415e6eef 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h
@@ -138,14 +138,12 @@ public:
Attach (lldb_private::ProcessAttachInfo &attach_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Listener &listener,
lldb_private::Error &error) override;
lldb::ProcessSP
DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Listener &listener,
lldb_private::Error &error) override;
virtual std::string
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index c6e79e4e190..ade4dccf6f8 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -196,8 +196,7 @@ PlatformWindows::~PlatformWindows()
}
Error
-PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformWindows::ResolveExecutable (const ModuleSpec &ms,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
@@ -205,25 +204,25 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
// Nothing special to do here, just use the actual file and architecture
char exe_path[PATH_MAX];
- FileSpec resolved_exe_file (exe_file);
+ ModuleSpec resolved_module_spec(ms);
if (IsHost())
{
// if we cant resolve the executable loation based on the current path variables
- if (!resolved_exe_file.Exists())
+ if (!resolved_module_spec.GetFileSpec().Exists())
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
- resolved_exe_file.SetFile(exe_path, true);
+ resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
+ resolved_module_spec.GetFileSpec().SetFile(exe_path, true);
}
- if (!resolved_exe_file.Exists())
- resolved_exe_file.ResolveExecutableLocation ();
+ if (!resolved_module_spec.GetFileSpec().Exists())
+ resolved_module_spec.GetFileSpec().ResolveExecutableLocation ();
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
{
- exe_file.GetPath(exe_path, sizeof(exe_path));
+ ms.GetFileSpec().GetPath(exe_path, sizeof(exe_path));
error.SetErrorStringWithFormat("unable to find executable for '%s'", exe_path);
}
}
@@ -231,15 +230,14 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
{
if (m_remote_platform_sp)
{
- error = m_remote_platform_sp->ResolveExecutable (exe_file,
- exe_arch,
+ error = m_remote_platform_sp->ResolveExecutable (ms,
exe_module_sp,
NULL);
}
else
{
// We may connect to a process and use the provided executable (Don't use local $PATH).
- if (resolved_exe_file.Exists())
+ if (resolved_module_spec.GetFileSpec().Exists())
error.Clear();
else
error.SetErrorStringWithFormat("the platform is not currently connected, and '%s' doesn't exist in the system root.", exe_path);
@@ -248,10 +246,9 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
if (error.Success())
{
- ModuleSpec module_spec (resolved_exe_file, exe_arch);
- if (exe_arch.IsValid())
+ if (resolved_module_spec.GetArchitecture().IsValid())
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -261,8 +258,8 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
{
exe_module_sp.reset();
error.SetErrorStringWithFormat ("'%s' doesn't contain the architecture %s",
- exe_file.GetPath().c_str(),
- exe_arch.GetArchitectureName());
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
+ resolved_module_spec.GetArchitecture().GetArchitectureName());
}
}
else
@@ -271,9 +268,9 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
StreamString arch_names;
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, resolved_module_spec.GetArchitecture()); ++idx)
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (resolved_module_spec,
exe_module_sp,
NULL,
NULL,
@@ -289,21 +286,21 @@ PlatformWindows::ResolveExecutable (const FileSpec &exe_file,
if (idx > 0)
arch_names.PutCString (", ");
- arch_names.PutCString (module_spec.GetArchitecture().GetArchitectureName());
+ arch_names.PutCString (resolved_module_spec.GetArchitecture().GetArchitectureName());
}
if (error.Fail() || !exe_module_sp)
{
- if (exe_file.Readable())
+ if (resolved_module_spec.GetFileSpec().Readable())
{
error.SetErrorStringWithFormat ("'%s' doesn't contain any '%s' platform architectures: %s",
- exe_file.GetPath().c_str(),
+ resolved_module_spec.GetFileSpec().GetPath().c_str(),
GetPluginName().GetCString(),
arch_names.GetString().c_str());
}
else
{
- error.SetErrorStringWithFormat("'%s' is not readable", exe_file.GetPath().c_str());
+ error.SetErrorStringWithFormat("'%s' is not readable", resolved_module_spec.GetFileSpec().GetPath().c_str());
}
}
}
@@ -518,7 +515,6 @@ lldb::ProcessSP
PlatformWindows::Attach(ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target,
- Listener &listener,
Error &error)
{
lldb::ProcessSP process_sp;
@@ -547,7 +543,7 @@ PlatformWindows::Attach(ProcessAttachInfo &attach_info,
// The Windows platform always currently uses the GDB remote debugger plug-in
// so even when debugging locally we are debugging remotely!
// Just like the darwin plugin.
- process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+ process_sp = target->CreateProcess (attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL);
if (process_sp)
error = process_sp->Attach (attach_info);
@@ -556,7 +552,7 @@ PlatformWindows::Attach(ProcessAttachInfo &attach_info,
else
{
if (m_remote_platform_sp)
- process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, listener, error);
+ process_sp = m_remote_platform_sp->Attach (attach_info, debugger, target, error);
else
error.SetErrorString ("the platform is not currently connected");
}
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
index a7d470cadf5..a2511067276 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.h
@@ -60,8 +60,7 @@ public:
// lldb_private::Platform functions
//------------------------------------------------------------
virtual Error
- ResolveExecutable(const FileSpec &exe_file,
- const ArchSpec &arch,
+ ResolveExecutable(const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr);
@@ -121,7 +120,6 @@ public:
Attach(lldb_private::ProcessAttachInfo &attach_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target,
- lldb_private::Listener &listener,
lldb_private::Error &error);
virtual lldb_private::Error
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 66c321a2520..43eae4d906e 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -21,6 +21,7 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Host/ConnectionFileDescriptor.h"
@@ -100,14 +101,13 @@ PlatformRemoteGDBServer::GetDescription ()
}
Error
-PlatformRemoteGDBServer::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+PlatformRemoteGDBServer::ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
Error error;
//error.SetErrorString ("PlatformRemoteGDBServer::ResolveExecutable() is unimplemented");
- if (m_gdb_client.GetFileExists(exe_file))
+ if (m_gdb_client.GetFileExists(module_spec.GetFileSpec()))
return error;
// TODO: get the remote end to somehow resolve this file
error.SetErrorString("file not found on remote end");
@@ -421,7 +421,6 @@ lldb::ProcessSP
PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Listener &listener,
lldb_private::Error &error)
{
lldb::ProcessSP process_sp;
@@ -473,7 +472,7 @@ PlatformRemoteGDBServer::DebugProcess (lldb_private::ProcessLaunchInfo &launch_i
// The darwin always currently uses the GDB remote debugger plug-in
// so even when debugging locally we are debugging remotely!
- process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+ process_sp = target->CreateProcess (launch_info.GetListenerForProcess(debugger), "gdb-remote", NULL);
if (process_sp)
{
@@ -515,7 +514,6 @@ lldb::ProcessSP
PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
Error &error)
{
lldb::ProcessSP process_sp;
@@ -567,7 +565,7 @@ PlatformRemoteGDBServer::Attach (lldb_private::ProcessAttachInfo &attach_info,
// The darwin always currently uses the GDB remote debugger plug-in
// so even when debugging locally we are debugging remotely!
- process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
+ process_sp = target->CreateProcess (attach_info.GetListenerForProcess(debugger), "gdb-remote", NULL);
if (process_sp)
{
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
index 6f358889907..90b16b8b8fa 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
@@ -64,8 +64,7 @@ public:
// lldb_private::Platform functions
//------------------------------------------------------------
virtual lldb_private::Error
- ResolveExecutable (const lldb_private::FileSpec &exe_file,
- const lldb_private::ArchSpec &arch,
+ ResolveExecutable (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
@@ -92,14 +91,12 @@ public:
DebugProcess (lldb_private::ProcessLaunchInfo &launch_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Listener &listener,
lldb_private::Error &error);
virtual lldb::ProcessSP
Attach (lldb_private::ProcessAttachInfo &attach_info,
lldb_private::Debugger &debugger,
lldb_private::Target *target, // Can be NULL, if NULL create a new target, else use existing one
- lldb_private::Listener &listener,
lldb_private::Error &error);
virtual bool
diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp
index 686b5023bf9..15027fb3694 100644
--- a/lldb/source/Symbol/ClangASTContext.cpp
+++ b/lldb/source/Symbol/ClangASTContext.cpp
@@ -889,6 +889,13 @@ ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize (const char *type_name
break;
case DW_ATE_float:
+ if (streq(type_name, "float") && QualTypeMatchesBitSize (bit_size, ast, ast->FloatTy))
+ return ClangASTType (ast, ast->FloatTy.getAsOpaquePtr());
+ if (streq(type_name, "double") && QualTypeMatchesBitSize (bit_size, ast, ast->DoubleTy))
+ return ClangASTType (ast, ast->DoubleTy.getAsOpaquePtr());
+ if (streq(type_name, "long double") && QualTypeMatchesBitSize (bit_size, ast, ast->LongDoubleTy))
+ return ClangASTType (ast, ast->LongDoubleTy.getAsOpaquePtr());
+ // Fall back to not requring a name match
if (QualTypeMatchesBitSize (bit_size, ast, ast->FloatTy))
return ClangASTType (ast, ast->FloatTy.getAsOpaquePtr());
if (QualTypeMatchesBitSize (bit_size, ast, ast->DoubleTy))
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 9ab338d69d9..6ea6c4e95e4 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -882,15 +882,13 @@ Platform::SetOSVersion (uint32_t major,
Error
-Platform::ResolveExecutable (const FileSpec &exe_file,
- const ArchSpec &exe_arch,
+Platform::ResolveExecutable (const ModuleSpec &module_spec,
lldb::ModuleSP &exe_module_sp,
const FileSpecList *module_search_paths_ptr)
{
Error error;
- if (exe_file.Exists())
+ if (module_spec.GetFileSpec().Exists())
{
- ModuleSpec module_spec (exe_file, exe_arch);
if (module_spec.GetArchitecture().IsValid())
{
error = ModuleList::GetSharedModule (module_spec,
@@ -904,9 +902,10 @@ Platform::ResolveExecutable (const FileSpec &exe_file,
// No valid architecture was specified, ask the platform for
// the architectures that we should be using (in the correct order)
// and see if we can find a match that way
- for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, module_spec.GetArchitecture()); ++idx)
+ ModuleSpec arch_module_spec(module_spec);
+ for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, arch_module_spec.GetArchitecture()); ++idx)
{
- error = ModuleList::GetSharedModule (module_spec,
+ error = ModuleList::GetSharedModule (arch_module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
@@ -920,7 +919,7 @@ Platform::ResolveExecutable (const FileSpec &exe_file,
else
{
error.SetErrorStringWithFormat ("'%s' does not exist",
- exe_file.GetPath().c_str());
+ module_spec.GetFileSpec().GetPath().c_str());
}
return error;
}
@@ -1094,7 +1093,6 @@ lldb::ProcessSP
Platform::DebugProcess (ProcessLaunchInfo &launch_info,
Debugger &debugger,
Target *target, // Can be NULL, if NULL create a new target, else use existing one
- Listener &listener,
Error &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM));
@@ -1117,7 +1115,7 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info,
if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID)
{
ProcessAttachInfo attach_info (launch_info);
- process_sp = Attach (attach_info, debugger, target, listener, error);
+ process_sp = Attach (attach_info, debugger, target, error);
if (process_sp)
{
if (log)
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index d6f53aaaa41..2b7d4c01a4c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -3252,6 +3252,15 @@ Process::AttachCompletionHandler::GetExitString ()
return m_exit_string.c_str();
}
+Listener &
+ProcessAttachInfo::GetListenerForProcess (Debugger &debugger)
+{
+ if (m_listener_sp)
+ return *m_listener_sp;
+ else
+ return debugger.GetListener();
+}
+
Error
Process::Attach (ProcessAttachInfo &attach_info)
{
diff --git a/lldb/source/Target/ProcessLaunchInfo.cpp b/lldb/source/Target/ProcessLaunchInfo.cpp
index d894637e480..d5f3d5176d3 100644
--- a/lldb/source/Target/ProcessLaunchInfo.cpp
+++ b/lldb/source/Target/ProcessLaunchInfo.cpp
@@ -9,6 +9,7 @@
#include "lldb/Host/Config.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/FileAction.h"
@@ -32,6 +33,7 @@ ProcessLaunchInfo::ProcessLaunchInfo () :
m_monitor_callback (NULL),
m_monitor_callback_baton (NULL),
m_monitor_signals (false),
+ m_listener_sp (),
m_hijack_listener_sp ()
{
}
@@ -48,6 +50,7 @@ ProcessLaunchInfo::ProcessLaunchInfo(const char *stdin_path, const char *stdout_
m_monitor_callback(NULL),
m_monitor_callback_baton(NULL),
m_monitor_signals(false),
+ m_listener_sp (),
m_hijack_listener_sp()
{
if (stdin_path)
@@ -218,6 +221,7 @@ ProcessLaunchInfo::Clear ()
m_flags.Clear();
m_file_actions.clear();
m_resume_count = 0;
+ m_listener_sp.reset();
m_hijack_listener_sp.reset();
}
@@ -485,3 +489,12 @@ ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell (Error &error,
}
return false;
}
+
+Listener &
+ProcessLaunchInfo::GetListenerForProcess (Debugger &debugger)
+{
+ if (m_listener_sp)
+ return *m_listener_sp;
+ else
+ return debugger.GetListener();
+}
diff --git a/lldb/source/Target/StackFrameList.cpp b/lldb/source/Target/StackFrameList.cpp
index 99234dc61f1..9a132618288 100644
--- a/lldb/source/Target/StackFrameList.cpp
+++ b/lldb/source/Target/StackFrameList.cpp
@@ -288,8 +288,8 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
do
{
uint32_t idx = m_concrete_frames_fetched++;
- lldb::addr_t pc;
- lldb::addr_t cfa;
+ lldb::addr_t pc = LLDB_INVALID_ADDRESS;
+ lldb::addr_t cfa = LLDB_INVALID_ADDRESS;
if (idx == 0)
{
// We might have already created frame zero, only create it
@@ -625,11 +625,14 @@ StackFrameList::GetFrameWithStackID (const StackID &stack_id)
if (begin != end)
{
collection::const_iterator pos = std::lower_bound (begin, end, stack_id, CompareStackID);
- if (pos != end && (*pos)->GetStackID() == stack_id)
- return *pos;
+ if (pos != end)
+ {
+ if ((*pos)->GetStackID() == stack_id)
+ return *pos;
+ }
- if (m_frames.back()->GetStackID() < stack_id)
- frame_idx = m_frames.size();
+// if (m_frames.back()->GetStackID() < stack_id)
+// frame_idx = m_frames.size();
}
do
{
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 595bcb494e0..c43d4e9dfb8 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -1215,6 +1215,7 @@ Target::ModulesDidUnload (ModuleList &module_list, bool delete_locations)
{
if (m_valid && module_list.GetSize())
{
+ UnloadModuleSections (module_list);
m_breakpoint_list.UpdateBreakpoints (module_list, false, delete_locations);
// TODO: make event data that packages up the module_list
BroadcastEvent (eBroadcastBitModulesUnloaded, NULL);
@@ -2308,6 +2309,40 @@ Target::SetSectionLoadAddress (const SectionSP &section_sp, addr_t new_section_l
}
+size_t
+Target::UnloadModuleSections (const ModuleList &module_list)
+{
+ size_t section_unload_count = 0;
+ size_t num_modules = module_list.GetSize();
+ for (size_t i=0; i<num_modules; ++i)
+ {
+ section_unload_count += UnloadModuleSections (module_list.GetModuleAtIndex(i));
+ }
+ return section_unload_count;
+}
+
+size_t
+Target::UnloadModuleSections (const lldb::ModuleSP &module_sp)
+{
+ uint32_t stop_id = 0;
+ ProcessSP process_sp(GetProcessSP());
+ if (process_sp)
+ stop_id = process_sp->GetStopID();
+ else
+ stop_id = m_section_load_history.GetLastStopID();
+ SectionList *sections = module_sp->GetSectionList();
+ size_t section_unload_count = 0;
+ if (sections)
+ {
+ const uint32_t num_sections = sections->GetNumSections(0);
+ for (uint32_t i = 0; i < num_sections; ++i)
+ {
+ section_unload_count += m_section_load_history.SetSectionUnloaded(stop_id, sections->GetSectionAtIndex(i));
+ }
+ }
+ return section_unload_count;
+}
+
bool
Target::SetSectionUnloaded (const lldb::SectionSP &section_sp)
{
@@ -2340,7 +2375,7 @@ Target::ClearAllLoadedSections ()
Error
-Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info, Stream *stream)
+Target::Launch (ProcessLaunchInfo &launch_info, Stream *stream)
{
Error error;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
@@ -2412,7 +2447,6 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info, Stream *stre
m_process_sp = GetPlatform()->DebugProcess (launch_info,
debugger,
this,
- listener,
error);
}
else
@@ -2428,7 +2462,7 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info, Stream *stre
{
// Use a Process plugin to construct the process.
const char *plugin_name = launch_info.GetProcessPluginName();
- CreateProcess (listener, plugin_name, NULL);
+ CreateProcess (launch_info.GetListenerForProcess(debugger), plugin_name, NULL);
}
// Since we didn't have a platform launch the process, launch it here.
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index dea0549c4f8..7e503c62e14 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -363,8 +363,8 @@ TargetList::CreateTarget (Debugger &debugger,
if (platform_sp)
{
FileSpecList executable_search_paths (Target::GetDefaultExecutableSearchPaths());
- error = platform_sp->ResolveExecutable (file,
- arch,
+ ModuleSpec module_spec(file, arch);
+ error = platform_sp->ResolveExecutable (module_spec,
exe_module_sp,
executable_search_paths.GetSize() ? &executable_search_paths : NULL);
}
OpenPOWER on IntegriCloud