[NSWI004] gdb

Vojtech Horky horky at d3s.mff.cuni.cz
Sun Nov 8 18:10:14 CET 2020


Hello.

Dne 08. 11. 20 v 17:30 Georgii Ekserdzhian napsal(a):
> Good evening,
> One of the students by the name (Jan Kytka) wrote in chat that he is 
> able to attach gdb to msim. Please pm me, I would love to know how!

For a quick start (note that this support is still experimental hence it 
may not always work) you can try the following.

Compile your kernel.

Open two terminals.

In one, run make run-msim-gdb (in this one, you will see normal MSIM 
output).

In other, run make run-gdb to start GDB.

Type break kernel_main inside GDB to set breakpoint inside kernel_main 
(first reasonable place). Type continue, GDB shall stop execution on 
entering kernel_main(). From now, standard features such as variable 
dump etc. shall be available.

Note that GDB is not always happy with thread switches (weird things are 
happening that the debugger is not willing to understand easily) so 
things may not work as smoothly as when debugging userland programs.

Hope this helps,
- VH


More information about the NSWI004 mailing list