Why dont debug it in GDB+QEMU

All development related issues welcome

Moderator: Moderator Team

Post Reply
plato
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Why dont debug it in GDB+QEMU

Post by plato » Sun Jul 12, 2009 1:38 am

I create config.rbuild from config.template.rbuild and change it so that:
<property name="KDBG" value="0" />
<property name="DBG" value="1" />
<property name="GDB" value="1" />
and I builder it with command line:
make ROS_BUILDNOSTRIP=yes

when I load file in GDB, some message will display:
GNU gdb 6.8
... ...
This GDB was configured as "i686-pc-mingw32",
<gdb> file ./output-i386/ntoskrnl/ntoskrnl.nostrip.exe
BFD:F:\source\reactos9/./output-i386/ntoskrnl/ntoskrnl.nostrip.exe:warning:lgnoring section flag IMAGE-SCN-MEM-NOT-PAGED in section.data
... ...
Reading symbols from:F:\source\reactos9/./ntoskrnl/ntoskrnl.nostrip.exe...done.
<gdb> list
1 {standard input} No such file or directory .
in {standard input}
<gdb>

why I dont list the source file ?
thanks!
Last edited by gabrielilardi on Wed Jan 20, 2010 1:37 pm, edited 1 time in total.
Reason: fix a typo for indexing purposes


hto
Developer
Posts: 2193
Joined: Sun Oct 01, 2006 3:43 pm

Post by hto » Sun Jul 12, 2009 5:07 pm

It seems you have forgotten to connect GDB to the target. BTW, you need not to compile ReactOS with GDB option. QEMU allows to connect GDB directly to it.

plato
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Re: Why dont debug it in GDB+QENU

Post by plato » Mon Jul 13, 2009 3:19 pm

I know why I can't list the source, I should add the source file,for example:
list mminit.c:20

then, it will brower this source code.

thank lone_rifle and hto for your help!

but i have another question, how i can debug this module(boot/freeldr), gdb dont loand it!

hto
Developer
Posts: 2193
Joined: Sun Oct 01, 2006 3:43 pm

Post by hto » Mon Jul 13, 2009 4:27 pm

but i have another question, how i can debug this module(boot/freeldr), gdb dont load it!
Open the $ROS_AUTOMAKE file, find there the $(FREELDR_TARGET): string, find the string which begins with -@${rm} after it and comment it out. Repeat the same for $(SETUPLDR_TARGET):

Now remove $ROS_OUTPUT/boot/freeldr/freeldr/{freeldr,setupldr}.sys files and do make freeldr setupldr. There will appear {freeldr,setupldr}.junk.tmp files in the $TEMPORARY/ directory. Use them.

plato
Posts: 11
Joined: Sat Jul 11, 2009 3:25 am

Re: Why dont debug it in GDB+QENU

Post by plato » Tue Jul 14, 2009 5:25 pm

thanks hto for your help,

are we only debug boot code in bochs? I try it in GDB, buf find the assemble code is different as the origin.I guess GDB is 32bit protect mode, so the translate is wrong.

hto
Developer
Posts: 2193
Joined: Sun Oct 01, 2006 3:43 pm

Post by hto » Tue Jul 14, 2009 9:31 pm

Most of FreeLoader is executed in 32-bit protected mode. So, unless you're going to debug these 16-bit parts, you can use QEMU and GDB. Set a breakpoint at BootMain or whatever function you want to debug, and begin your quest.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests