qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Wei Yang <weiyang.kernel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Failed to set a breakpoint on start_kernel
Date: Sat, 17 Mar 2012 14:31:29 +0100	[thread overview]
Message-ID: <4F649231.3060401@web.de> (raw)
In-Reply-To: <CADLM8XMYHH8ErMqYMYDPWPF_NB5=1RPLKqtcbVBucYuXCvDvTQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

[ re-added qemu-devel to CC ]

On 2012-03-17 13:10, Wei Yang wrote:
>> Two major issues with this procedure:
>>
>> 1. When using kvm, a soft breakpoint (as set by 'b') will inject a trap
>> instruction into the guest image - which is not yet loaded after the
>> bios ran. You need to use a hardware breakpoint in this case.
>>
>> 2. Due to gdb limitations, you cannot switch between 16/32-bit mode (the
>> CPU starts in 16 bit) and the 64-bit mode of kernel within the same gdb
>> session. Therefore:
>>  - let the target run into Linux is active
>>  - attach gdb
>>  - issue "hw start_kernel"
>>  - reboot (e.g. "monitor system_reset")
>>  - you will hit the breakpoint, and gdb will be usable
>>
>> Jan
>>
>>
> oh, so when qemu run with kvm enabled, I couldn't debug the kernel right?

That's not what I said. You need to be aware of how it works. And, in
contrast to pure emulation, kwm uses a non-transparent mechanism for
injecting software breakpoints. Consider it the price for the gained speed.

> 
> I tried to run qemu with out -enable-kvm, kernel could stop at the break point.
> 
> BTW, I tried "hw start_kernel", but it failed.
> (gdb) hw start_kernel
> Undefined command: "hw".  Try "help".

Sorry, typo. Must be "hb".

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2012-03-17 13:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-16  2:43 [Qemu-devel] Failed to set a breakpoint on start_kernel Wei Yang
2012-03-16 18:59 ` Mulyadi Santosa
2012-03-17  8:53 ` Jan Kiszka
2012-03-17 11:25   ` Laurent Vivier
2012-03-17 13:52     ` Jan Kiszka
2012-03-17 14:16       ` Wei Yang
2012-03-17 14:51         ` Jan Kiszka
     [not found]   ` <CADLM8XMYHH8ErMqYMYDPWPF_NB5=1RPLKqtcbVBucYuXCvDvTQ@mail.gmail.com>
2012-03-17 13:31     ` Jan Kiszka [this message]
2012-03-17 14:01       ` Wei Yang

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=4F649231.3060401@web.de \
    --to=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    --cc=weiyang.kernel@gmail.com \
    /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).