OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Aug 17, 2017 1:18 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 10:28 am 
Offline
Member
Member

Joined: Fri Aug 07, 2015 6:13 am
Posts: 821
I just wanted to share something really really interesting. I found out that Bochs has this really helpful GUI debugger. It can dump GDT, IDT, stack, page table, memory addresses. Very useful tool for somebody who knows how to use it. It is much simpler to use this GUI debugger than any other textual one.

Here is an example of what it can be used for:
GDT debugging:
[Picture 1: GDT loaded by GRUB]
Image
[Picture 2: a custom proper GDT]
Image

How to activate it:
Open your Bochs configuration file and paste this:
Code:
display_library: sdl, options=gui_debug
magic_break: enabled=1


By doing this you will automatically get this screen every time you run your OS In Bochs. Also by enabling so called magic break your OS will automatically stop and let you debug. You need to do
Code:
xchg bx, bx
in order to insert a breakpoint. (Assembly file)

i created this topic to show how amazed I was when I discovered it. This will make me stop hating debugging so much. :)

_________________
OS: Basic OS, Monolithic Kernel, Written in C++
Current Task: Physical Address Space Multi-functional Manager


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 11:56 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
octacone wrote:
This will make me stop hating debugging so much

You could have used gdb --tui with QEMU or something else too, it makes it a lot easier to use.

Also you didn't do a very good job of blurring out your code in the images, my eyesight is very poor and I can still make out most of the text :wink:

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 3:14 pm 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2070
Location: Bucharest, Romania
The Bochs GUI debugger was originally contributed by one of our members, bewing. Him and Stanislav (one of the two maintainers of Bochs and also a member of the forum) got into a disagreement so bewing stopped contributing and started working on his own emulator, ReBochs, which was supposed to be a faster Bochs with a less messy implementation. As far as I know, he is still working on it but development is rather slow so it's not a suitable replacement.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 4:04 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2940
Location: Chichester, UK
matt11235 wrote:
You could have used gdb --tui with QEMU or something else too, it makes it a lot easier to use.

gdb has the distinct advantage that you can debug at C source-code level as well as assembler level. And it has a very rich set of commands; a little difficult to get to grips with and learn, but well worth the effort.


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 4:42 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 02, 2016 1:52 pm
Posts: 286
Location: East Riding of Yorkshire, UK
iansjack wrote:
matt11235 wrote:
You could have used gdb --tui with QEMU or something else too, it makes it a lot easier to use.

gdb has the distinct advantage that you can debug at C source-code level as well as assembler level. And it has a very rich set of commands; a little difficult to get to grips with and learn, but well worth the effort.
The learning curve isn't too bad, there are only a few commands to learn and it's well worth the time.

_________________
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Wed Feb 22, 2017 8:20 pm 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2070
Location: Bucharest, Romania
I don't know why you're bringing GDB up. The OP specifically mentioned what the Bochs debugger is useful for---things that GDB can't do.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 12:49 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2940
Location: Chichester, UK
I didn't see anything mentioned that gdb can't handle.

Anyway, what's your problem with additional, related information?


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 12:59 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2070
Location: Bucharest, Romania
GDB doesn't know anything about CPU data structres such as descriptor tables, page tables, etc. The TUI version of GDB was mentioned as an alternative but it's really meant to solve a different problem.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 1:35 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7104
Location: Germany
Love4Boobies wrote:
GDB doesn't know anything about CPU data structres such as descriptor tables, page tables, etc.


If GDB runs in ring 0, like it does for DJGPP, it can display those structures. If GDB doesn't run in ring 0, you'd have to provide a syscall for reading those data structures -- which GDB in turn could use.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 1:44 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2940
Location: Chichester, UK
Let's not forget that qemu has it's own monitor. A combination of this with gdb is a very powerful tool.


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 7:17 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2070
Location: Bucharest, Romania
Interesting, I didn't know that. However, it still can't handle things like interrupts and other low-level things (some CPU-related, some not) even if it can display those structures.

There is no need to make a case about GDB being useful for systems debugging, I readily acknowledge that. You don't even need QEMU's monitor for it to be useful. In fact, I think it's way more useful than the Bochs debugger but the latter is useful for a different set of problems, still.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Thu Feb 23, 2017 11:38 am 
Offline
Member
Member

Joined: Wed Aug 17, 2016 4:55 am
Posts: 164
Or for that matter, act like one should stick to a single debugging tool and nothing else (which is how things seem to be worded here). I lost track of how many times gdb turned out to be utter trash for debugging my problems, and sometimes I resort to multiple tools to see what's going on.

_________________
https://github.com/sikthehedgehog/indigo


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Fri Feb 24, 2017 6:50 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2940
Location: Chichester, UK
Most of the posts here seem to be suggesting multiple tools rather than just the built-in Boch's debugger. Makes sense to me.


Top
 Profile  
 
 Post subject: Re: GUI Debugger Discovery
PostPosted: Fri Feb 24, 2017 10:16 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2070
Location: Bucharest, Romania
Maybe I should have gone the extra mile do explain that's my opinion as well from the beginning. :)

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group