Create a project with source code and debug armlinux kernel over serial port

Suppose Windows10, WSL and ubuntu18 are installed on your PC. Putty is installed in your Windows.Ssh server, gdb-multiarch and agent-proxy are installed in the ubuntu18. There is a project folder /home/srcdbg/project/module_prj in the ubuntu18 whose host name is localhost. The linux kernel source code is cross-compiled in ubuntu18 or the source code is mapped on a folder in ubuntu18. Here are steps to create a new project.

1. Preparation for ubuntu18.
sudo apt-get install openssh-server gdb-multiarch
git clone git://
cd agent-proxy ; make ; sudo cp agent-proxy /usr/bin

2. Please refer to for kernel config options for kgdb.
Please Note: When using kgdboc with a UART, the UART driver must implement two callbacks in the struct uart_ops. Example from drivers/8250.c:
.poll_get_char = serial8250_get_poll_char,
.poll_put_char = serial8250_put_poll_char,

Here is an example set of .config symbols to enable for kgdb:

Add below bold parts to the kernel cmdline. The Kernel command line option kgdbwait makes kgdb wait for a debugger connection during booting of a kernel.
noinitrd ro console=ttyHSL0,115200,n8 kgdboc=ttyHSL0,115200 kgdbwait androidboot.hardware=

3. Select File > New > Solution... > Wizard... and then click the OK button.

4. Enter the name of the project and click Next button.

5. Enter the correct Remote host, Port, Username, Password, Initial path and click Next button.

6. Click Next button.

7. Click Next button.

8. Click Finish button.

9. Enter the solution File name and click Save button.

10. Enter the project File name and click Save button.

11. Right click the srcdbg_test project and select Properties.
Make sure it's an absolute path of the "Attach to program" line.
Change Attach to program as "-i=mi /home/srcdbg/project/module_prj/vmlinux".
Configure Debug start command as "-exec-continue".
Configure Entry function as "do_init_module".
Configure Postdebug command as "target remote :5551" .
Configure Start Timeout and Connect Timeout as "30".

12. Login ubuntu18 with Putty.

13. Assume you have a COM40 to connect to the armboard. COM40 will be mapped as /dev/ttyS40 in ubuntu18.
Run agent-proxy as a daemon and then telnet with port 5550 to communicate with armboard.
The kernel will boot and wait for connection with below message:

14. Select Debug > Start Debugging to communicate with the remote target and start debug.

15. Swith to the Putty to check the debug infomation.