diff options
author | Jason Molenda <jmolenda@apple.com> | 2012-09-29 04:02:01 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2012-09-29 04:02:01 +0000 |
commit | 4bd4e7e3ba8315c4180da954f0af40bbcb07f624 (patch) | |
tree | 0eb343bc870d4d1efbd900f05316cec7bca61f8d /lldb/source/Plugins/Process/gdb-remote | |
parent | 913b8763290ac7d1b83be9e26067d86400b0e5e0 (diff) | |
download | bcm5719-llvm-4bd4e7e3ba8315c4180da954f0af40bbcb07f624.tar.gz bcm5719-llvm-4bd4e7e3ba8315c4180da954f0af40bbcb07f624.zip |
Add support for debugging KASLR kernels via kdp (the kernel being
loaded at a random offset).
To get the kernel's UUID and load address I need to send a kdp
packet so I had to implement the kernel relocation (and attempt to
find the kernel if none was provided to lldb already) in ProcessKDP
-- but this code really properly belongs in DynamicLoaderDarwinKernel.
I also had to add an optional Stream to ConnectRemote so
ProcessKDP::DoConnectRemote can print feedback about the remote kernel's
UUID, load address, and notify the user if we auto-loaded the kernel via
the UUID.
<rdar://problem/7714201>
llvm-svn: 164881
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote')
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 21 | ||||
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h | 2 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index d25f134de8a..f29a1677874 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -414,7 +414,7 @@ ProcessGDBRemote::WillAttachToProcessWithName (const char *process_name, bool wa } Error -ProcessGDBRemote::DoConnectRemote (const char *remote_url) +ProcessGDBRemote::DoConnectRemote (Stream *strm, const char *remote_url) { Error error (WillLaunchOrAttach ()); @@ -427,6 +427,25 @@ ProcessGDBRemote::DoConnectRemote (const char *remote_url) return error; StartAsyncThread (); + const ArchSpec &gdb_remote_arch = m_gdb_comm.GetHostArchitecture(); + if (gdb_remote_arch.IsValid() && gdb_remote_arch.GetTriple().getVendor() == llvm::Triple::Apple) + { + Module *exe_module = GetTarget().GetExecutableModulePointer(); + + ObjectFile *exe_objfile = exe_module->GetObjectFile(); + + // If the remote system is an Apple device and we don't have an exec file + // OR we have an exec file and it is a kernel, look for the kernel's load address + // in memory and load/relocate the kernel symbols as appropriate. + if (exe_objfile == NULL + || (exe_objfile->GetType() == ObjectFile::eTypeExecutable && + exe_objfile->GetStrata() == ObjectFile::eStrataKernel)) + { + + + } + } + lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID (); if (pid == LLDB_INVALID_PROCESS_ID) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h index 563b89963fa..4a716157943 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h @@ -94,7 +94,7 @@ public: WillAttachToProcessWithName (const char *process_name, bool wait_for_launch); virtual lldb_private::Error - DoConnectRemote (const char *remote_url); + DoConnectRemote (lldb_private::Stream *strm, const char *remote_url); lldb_private::Error WillLaunchOrAttach (); |