summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-02-09 06:16:32 +0000
committerGreg Clayton <gclayton@apple.com>2012-02-09 06:16:32 +0000
commitc3776bf288a33cb42daac1a6583ddb5e581839d6 (patch)
tree510d067a8c55229aaf66014e0e93338065bdcb80 /lldb/source/Target/Process.cpp
parent6c07547b568a1307d0a3279a0cfdf89365ae8444 (diff)
downloadbcm5719-llvm-c3776bf288a33cb42daac1a6583ddb5e581839d6.tar.gz
bcm5719-llvm-c3776bf288a33cb42daac1a6583ddb5e581839d6.zip
First pass at mach-o core file support is in. It currently works for x86_64
user space programs. The core file support is implemented by making a process plug-in that will dress up the threads and stack frames by using the core file memory. Added many default implementations for the lldb_private::Process functions so that plug-ins like the ProcessMachCore don't need to override many many functions only to have to return an error. Added new virtual functions to the ObjectFile class for extracting the frozen thread states that might be stored in object files. The default implementations return no thread information, but any platforms that support core files that contain frozen thread states (like mach-o) can make a module using the core file and then extract the information. The object files can enumerate the threads and also provide the register state for each thread. Since each object file knows how the thread registers are stored, they are responsible for creating a suitable register context that can be used by the core file threads. Changed the process CreateInstace callbacks to return a shared pointer and to also take an "const FileSpec *core_file" parameter to allow for core file support. This will also allow for lldb_private::Process subclasses to be made that could load crash logs. This should be possible on darwin where the crash logs contain all of the stack frames for all of the threads, yet the crash logs only contain the registers for the crashed thrad. It should also allow some variables to be viewed for the thread that crashed. llvm-svn: 150154
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp51
1 files changed, 42 insertions, 9 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 07e1cdf5241..6ed2b2ac040 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -708,30 +708,39 @@ ProcessInstanceInfoMatch::Clear()
m_match_all_users = false;
}
-Process*
-Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener)
+ProcessSP
+Process::FindPlugin (Target &target, const char *plugin_name, Listener &listener, const FileSpec *crash_file_path)
{
+ ProcessSP process_sp;
ProcessCreateInstance create_callback = NULL;
if (plugin_name)
{
create_callback = PluginManager::GetProcessCreateCallbackForPluginName (plugin_name);
if (create_callback)
{
- std::auto_ptr<Process> debugger_ap(create_callback(target, listener));
- if (debugger_ap->CanDebug(target, true))
- return debugger_ap.release();
+ process_sp = create_callback(target, listener, crash_file_path);
+ if (process_sp)
+ {
+ if (!process_sp->CanDebug(target, true))
+ process_sp.reset();
+ }
}
}
else
{
for (uint32_t idx = 0; (create_callback = PluginManager::GetProcessCreateCallbackAtIndex(idx)) != NULL; ++idx)
{
- std::auto_ptr<Process> debugger_ap(create_callback(target, listener));
- if (debugger_ap->CanDebug(target, false))
- return debugger_ap.release();
+ process_sp = create_callback(target, listener, crash_file_path);
+ if (process_sp)
+ {
+ if (!process_sp->CanDebug(target, false))
+ process_sp.reset();
+ else
+ break;
+ }
}
}
- return NULL;
+ return process_sp;
}
@@ -2328,6 +2337,30 @@ Process::Launch (const ProcessLaunchInfo &launch_info)
return error;
}
+
+Error
+Process::LoadCore ()
+{
+ Error error = DoLoadCore();
+ if (error.Success())
+ {
+ if (PrivateStateThreadIsValid ())
+ ResumePrivateStateThread ();
+ else
+ StartPrivateStateThread ();
+
+ CompleteAttach ();
+ // We successfully loaded a core file, now pretend we stopped so we can
+ // show all of the threads in the core file and explore the crashed
+ // state.
+ SetPrivateState (eStateStopped);
+
+ }
+ return error;
+}
+
+
+
Process::NextEventAction::EventActionResult
Process::AttachCompletionHandler::PerformAction (lldb::EventSP &event_sp)
{
OpenPOWER on IntegriCloud