qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Eddie Kohler <kohler@cs.ucla.edu>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH] i386 debugging stubs: Consider segment bases
Date: Sun, 26 Sep 2010 08:44:31 +0200	[thread overview]
Message-ID: <4C9EEBCF.5080904@web.de> (raw)
In-Reply-To: <4C9DB45B.7080609@cs.ucla.edu>

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

Am 25.09.2010 10:35, Eddie Kohler wrote:
> Thanks for the response.  I agree the patch is a workaround, but it is a
> useful workaround, and I'd still argue for including it.

Nope, sorry, I have to vote against this.

> 
> The patch doesn't *require* that CS.base == DS.base.  Breakpoints

It does. There are several parts in QEMU that use cpu_memory_rw_debug
for reading or writing code segment: the disassembler, KVM when
manipulating soft breakpoints, and also the TB flushing on breakpoint
changes relies on cpu_get_phys_page_debug and would break when using DS
as base.

> correctly and exclusively use CS.base.  However, any memory examination
> uses DS.base, and you're right that the user might "want" to examine
> some other segment.  A GDB fix would involve changing the gdb remote
> protocol as well as GDB itself and the GDB user interface.  Google says
> you've been thinking about that for a while now -- is it going well?

It's on a long list of things that would be nice to work on...

> 
>> For the time being, you should be able to workaround the gdb limitation
>> by setting two breakpoints: one on the linear address and another one on
>> the CS offset. Not nice, but used to work for us.
> 
> I don't mind the double-breakpoint as much, but memory examination would
> still be broken, yes?

Issue "monitor info registers", extract the segment base, add it to the
variable address you are interested in, and issue a print request. It is
definitely not impossible, just "a bit" unhandy.

> 
> I don't understand the comment about "prevents setting breakpoints on
> inactive segments."  The code for setting breakpoints has not changed.

It has because you unconditionally subtract the CS base from the passed
address. If you want to set a breakpoint on some other CS, you would
have to account for their base offsets and pass a weirdly "corrected"
address from gdb. That's really no sane interface, specifically long-term.

> 
> Do you think the patch would actually make debugging WORSE on any OS? Or
> have any other undesirable effects, or make it harder to DTRT when GDB
> is ready?  It seems safe & useful to me; & it's 2 LOC!

The pathes change the interface to gdb by re-defining the semantics of
the passed addresses in way that is not future-proof, and they are buggy.

Jan


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

  reply	other threads:[~2010-09-26  6:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25  0:25 [Qemu-devel] [PATCH] i386 debugging stubs: Consider segment bases Eddie Kohler
2010-09-25  7:22 ` [Qemu-devel] " Jan Kiszka
2010-09-25  8:35   ` Eddie Kohler
2010-09-26  6:44     ` Jan Kiszka [this message]
2010-09-26 17:19       ` Eddie Kohler
2010-09-27  6:29         ` Jan Kiszka

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=4C9EEBCF.5080904@web.de \
    --to=jan.kiszka@web.de \
    --cc=kohler@cs.ucla.edu \
    --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).