This is an old revision of the document!
Project name
Project description
FreeBSD has replaced the GNU toolchain with the LLVM toolchain for a long time. In the LLVM toolchain, there is a bundle debugger called lldb, which is also bundled in FreeBSD. The lldb debug facilities in userland have been well implemented for a long time. However, there are some works still need to be done in the kernel space. What I want to do is to finish the parse mechanism about kernel module information for the kernel debugger
Approach to solving the problem
In kgdb’s scheme, it does the following things:
- Setup the related structure offset in ./kern/linker.c and find the linkerfiles structure that is a linkedlist containing all of the loaded LKM information.
- Search the LKM from the raw and absolute path to find the corresponding kernel module and get the table offset from bfd
- Relocating sections in ko files found in step 2 with LKM base address found in step 1
- Load symbol from symbol file and thus finish
In LLDB’s userspace implementation, it read the kinfovmentry to get the loaded module information, and thus modules can be found in the GetLoad- edModuleFileSpce method. What we have to do is to combine LLDB userspace and kgdb in LLDB kernel space. Except for the LKM, I also want to support static kernel module which is also a possible module type in the FreeBSD kernel. But things are different in that the static kernel module will not appear in kldstat. In other words, it will not appear in linkerfiles, so we need a special handler on these files
Deliverables
1. LKM parse and LLDB FreeBSD Kernel Module implementation
Milestones
(5-10 milestones, with dates, indicating when you hope or expect to be able to complete features. This section is mandatory. Please negotiate these with your mentor to make sure you're not under- or over-estimating the amount of work to be done. Please also make sure the following four dates are included within your milestones)
- May 14th: Start of coding
- You'll be doing this in the first week
- May 21st: Week 2
- You plan to do this in the second week
- June 11th - June 15th: Mid-term Evaluations #1
- July 9th - July 13th: Mid-term Evaluations #2
- August 6th: End of coding (soft)
- You may wish to use this time to complete documentation etc
- August 14th: End of coding (hard)
Test Plan
Because performance is not that important for a debugger, I will focus the test on functionality. In the first stage of the test, I will try to write some small kernel modules with some function symbols contained for debug pur- poses. In the second stage of the test, I will try to use the large kernel module like wifi to test the functionality. In the second stage of the test, I will post my work on reviews.freebsd.org to let other module developers test it.
The Code
(Link to your code, for example https://svnweb.freebsd.org/socsvn/soc2018/username/ or a Github URL etc)