Debuggers don't stop to breakpoints anymore

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
icecoder
Posts: 16
Joined: Tue Jun 15, 2010 3:28 am

Debuggers don't stop to breakpoints anymore

Post by icecoder »

Hi guys, I have a really absurd issue with ALL my virtual machines + gdb..

I have been working for years with qemu + gdb, and it worked perfectly, two days ago it started missing breakpoints..

I use NO kvm, start qemu with: "qemu -s -S -m 16 -hda image.img", then start gdb and connect to the process.
I only set one breakpoint to 0x7c00 (with the command "b *0x7c00") and press 'c'. It starts running, gdb stops to 0x7c00 but qemu keeps running.... When i step one instruction forward with gdb, it jumps to 0x000000a0 but it is not possible since the instruction at 0x7c00 is a MOV and the disassemble at that point shows the source correctly...

I thought was a qemu issue, so downloaded bochs.. Other strange thing: I start bochs, then run gdb and connect, set the bpoint and continue.. It recieves a SIGTRAP to 0x000e0000 (at which there is a code that is not mine..obviously..). If i continue again, the boot code is executed correctly but the breakpoint is never hit.

The problem is not in the source code since I edited/re-wrote it and even substituted it with a newly created 'hello world' boot code..

I'm starting to get mad..

I use:
Ubuntu 10.04 LTS
Kernel 2.6.32-22-generic
qemu 0.12.3 NO KVM
gdb 7.1
User avatar
AaronMiller
Member
Member
Posts: 81
Joined: Thu Mar 06, 2008 1:26 pm
Location: Roseville, California (USA)
Contact:

Re: Debuggers don't stop to breakpoints anymore

Post by AaronMiller »

That's interesting. Did you just install Ubuntu 10.04? I have a feeling it may be an issue with the environment or settings. What changed between then and now?
Tosi
Member
Member
Posts: 255
Joined: Tue Jun 15, 2010 9:27 am
Location: Flyover State, United States
Contact:

Re: Debuggers don't stop to breakpoints anymore

Post by Tosi »

I have the same trouble with Bochs on the same version of Ubuntu, but there's always a way around this kind of stuff.
What I do instead is enable magic breakpoints, which seems to work instead for some reason.
What you do is add this line to your .bochsrc:

Code: Select all

magic_break: enabled=1
And then anywhere in your code you want a breakpoint you make an "xchg bx,bx" opcode Bochs will automatically break after that instruction.
In gcc inline assembly, it's just this:

Code: Select all

asm volatile("xchg %bx, %bx");
When you run bochs, it will automatically stop when it hits that instruction and you can step/view registers like normal.
icecoder
Posts: 16
Joined: Tue Jun 15, 2010 3:28 am

Re: Debuggers don't stop to breakpoints anymore

Post by icecoder »

AaronMiller wrote:That's interesting. Did you just install Ubuntu 10.04? I have a feeling it may be an issue with the environment or settings. What changed between then and now?
Yes, I made a fresh install about a week ago, installed qemu and it worked nicely as always.. The strange thing is that bochs doesn't work properly too.. I'm thinking about some problem within the host kernel but it would not be usual, I know what i do when managing system files/updates and I'm absolutely sure I didn't edit anything that day.. I'm seriously thinking about installing the whole thing again..

@Tosi: thank you a lot, I didn't know about this feature, I never used bochs seriously since I normally am a qemu user, I'll surely try it until I find a solution or decide to install the os again..
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Re: Debuggers don't stop to breakpoints anymore

Post by pcmattman »

Try compiling QEMU from source (preferably git master) - better control over the configuration options. That, and the version of QEMU in the package repositories is always quite outdated in my experience.
icecoder
Posts: 16
Joined: Tue Jun 15, 2010 3:28 am

Re: Debuggers don't stop to breakpoints anymore

Post by icecoder »

pcmattman wrote:Try compiling QEMU from source (preferably git master) - better control over the configuration options. That, and the version of QEMU in the package repositories is always quite outdated in my experience.
Yes this worked, the apt repository version of qemu was outdated, I downloaded the tarball from qemu.org and compiled it, this was a bug in the application that has been fixed with version 0.12.4 (even if I continue wondering what happened to my working version..).

Maybe I encountered two distinct problems which were not connected each other.. Thank you for help guys.
Post Reply