qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Trouble with GDB & Some 'Can it be done' Debugging question


From: Steve Ellenoff
Subject: [Qemu-devel] Trouble with GDB & Some 'Can it be done' Debugging questions
Date: Wed, 19 Jul 2006 08:43:57 +0000

Hi -

I'm having a bit of trouble getting gdb to do what I was hoping it would with qemu. Following the instructions in the docs:

#1) I launch qemu with -S -s flags ( since I want to trace the bootloader code ) It says: Waiting gdb connection on port 1234 - which is correct, and it opens the monitor window.

#2) I open a second terminal window and type gdb vmlinux
It displays:
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...vmlinux: No such file or directory.

Notice the last part saying it can't find file or directory vmlinux. What am I doing wrong here?

#3) Anytime I try to dump the instruction at the current IP such as:
(gdb) x /10i $eip

I get this - which means it's not actually reading or displaying the memory properly, since those look to be what you would see if it was all 0 in memory (or maybe it's all 0xff - whichever).l

0xe05f: add    %al,(%eax)
0xe061: add    %al,(%eax)
0xe063: add    %al,(%eax)
0xe065: add    %al,(%eax)
0xe067: add    %al,(%eax)
0xe069: add    %al,(%eax)
0xe06b: add    %al,(%eax)
0xe06d: add    %al,(%eax)
0xe06f: add    %al,(%eax)
0xe071: add    %al,(%eax)

So what is the problem here? If I use the QEMU monitor, the dump is correct and shows real instructions.

This leads to my next question:

#4) Can you use gdb to debug and set breakpoints on binary code you don't have any source code or other file for the binary, except the binary file itself? Everything I've read so far on GDB (and especially any GDB Gui front end) seems to suggest it's not possible. That would really suck.

This is easy as pie to do in Bochs since it has a built in debugger (similar to monitor, but far more capable, such as setting break points and stuff).

After hours of googling I'm beginning to wonder if it can be done in GDB - ESPECIALLY setting breakpoints on the code hitting certain memory addresses, ie, the EIP hitting certain values such as 0xc000 for example. Surely it must be able to do this, and i'm just too unfamiliar with gdb to know how.

PS - I'm still quite new to qemu and also linux, so please keep that in mind. QEMU was actually the first time I really had a good reason to sit down and check out linux. I'm glad I did, I like a lot of things about it so far, though being a novice sucks, when I'm used to being a superguru in Windoze.

I hope someone can shed some light for me on these many questions!

Thank you for any help-
-Steve






reply via email to

[Prev in Thread] Current Thread [Next in Thread]