[lldb-dev] Supporting FreeBSD kernel debugging project
gclayton at apple.com
Thu May 22 09:39:42 PDT 2014
Your project will be great! Below I will outline a few things to keep you on track:
Core file kernel debugging:
- You shouldn't have to do too much to the current ProcessELFCore except help it to locate hint address for the list of shared libraries and the main kernel file in memory. This is done in:
- Most of the work will be done in your DynamicLoader subclass that then uses the hint from the ProcessELFCore::GetImageInfoAddress() as to where the shared libraries are. This new DynamicLoader subclass will be used for both live kernel debugging and for Core file debugging and should be able to track down all kernel extensions that are loaded.
Live kernel debugging:
- You will make a new process subclass like you were saying unless the GDB remote protocol is used to talk to the kernel?
- You should re-use your dynamic loader from the Core file step here
- Get threads that are context switched in memory to show up. In the MacOSX kernel debugger we have the notion of 1 core we can talk to through the KDP interface which is the code that runs the debugger. There are tons of threads in the kernel that are sitting in memory. We have a python plugin that will supply a list of memory threads back to lldb. So even though the kernel debug interface only supports N cores, we might also be able to show M number of memory threads and see their backtraces, registers, etc. The MacOSX kernel implements this using python code that can use kernel globals to get the list of in memory threads and create them on the fly. There is a very simple example of this in:
svn cat http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/operating_system.py
Let us know if you have any questions as far as implementation and architecture goes. The MacOSX kernel process subclass does things correctly so keep an eye on that plug-in when you have questions or need guidance.
> On May 22, 2014, at 2:03 AM, Mike Ma <mikemandarine at gmail.com> wrote:
> Hi there,
> I'm a google summer of code student this year, on FreeBSD part.
> And I'm writing to introduce my project, we are aiming to support kernel debugging on FreeBSD for LLDB.
> Ed Maste (emaste at freebsd.org) is my mentor for this project, I'll be working closely with him.
> Here is the project page:
> This is my LLDB fork:
> Any comments are more than welcome.
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
More information about the lldb-dev