Page 1 of 6

Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 4:34 pm
by bewing
This app has been fully incorporated into the most recent version of bochs (anything 2.4 or higher). -- This thread is now obsolete. Please download either bochs at sourceforge, or bebochs to get an emulator with a very nice GUI frontend.

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 5:20 pm
by Alboin
I have tried compiling it. Two things:
-You have cast gpointers to ints. This fires an error that can be fixed with the GPOINTER_TO_INT macro. (Should work - gets rid of the error.)
-Some of the bx_ structures are found to be undeclared, and bx_simulator_interface_c does not seem to have debug_break. Where are these declared when compiling the file solo?

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 5:32 pm
by bewing
Which compiler are you using, to have that warning with casts? I'll take your advice and change it, certainly.

debug_break() is defined in siminterface.cc only if the BX_DEBUGGER #ifdef gets set -- did you remember to turn on --enable-debugger? All the other "not found" definitions are surrounded by that same #ifdef.

("warning: deprecated conversion from string constant to 'char*'" :P *phblbltltlt* to ANSI/ISO!! :evil: )

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 5:39 pm
by Alboin
Which compiler are you using, to have that warning with casts? I'll take your advice and change it, certainly

Code: Select all

bash-3.2$ gcc -v              
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared --enable-languages=c,c++,fortran,objc,obj-c++,treelang --enable-threads=posix --mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit --disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.3.2 (GCC)
debug_break() is defined in siminterface.cc only if the BX_DEBUGGER #ifdef gets set -- did you remember to turn on --enable-debugger?
Well, if I compile enh_dbg.cc with -DBX_DEBUGGER, I get:

Code: Select all

bash-3.2$ g++ -c  -I.. -I../iodev -I../instrument/stubs -O3 -Wall -Wno-format -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/usr/X11R6/include  enh_dbg.cc -o enh_dbg.o `pkg-config --cflags gtk+-2.0` -DBX_DEBUGGER
In file included from enh_dbg.cc:8:
../config.h:648:1: warning: "BX_DEBUGGER" redefined
<command-line>: warning: this is the location of the previous definition
So, I believe it's defined. ;)

EDIT: Also, not to 'knit-pick', but in your instructions, under Compilation, the example line has newlines and -march. This works on my box:

Code: Select all

g++ -c  -I.. -I../iodev -I../instrument/stubs -O3 -Wall -Wno-format \
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -I/usr/X11R6/include  enh_dbg.cc -o \
enh_dbg.o `pkg-config --cflags gtk+-2.0`

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 5:57 pm
by piranha
I don't think this is an error with your stuff, but when compiling I do get

Code: Select all

g++ -c -I.. -I./.. -I../instrument/stubs -I./../instrument/stubs -I. -I./. -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES   symbols.cc -o symbols.o
In file included from /usr/include/c++/4.3/backward/hash_map:64,
                 from symbols.cc:86:
/usr/include/c++/4.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.
symbols.cc:143: error: ISO C++ forbids declaration of ‘hash_map’ with no type
symbols.cc:143: error: expected ‘;’ before ‘<’ token
symbols.cc:150: error: expected constructor, destructor, or type conversion before ‘<’ token
symbols.cc: In constructor ‘context_t::context_t(Bit32u)’:
symbols.cc:158: error: ‘map’ was not declared in this scope
symbols.cc: In static member function ‘static context_t* context_t::get_context(Bit32u)’:
symbols.cc:180: error: ‘map’ was not declared in this scope
-JL

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 6:10 pm
by bewing
@piranha: Yeah, that file is part of bochs -- not part of my code or modifications at all. There is a vector/header file called <hash_map.h> -- it looks to me like yours is defective, since hash_map is not being pre-defined for the compiler, and is generating an error when it is being used. I would suggest that you go into your config.h file, around line 897, and set BX_HAVE_HASH_MAP to 0. That will get rid of your error, I think, and shouldn't have any real effect on how bochs runs.
Stanislav will need to look at this too, and may have a better answer for you.

@Alboin: woops about the -march. I'll fix that. I wasn't exactly intending for people to simply cut and paste the command out of my instructions with no modification, but I suppose I'll put the backslashes in, too. :wink:
To specifically answer your question, when my code is compiled standalone, the initial definition of debug_break() comes from line 1184 of siminterface.h of the bochs code.

Could you please take a look at line 648 of your config.h and tell me what the VALUE assigned to BX_DEBUGGER is?

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 7:26 pm
by Alboin
/smacks head. I feel like an idiot. Many sorries. #-o I must have misspelled something when I configured it all.....

Anywho......

After fixing all of the gpointer issues, I now get the same thing as piranha. (Which I am now fixing since people keep CHANGING their posts...not that there's anything wrong with that...)

EDIT: Okay. Now, I get:

Code: Select all

g++ -o bochs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DBX_SHARE_PATH=\"/usr/local/share/bochs\" logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o -Wl,--export-dynamic  iodev/libiodev.a bx_debug/libdebug.a cpu/libcpu.a memory/libmemory.a gui/libgui.a disasm/libdisasm.a fpu/libfpu.a -lSM -lICE -lX11 -lXpm -lreadline -lm
gui/libgui.a(x.o): In function `x11_notify_callback(void*, BxEvent*)':
/home/matt/Desktop/bochs-2.3.7/gui/x.cc:2574: undefined reference to `ParseIDText(char*)'
/home/matt/Desktop/bochs-2.3.7/gui/x.cc:2559: undefined reference to `HitBreak()'
gui/libgui.a(x.o): In function `bx_x_gui_c::specific_init(int, char**, unsigned int, unsigned int, unsigned int)':
/home/matt/Desktop/bochs-2.3.7/gui/x.cc:654: undefined reference to `InitDebugDialog(void*)'
collect2: ld returned 1 exit status
make: *** [bochs] Error 1
I feel so needy...Sorry. 8)

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 7:40 pm
by bewing
Alboin wrote:/smacks head. I feel like an idiot. Many sorries. #-o I must have misspelled something when I configured it all.....
Not a problem. :D I need to know the kinds of errors that people get in reality. So you smart osdevers get to be the guinea pigs, and then I will know how to solve some issues when the noobies come along.
After fixing all of the gpointer issues, I now get the same thing as piranha. (Which I am now fixing since people keep CHANGING their posts
Yeah, I'm very bad about that! :lol:

As for your current error, you forgot to include gui/enh_dbg.o in the "LIBS =" line. :wink:
Those 3 functions are the only external links from bochs into my debugger.
PLEASE let me know if you get it to compile successfully!

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 8:00 pm
by Alboin
Blah...afraid not. :(

Code: Select all

g++ -o bochs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DBX_SHARE_PATH=\"/usr/local/share/bochs\" logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o gui/enh_dbg.o -Wl,--export-dynamic  iodev/libiodev.a bx_debug/libdebug.a cpu/libcpu.a memory/libmemory.a gui/libgui.a disasm/libdisasm.a fpu/libfpu.a -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lSM -lICE -lX11 -lXpm -lreadline -lm
Gives me a bunch of undefined references to boch's functions in gui/enh_dbg.o...

-lpthread seems to be missing as well.

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 8:13 pm
by bewing
Alboin wrote:

Code: Select all

g++ -o bochs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DBX_SHARE_PATH=\"/usr/local/share/bochs\" logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o gui/enh_dbg.o -Wl,--export-dynamic iodev/libiodev.a bx_debug/libdebug.a cpu/libcpu.a memory/libmemory.a gui/libgui.a disasm/libdisasm.a fpu/libfpu.a -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lSM -lICE -lX11 -lXpm -lreadline -lm
Gives me a bunch of undefined references to boch's functions in gui/enh_dbg.o...

-lpthread seems to be missing as well.
Yes, it is likely that you need to add -lpthread to the LIBS= line, manually.

Can you give me a few function names of the undefined references, please? I'd like to see if there is some connection (like another #ifdef) between them.

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 8:14 pm
by Alboin

Code: Select all

enh_dbg.cc:(.text+0x297c): undefined reference to `num_write_watchpoints'
enh_dbg.cc:(.text+0x2982): undefined reference to `num_read_watchpoints'
enh_dbg.cc:(.text+0x29a6): undefined reference to `write_watchpoint'
enh_dbg.cc:(.text+0x29c2): undefined reference to `write_watchpoint'
enh_dbg.cc:(.text+0x29ec): undefined reference to `read_watchpoint'
gui/enh_dbg.o: In function `FillAsm(unsigned long, int)':
enh_dbg.cc:(.text+0x8ac0): undefined reference to `bx_cpu_array'
enh_dbg.cc:(.text+0x8bae): undefined reference to `disassembler::disasm(unsigned int, unsigned int, unsigned long, unsigned long, unsigned char const*, char*)'
enh_dbg.cc:(.text+0x8d7b): undefined reference to `bx_cpu_array'
enh_dbg.cc:(.text+0x8d8c): undefined reference to `bx_cpu_c::dbg_xlate_linear2phy(unsigned long, unsigned int*)'
gui/enh_dbg.o: In function `FillBrkp()':
enh_dbg.cc:(.text+0x9b1e): undefined reference to `num_read_watchpoints'
enh_dbg.cc:(.text+0x9b55): undefined reference to `read_watchpoint'
enh_dbg.cc:(.text+0x9d4e): undefined reference to `num_write_watchpoints'
enh_dbg.cc:(.text+0x9d85): undefined reference to `write_watchpoint'
gui/enh_dbg.o: In function `FillPAGE()':
enh_dbg.cc:(.text+0x9ef9): undefined reference to `bx_cpu_array'
enh_dbg.cc:(.text+0x9f0c): undefined reference to `bx_cpu_c::dbg_xlate_linear2phy(unsigned long, unsigned int*)'

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 9:00 pm
by bewing
And in config.h in the main bochs dir, what are your current values for BX_DEBUGGER, BX_DISASM, and BX_SUPPORT_SMP?

(Or maybe you could just post your config.h for me?)

Re: Bochs GUI for LINUX

Posted: Sat Dec 06, 2008 9:24 pm
by Alboin
Okay, enabling SMP seems to get rid of some of the errors.

config.h attached as requested.

Re: Bochs GUI for LINUX

Posted: Sun Dec 07, 2008 1:20 am
by bewing
With one small change, I just used your exact compilation statement to create a working copy of bochs. I don't see how the one small change would have made a difference -- but on my system, it will not compile until I put -L/usr/X11R6/lib in front of the -lSM argument.

What that means to me is that somehow your enh_dbg.o file (that you compiled separately) ended up not being compatible with the .o files that were created by make. Almost like they were compiled by different compilers or something.

But the basic point is that I am completely unable to duplicate your problem. Stanislav will probably be here soon, and hopefully he will have more of a clue than I do.

Your config.h looks good to me. I hope that enh_dbg.o was compiled with the same config.h as the rest of bochs. :wink:

Re: Bochs GUI for LINUX

Posted: Sun Dec 07, 2008 3:42 am
by Brendan
Hi,

I'm getting undefined references in "enh_dbg.cc" too...

Code: Select all

g++ -o bochs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DBX_SHARE_PATH=\"/usr/local/share/bochs\" logio.o main.o config.o load32bitOShack.o pc_system.o osdep.o plugin.o crc.o gui/enh_dbg.o -Wl,--export-dynamic  iodev/libiodev.a bx_debug/libdebug.a cpu/libcpu.a memory/libmemory.a gui/libgui.a disasm/libdisasm.a fpu/libfpu.a -L/usr/lib64 /usr/lib64/libSM.so /usr/lib64/libICE.so /usr/lib64/libXpm.so -lreadline -lpthread /usr/lib64/libgtk-x11-2.0.so /usr/lib64/libgdk-x11-2.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libpangoft2-1.0.so /usr/lib64/libpango-1.0.so /usr/lib64/libcairo.so /usr/lib64/libfontconfig.so /usr/lib64/libfreetype.so /usr/lib64/libexpat.so /usr/lib64/libpng12.so -lz /usr/lib64/libXrender.so /usr/lib64/libX11.so /usr/lib64/libXau.so /usr/lib64/libXdmcp.so /usr/lib64/libpixman-1.so -lm /usr/lib64/libgobject-2.0.so /usr/lib64/libgmodule-2.0.so -ldl /usr/lib64/libglib-2.0.so -Wl,--rpath -Wl,/usr/lib64 -Wl,--rpath -Wl,/usr/lib64
gui/enh_dbg.o: In function `Close_cb(_GtkWidget*, void*)':
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg_os_specific.h:1341: undefined reference to `debug_cmd_ready'
gui/enh_dbg.o: In function `VGAWrefreshTick':
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg_os_specific.h:1621: undefined reference to `vgaw_refresh'
gui/enh_dbg.o: In function `doStepN()':
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2364: undefined reference to `debug_cmd_ready'
gui/enh_dbg.o: In function `ActivateMenuItem(int)':
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2928: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2932: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2933: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2934: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2941: undefined reference to `debug_cmd_ready'
gui/enh_dbg.o: In function `HotKey(int, int, int, int)':
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2772: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2776: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2833: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2835: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2836: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2837: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2844: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2883: undefined reference to `debug_cmd_ready'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2904: undefined reference to `debug_cmd'
/home/bcos/Desktop/bochage/bochs-20081201/gui/enh_dbg.cc:2905: undefined reference to `debug_cmd_ready'
collect2: ld returned 1 exit status
make: *** [bochs] Error 1
I started with the CVS Snapshot (from Mon Dec 1 19:20:45 UTC 2008), and did "./configure --enable-debugger --enable-disasm --with-x --enable-smp". Then I fixed all the errors related to type casts using "GPOINTER_TO_INT", and changed line 50 of "wenhdbg_h.h" to "#include "../iodev/iodev.h"" because it complained about not being able to find "iodev.h".

I compiled enh_dbg.cc with "g++ -c -I.. -I./.. -I../instrument/stubs -I./../instrument/stubs -I. -I./. -I./stubs -I././stubs -g -O2 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES enh_dbg.cc -o enh_dbg.o `pkg-config --cflags gtk+-2.0`". Then I tried a "make bochs" and got the undefined references above...


Cheers,

Brendan