qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Meador Inge <meadori@codesourcery.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 0/1] Fix GDB semihosting
Date: Thu, 16 Feb 2012 20:35:10 -0600	[thread overview]
Message-ID: <4F3DBCDE.2060707@codesourcery.com> (raw)
In-Reply-To: <CAFEAcA9c3r8Zue+=uT1N24yspGRp7D16FbOYLHZXRiB4L0vLRA@mail.gmail.com>

On 02/16/2012 01:08 PM, Peter Maydell wrote:

> On 16 February 2012 18:39, Meador Inge <meadori@codesourcery.com> wrote:
>> On 02/15/2012 02:14 PM, Peter Maydell wrote:
>>> I think the right way to deal with both the problem you were seeing
>>> and this related issue is simply not to try to send the syscall
>>> request until we have really stopped the CPU. That is, when not
>>> in CONFIG_USER_ONLY we should send the syscall request from
>>> gdb_vm_state_change().
>>
>> I agree.  I am doing some more testing and will send an official v2 patch
>> later, but just to make sure I am on the right track something like (this
>> worked in the basic testing I have done so far and avoids the pitfall pointed
>> out above):
> 
> That looks roughly OK, but:
>  * shouldn't gdb_syscall_buf[] be in GDBState ?
>  * I don't think the "are we stopping to do a syscall?" flag should be
>    implemented as an RSState enum -- that enum is for the
> parsing-incoming-packet
>    state machine

I cleaned up these bits.  v2 patch coming up soon.

> Bonus extra semihosting bug: if you start with "-gdb none" rather than "-s" then
> we segfault, because gdbserver_start() creates a GDBState with a NULL s->chr
> but use_gdb_syscalls() only looks at whether gdbserver_state is non-NULL, not
> whether s->state is RS_INACTIVE, so the first gdb_do_syscall() ends up
> dereferencing that NULL pointer. (Watch out when fixing this that you don't
> break semihosting in linux-user mode, because at the moment linux-user mode
> doesn't set up s->state at all so it's always RS_INACTIVE... We may also
> want to declare that mixing all of gdb, semihosting and fork() in a linux-user
> guest is not supported ;-))

I will take a look at that one as a separate patch :-)

-- 
Meador Inge
CodeSourcery / Mentor Embedded
http://www.mentor.com/embedded-software

      reply	other threads:[~2012-02-17  2:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 16:55 [Qemu-devel] [PATCH v1 0/1] Fix GDB semihosting Meador Inge
2012-02-15 16:55 ` [Qemu-devel] [PATCH v1 1/1] gdbserver: Keep VM state status replies from happening during a syscall Meador Inge
2012-02-15 17:54   ` Blue Swirl
2012-02-15 17:55     ` Meador Inge
2012-02-15 18:26 ` [Qemu-devel] [PATCH v1 0/1] Fix GDB semihosting Peter Maydell
2012-02-15 20:14   ` Peter Maydell
2012-02-16 18:39     ` Meador Inge
2012-02-16 19:08       ` Peter Maydell
2012-02-17  2:35         ` Meador Inge [this message]

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=4F3DBCDE.2060707@codesourcery.com \
    --to=meadori@codesourcery.com \
    --cc=peter.maydell@linaro.org \
    --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).