mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 03:50:33 +08:00
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
This commit is contained in:
@@ -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 *
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 §ion_sp);
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 ()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
if (!resolved_module_spec.GetFileSpec().Exists())
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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 §ion_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 §ion_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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user