Patch from Pawel Worach to make FreeBSD work again after ModuleSpec changes.

llvm-svn: 151532
This commit is contained in:
Greg Clayton 2012-02-27 18:40:48 +00:00
parent 5aafb56dc0
commit 29d1930868
5 changed files with 38 additions and 44 deletions

View File

@ -101,7 +101,8 @@ PlatformFreeBSD::~PlatformFreeBSD()
Error
PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
const ArchSpec &exe_arch,
lldb::ModuleSP &exe_module_sp)
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
@ -139,7 +140,8 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
{
error = m_remote_platform_sp->ResolveExecutable (exe_file,
exe_arch,
exe_module_sp);
exe_module_sp,
module_search_paths_ptr);
}
else
{
@ -161,14 +163,12 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
if (error.Success())
{
if (exe_arch.IsValid())
ModuleSpec module_spec (resolved_exe_file, exe_arch);
if (module_spec.GetArchitecture().IsValid())
{
error = ModuleList::GetSharedModule (resolved_exe_file,
exe_arch,
NULL,
NULL,
0,
error = ModuleList::GetSharedModule (module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
NULL);
@ -191,12 +191,9 @@ PlatformFreeBSD::ResolveExecutable (const FileSpec &exe_file,
ArchSpec platform_arch;
for (uint32_t idx = 0; GetSupportedArchitectureAtIndex (idx, platform_arch); ++idx)
{
error = ModuleList::GetSharedModule (resolved_exe_file,
platform_arch,
NULL,
NULL,
0,
error = ModuleList::GetSharedModule (module_spec,
exe_module_sp,
module_search_paths_ptr,
NULL,
NULL);
// Did we find an executable using one of the
@ -466,7 +463,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");
process_sp = target->CreateProcess (listener, "gdb-remote", NULL);
if (process_sp)
error = process_sp->Attach (attach_info);
@ -526,12 +523,9 @@ PlatformFreeBSD::GetFile (const FileSpec &platform_file,
}
Error
PlatformFreeBSD::GetSharedModule (const FileSpec &platform_file,
const ArchSpec &arch,
const UUID *uuid_ptr,
const ConstString *object_name_ptr,
off_t object_offset,
PlatformFreeBSD::GetSharedModule (const ModuleSpec &module_spec,
ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
ModuleSP *old_module_sp_ptr,
bool *did_create_ptr)
{
@ -544,12 +538,9 @@ PlatformFreeBSD::GetSharedModule (const FileSpec &platform_file,
// the shared module first.
if (m_remote_platform_sp)
{
error = m_remote_platform_sp->GetSharedModule (platform_file,
arch,
uuid_ptr,
object_name_ptr,
object_offset,
error = m_remote_platform_sp->GetSharedModule (module_spec,
module_sp,
module_search_paths_ptr,
old_module_sp_ptr,
did_create_ptr);
}
@ -558,17 +549,14 @@ PlatformFreeBSD::GetSharedModule (const FileSpec &platform_file,
if (!module_sp)
{
// Fall back to the local platform and find the file locally
error = Platform::GetSharedModule (platform_file,
arch,
uuid_ptr,
object_name_ptr,
object_offset,
error = Platform::GetSharedModule (module_spec,
module_sp,
module_search_paths_ptr,
old_module_sp_ptr,
did_create_ptr);
}
if (module_sp)
module_sp->SetPlatformFileSpec(platform_file);
module_sp->SetPlatformFileSpec(module_spec.GetFileSpec());
return error;
}

View File

@ -83,7 +83,8 @@ public:
virtual lldb_private::Error
ResolveExecutable (const lldb_private::FileSpec &exe_file,
const lldb_private::ArchSpec &arch,
lldb::ModuleSP &module_sp);
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr);
virtual size_t
GetSoftwareBreakpointTrapOpcode (lldb_private::Target &target,
@ -148,12 +149,9 @@ public:
const lldb_private::UUID* uuid, lldb_private::FileSpec &local_file);
lldb_private::Error
GetSharedModule (const lldb_private::FileSpec &platform_file,
const lldb_private::ArchSpec &arch,
const lldb_private::UUID *uuid_ptr,
const lldb_private::ConstString *object_name_ptr,
off_t object_offset,
GetSharedModule (const lldb_private::ModuleSpec &module_spec,
lldb::ModuleSP &module_sp,
const lldb_private::FileSpecList *module_search_paths_ptr,
lldb::ModuleSP *old_module_sp_ptr,
bool *did_create_ptr);

View File

@ -31,10 +31,15 @@ using namespace lldb_private;
//------------------------------------------------------------------------------
// Static functions.
Process*
ProcessFreeBSD::CreateInstance(Target& target, Listener &listener)
lldb::ProcessSP
ProcessFreeBSD::CreateInstance(Target& target,
Listener &listener,
const FileSpec *crash_file_path)
{
return new ProcessFreeBSD(target, listener);
lldb::ProcessSP process_sp;
if (crash_file_path == NULL)
process_sp.reset(new ProcessFreeBSD (target, listener));
return process_sp;
}
void

View File

@ -31,9 +31,10 @@ public:
//------------------------------------------------------------------
// Static functions.
//------------------------------------------------------------------
static Process*
static lldb::ProcessSP
CreateInstance(lldb_private::Target& target,
lldb_private::Listener &listener);
lldb_private::Listener &listener,
const lldb_private::FileSpec *crash_file_path);
static void
Initialize();
@ -51,7 +52,7 @@ public:
// Constructors and destructors
//------------------------------------------------------------------
ProcessFreeBSD(lldb_private::Target& target,
lldb_private::Listener &listener);
lldb_private::Listener &listener);
virtual uint32_t
UpdateThreadList(lldb_private::ThreadList &old_thread_list, lldb_private::ThreadList &new_thread_list);

View File

@ -831,6 +831,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
{
ProcessMonitor *monitor = args->m_monitor;
ProcessFreeBSD &process = monitor->GetProcess();
lldb::ProcessSP processSP = process.shared_from_this();
const char **argv = args->m_argv;
const char **envp = args->m_envp;
const char *stdin_path = args->m_stdin_path;
@ -951,7 +952,7 @@ ProcessMonitor::Launch(LaunchArgs *args)
goto FINISH;
// Update the process thread list with this new thread.
inferior.reset(new POSIXThread(process, pid));
inferior.reset(new POSIXThread(processSP, pid));
process.GetThreadList().AddThread(inferior);
// Let our process instance know the thread has stopped.
@ -1011,6 +1012,7 @@ ProcessMonitor::Attach(AttachArgs *args)
ProcessMonitor *monitor = args->m_monitor;
ProcessFreeBSD &process = monitor->GetProcess();
lldb::ProcessSP processSP = process.shared_from_this();
ThreadList &tl = process.GetThreadList();
lldb::ThreadSP inferior;
@ -1036,7 +1038,7 @@ ProcessMonitor::Attach(AttachArgs *args)
}
// Update the process thread list with the attached thread.
inferior.reset(new POSIXThread(process, pid));
inferior.reset(new POSIXThread(processSP, pid));
tl.AddThread(inferior);
// Let our process instance know the thread has stopped.