1 Reply Latest reply on Apr 3, 2012 10:24 AM by tbetak

    How to use SimNow with gdb

    trekkingpan

      I have a trouble to connect SimNow with gdb.

      My environment is:

      physical pc:  Intel Core2 Q8000

      host: windows 7

      In my host, I run a VirtualBox 4.1.10

      In VirtualBox, I run fedora 3.3.0-4.fc16.x86_64

      In fedora, I run SimNow 4.6.2

      I want to debug some C codes which directly runs on SimNow.

      1.I choose cheetah_1p.bsd, disk

      2.start simulation

      3.I do not know when I can start gdb server. I just type "shell.gdb" a few seconds after starting simulation.

      4. I open another linux terminal in fedora.type:

      gdb MYFILE

      set architecture i386:x86-64

      target remote:2222

      The screen is as follow. When the gdb connect successfully, the simulation does not stop. I think it should be stopped. I type some instruction like

      break *0x7c00, but it does not work. It seems that gdb did not control the simulation.  I do not know the reason. I will change the CPU to AMD in several days. But I do not think it is the problem. Is there anything I should consider, but i does not list it here?

       

      My kernel file is compiled with flag "-m32", it is 32 bits. I do not know if i should use "set architecture i386".

       

      Another case, if I do not load any symbol file for gdb, SimNow will crash when the bios test all memory. I think gdb can work without source file. I do not know what happens.

       

       

      gdb screen

      [pan@localhost ~]$ gdb kernel

      GNU gdb (GDB) Fedora (7.3.50.20110722-9.fc16)

      Copyright (C) 2011 Free Software Foundation, Inc.

      License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

      This is free software: you are free to change and redistribute it.

      There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

      and "show warranty" for details.

      This GDB was configured as "x86_64-redhat-linux-gnu".

      For bug reporting instructions, please see:

      <http://www.gnu.org/software/gdb/bugs/>...

      Reading symbols from /home/pan/kernel...done.

      (gdb) set architecture i386:x86-64

      The target architecture is assumed to be i386:x86-64

      (gdb) target remote:2222

      Remote debugging using :2222

      0x0000000000000000 in ?? ()

      (gdb) break *0x7c00

      Breakpoint 1 at 0x7c00

      (gdb) break *0x8000000

      Note: breakpoint -1 also set at pc 0x8000000.

      Breakpoint 2 at 0x8000000: file boot.S, line 28.

      (gdb) info breakpoints

      Num     Type           Disp Enb Address            What

      1       breakpoint     keep y   0x0000000000007c00

      2       breakpoint     keep y   0x08000000         boot.S:28

      (gdb)

       

      SimNow sreen

      BSD Load completed!

      ATA: Image [/home/pan/mavmm.hdd] does not have an ID field.

       

       

       

       

      1 simnow> shell.gdb

       

       

      1 simnow>

        • Re: How to use SimNow with gdb
          tbetak

          Since your guest is running a 32-bit kernel, you should set the architecture to 'i386' instead of 'i386:x86-64'.  Although, from looking at your breakpoints, you may need to set the architecture to 'i8086' if you are dealing with 16-bit code depending on when and where you want to break.

           

          Travis Betak