Kernel Debugging with QEMU: Difference between revisions

imported>Luis-Hebendanz
mNo edit summary
imported>Luis-Hebendanz
mNo edit summary
Line 58: Line 58:
Discard the <code>-enable-kvm</code> flag if  
Discard the <code>-enable-kvm</code> flag if  
<code> virtualisation.libvirtd.enable </code> is not set in your configuration.nix.
<code> virtualisation.libvirtd.enable </code> is not set in your configuration.nix.
The <code>nokaslr</code> kernel flag is important to be able to set breakpoints in kernel memory.
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
  $ qemu-system-x86_64 -s -S \
  $ qemu-system-x86_64 -s -S \
Line 69: Line 70:
== Connect with gdb ==
== Connect with gdb ==
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
$ echo "add-auto-load-safe-path `pwd`/scripts/gdb/vmlinux-gdb.py" >> ~/.gdbinit
  $ gdb ./vmlinux
  $ gdb ./vmlinux
  (gdb) target remote :1234
  (gdb) target remote :1234
  (gdb) continue
  (gdb) continue
</syntaxhighlight>
</syntaxhighlight>