Diff for /wikisrc/kernel_debugging_with_qemu.mdwn between versions 1.12 and 1.17

version 1.12, 2015/08/05 12:58:13 version 1.17, 2018/11/09 13:39:26
Line 16  If your host system is running NetBSD, i Line 16  If your host system is running NetBSD, i
 from pkgsrc:  from pkgsrc:
   
 * emulators/qemu >= 2.0.0nb4  * emulators/qemu >= 2.0.0nb4
 * misc/py-anita  * misc/py-anita >= 1.44
   
 If your host system uses a package system other than pkgsrc,  If your host system uses a package system other than pkgsrc,
 use that to install cvs, make, gcc, qemu, the Python pexpect  use that to install cvs, make, gcc, qemu, the Python pexpect
Line 28  install the most recent anita package fr Line 28  install the most recent anita package fr
   
 Check out the NetBSD-current sources from CVS and build a full release  Check out the NetBSD-current sources from CVS and build a full release
 of NetBSD-current/i386 with debug symbols using the build.sh script.  of NetBSD-current/i386 with debug symbols using the build.sh script.
 The i386 port is the preferred test platform because the two  The i386 port is preferred because these instructions have been 
 other ports supported by anita are affected by known bugs: amd64 by  successfully tested with it.
 [[PR 50128|http://gnats.NetBSD.org/50128]], and sparc by  The amd64 port won't work because of [[PR 50128|http://gnats.NetBSD.org/50128]],
 [[qemu bug 1399943|https://bugs.launchpad.net/qemu/+bug/1399943]].  and sparc has not been tested since [[qemu bug
   1399943|https://bugs.launchpad.net/qemu/+bug/1399943]] was fixed.
   
 If you do the build in a directory other than /usr/src,   If you do the build in a directory other than /usr/src, 
 use the -fdebug-prefix-map option to ensure that the source file names embedded  use the -fdebug-prefix-map option to ensure that the source file names embedded
 in the debug symbols point to /usr/src, which is where the sources will be  in the debug symbols point to /usr/src, which is where the sources will be
Line 52  Install the system in a virtual machine, Line 54  Install the system in a virtual machine,
   
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
  $ cd ..   $ cd ..
  $ anita --workdir work --disk-size 4G --memory-size 256M \   $ anita --workdir work --disk-size 8G --memory-size 256M \
      --sets kern-GENERIC,modules,base,etc,comp,debug,games,man,misc,tests,text,syssrc,src,sharesrc,gnusrc \       --sets kern-GENERIC,modules,base,etc,comp,debug,games,man,misc,tests,text,syssrc,src,sharesrc,gnusrc \
      install $(pwd)/obj/releasedir/i386/       install $(pwd)/obj/releasedir/i386/
 """]]  """]]
Line 72  First start the target VM, enabling qemu Line 74  First start the target VM, enabling qemu
 on TCP port 1234:  on TCP port 1234:
   
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
  $ qemu-system-i386 -nographic -snapshot -hda work/wd0.img -gdb tcp::1234   $ qemu-system-i386 -nographic -snapshot -hda work/wd0.img -m 128 -gdb tcp::1234
 """]]  """]]
   
 If you don't want everyone on the Internet to be able to debug your  If you don't want everyone on the Internet to be able to debug your
Line 82  your firewall. Line 84  your firewall.
 In a second terminal window, start the gdb VM:  In a second terminal window, start the gdb VM:
   
 [[!template  id=programlisting text="""  [[!template  id=programlisting text="""
  $ qemu-system-i386 -nographic -snapshot -hda work/wd0.img   $ qemu-system-i386 -nographic -snapshot -hda work/wd0.img -m 256
 """]]  """]]
   
 Log in to the gdb VM as root and set up the network:  Log in to the gdb VM as root and set up the network:
Line 111  with full debug symbols and access to th Line 113  with full debug symbols and access to th
 """]]  """]]
   
 If the stack trace prints very slowly (like 30 seconds per stack  If the stack trace prints very slowly (like 30 seconds per stack
 frame), it's likely because you are using a version of qemu where  frame), you are probably using an old version of qemu that fails
 the user-mode networking code fails to disable the Nagle algorithm.  to disable the Nagle algorithm.
 This is fixed in the qemu in pkgsrc, but you may run into it if your  
 qemu is not installed via pkgsrc.  
   
 ## Qemu tips  ## Qemu tips
   

Removed from v.1.12  
changed lines
  Added in v.1.17


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb