From: Jan Kiszka <jan.kiszka@web.de>
To: Francis Moreau <francis.moro@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Failed to use gdb with qemu 15.1 (with and without kvm support)
Date: Sun, 22 Jan 2012 20:28:02 +0100 [thread overview]
Message-ID: <4F1C6342.7020404@web.de> (raw)
In-Reply-To: <CAC9WiBh6DVUr5rCEEvmvYeJ_b2PgiwCw7XDj7Hw5jYz6ONLj+g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2321 bytes --]
On 2012-01-22 20:25, Francis Moreau wrote:
> Hello,
>
> Thanks for you hints !
>
> On Sun, Jan 22, 2012 at 7:49 PM, Jan Kiszka <jan.kiszka@web.de> wrote:
>> On 2012-01-22 15:20, Francis Moreau wrote:
>>> Hello,
>>>
>>> I'm trying to debug a 64 bits kernel (3.2) using qemu (with and
>>> without KVM support). The host is also 64 bits. Version of gdb I'm
>>> using is 7.1.
>>>
>>> To do that I simply start qemu like the following:
>>>
>>> $ qemu-system-x86_64 -kernel bzImage -append "root=/dev/sda1
>>> console=ttyS0 3" -serial stdio -S -s
>>>
>>> and in another term, I start gdb like this:
>>>
>>> $ gdb vmlinux
>>> $ target remote locahost:1234
>>> $ b prepare_namespace
>>> $ continue
>>> Continuing.
>>> Remote 'g' packet reply is too long: af75919effffffff0.............
>>>
>>> So it fails when gdb stops on the breakpoint with the above message.
>>>
>>> If I try to dump the backtrace I got:
>>>
>>> $ bt
>>> Target is executing.
>>> $ info thread
>>> * 1 Thread 1 (CPU#0 [running]) (running)
>>>
>>> But the VM seems to be stopped because if I'm asking the status to qemu:
>>>
>>> $ info status
>>> VM status: paused
>>>
>>> I also tried qemu with KVM support but I get one more problem: gdb is
>>> ignoring my breakpoint.
>>>
>>> Could anybody help me to make gdb work ?
>>
>> When stopping the guest with -S before it booted, gdb will interrupt it
>> while it is still in 16-bit real mode. Later on, when Linux runs, the
>> guest is in 64-bit protected mode. gdb is not prepared for such a
>> switch. All you can do:
>>
>> - let the guest run until it surely reached 64-bit mode
>> - interrupt it and set a breakpoint at the desired early-boot location,
>
> So I let the kernel boot, and then I'm trying to start and connect gdb
> to qemu but unfortunately gdb is segfaulting when trying to connect :(
Try gdb 7.3 or even latest development version (the latter is required
for module debugging - just in case).
>
>> important: if using KVM, set a hardware breakpoint!
>
> ah ok good to know, I'll try to use hw breakpoints.
The reason is that software breakpoints are implemented under kvm by
patching breakpoint instructions into the guest - and those get
overwritten when reloading the kernel after reboot.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-01-22 19:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-22 14:20 [Qemu-devel] Failed to use gdb with qemu 15.1 (with and without kvm support) Francis Moreau
2012-01-22 17:11 ` Michael Tokarev
2012-01-22 19:11 ` Francis Moreau
2012-01-22 19:36 ` Michael Tokarev
2012-01-22 18:49 ` Jan Kiszka
2012-01-22 19:16 ` Max Filippov
2012-01-22 19:21 ` Jan Kiszka
2012-01-22 19:58 ` Francis Moreau
2012-01-22 21:15 ` Jan Kiszka
2012-01-23 7:55 ` Francis Moreau
2012-01-22 19:29 ` Francis Moreau
2012-01-22 19:25 ` Francis Moreau
2012-01-22 19:28 ` Jan Kiszka [this message]
2012-01-22 19:57 ` Francis Moreau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F1C6342.7020404@web.de \
--to=jan.kiszka@web.de \
--cc=francis.moro@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).