Page 1 of 1
how can i debug a os with bochs?
Posted: Thu Mar 24, 2011 9:26 pm
by j8long
i download the bochs souce.i want to know which option to configure,so i can debug it.
i've already install grub in a floppy image, but i don't know how to debug my kernel?
i did search how to solve it but it didn't work.
does anyone help me?how did you debug your kernel?
im a newbie.
Re: how can i debug a os with bochs?
Posted: Thu Mar 24, 2011 9:34 pm
by bewing
Are you going to be running the bochs on Linux, or on Windows?
First you need to "configure" the bochs download. Then you will need to compile it. Then you install it somewhere. Then you edit the .bochsrc file to tell it the name of your floppy image file. Then you run it, and it should pop up a couple of screens that show you a pretend computer booting your OS.
Re: how can i debug a os with bochs?
Posted: Thu Mar 24, 2011 9:45 pm
by j8long
bewing wrote:Are you going to be running the bochs on Linux, or on Windows?
First you need to "configure" the bochs download. Then you will need to compile it. Then you install it somewhere. Then you edit the .bochsrc file to tell it the name of your floppy image file. Then you run it, and it should pop up a couple of screens that show you a pretend computer booting your OS.
i know that.i use ubuntu now.
my problem is how to debug my kernel code.
do i need to run gcc with '-g' and ./configure --enable-gdb-stub ?
i did it before,but i can not see the asm code,just the c code.
when is use bochs in windows there is a bochsrgdb can step asm code one bye one.
what does i need to do under linux?
Re: how can i debug a os with bochs?
Posted: Thu Mar 24, 2011 10:46 pm
by bewing
bochs does not work very well with the gdb stub. You can try it, but I think you will have problems.
If you really want to know how to use bochs with gdb, say so and I will go and dig out my notes.
I think the easiest thing to do is:
./configure --target=pentium \
--enable-all-optimizations \
--enable-cpu-level=6 \
--enable-disasm \
--enable-debugger \
--enable-debugger-gui \
--enable-pci \
--enable-vbe \
--disable-readline \
--with-x \
--enable-cpp
And then in the .bochsrc file, you say:
display_library: x, options="gui_debug"
And that gets the local graphical debugger running, so you can singlestep the asm.
Alternately, you can get my "rebochs" program. It does all the same things, but faster. You can get it at
http://www.quokforge.org/projects/rebochs/files
It is much easier to set up than bochs.
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 1:56 am
by stlw
Is rebochs is able to boot WinXP for example ?
I am still wondering if "faster" means "faster to configure" or not. Without running any simple benchmark you won't know.
My estimations show that rebochs should be 2x-3x slower than similarly configured Bochs. Might be I am wrong, but I can't check it.
Stanislav
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 2:01 am
by stlw
bewing wrote:I think the easiest thing to do is:
./configure --target=pentium \
--enable-all-optimizations \
--enable-cpu-level=6 \
--enable-disasm \
--enable-debugger \
--enable-debugger-gui \
--enable-pci \
--enable-vbe \
--disable-readline \
--with-x \
--enable-cpp
And then in the .bochsrc file, you say:
display_library: x, options="gui_debug"
vbe option is deprecated in latest svn tree and should not be used anymore.
--enable-cpp option definitelly won't do anything good together with --with-x. The option would rename all the source .cc file to .cpp to help old crappy microsoft compilers (like Visual Studio 6.0). Any today Visual Studio works well without this option.
If you need x86-64 support add --enable-x86-64.
Stanislav
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 2:33 am
by j8long
i'll try it out,thks
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 2:51 am
by j8long
i add this line
display_library:x, options="gui_debug"
in bochsrc.but when i input bochs -f bochsrc
something is wrong with it.
Unknow x11 option "gui_debug"
what should i do?
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 3:40 am
by stlw
j8long wrote:i add this line
display_library:x, options="gui_debug"
in bochsrc.but when i input bochs -f bochsrc
something is wrong with it.
Unknow x11 option "gui_debug"
what should i do?
Start reading manuals instead
If you use win32, display_library:x is not a good option for you.
Stanislav
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 3:45 am
by j8long
stlw wrote:j8long wrote:i add this line
display_library:x, options="gui_debug"
in bochsrc.but when i input bochs -f bochsrc
something is wrong with it.
Unknow x11 option "gui_debug"
what should i do?
Start reading manuals instead
If you use win32, display_library:x is not a good option for you.
Stanislav
im using ubuntu.
i'll triy it out
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 4:46 am
by stlw
im using ubuntu.
i'll triy it out
Make sure you use Bochs with GUI debugger. Latest releast is always a best good option.
Stanislav
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 4:48 am
by j8long
stlw wrote:im using ubuntu.
i'll triy it out
Make sure you use Bochs with GUI debugger. Latest releast is always a best good option.
Stanislav
it doesnt work
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 12:11 pm
by Tosi
Read the manual.
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 3:51 pm
by Combuster
Re: how can i debug a os with bochs?
Posted: Fri Mar 25, 2011 9:54 pm
by j8long
it works now.
maybe some options of bochs is not supported .
i typed
Code: Select all
./configure --enable-debugger --enable-disasm