Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pierre Muller" <muller@ics.u-strasbg.fr>
To: <gdb-patches@sourceware.org>
Subject: RE: [RFA-v2] windows-nat.c Cygwin saved_context fix
Date: Tue, 22 Sep 2009 22:35:00 -0000	[thread overview]
Message-ID: <001c01ca3bd4$f4409860$dcc1c920$@u-strasbg.fr> (raw)
In-Reply-To: <20090922133158.GF28499@ednor.casa.cgf.cx>



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Christopher Faylor
> Envoyé : Tuesday, September 22, 2009 3:32 PM
> À : gdb-patches@sourceware.org; Pierre Muller
> Objet : Re: [RFA-v2] windows-nat.c Cygwin saved_context fix
> 
> On Tue, Sep 22, 2009 at 01:01:13AM +0200, Pierre Muller wrote:
> >After testing,
> >setting suspended field to -1
> >seems to work equally well for me.
> >
> >  Here is an updated patch:
> >
> >
> >2009-09-22  Pierre Muller  <muller@ics.u-strasbg.fr>
> >
> >	* windows-nat.c (saved_threadid): New variable.
> >	(do_windows_fetch_inferior_registers): Check for correct thread
> id
> >	and set suspended field to -1 if it is zero.
> >	(handle_output_debug_string): Set saved_threadid.
> 
> Please try my previous suggestion of removing the have_saved_context =
> 0;

Christopher, 
I will try to explain what happens if 
you just remove the 'have_saved_context = 0'.

  The first time you call do_windows_fetch_inferior_registers
the copied context does copy the saved_context to the
context struct inside *current_thread.
  So far, so good...

  If there is any call to thread_rec with get_context=1,
this will set current_thread->reload_context to 1 again,
because current_thread->suspended is still 0.
  This means that the next call to do_windows_fetch_inferior_registers
will again write saved_context to current_thread->context.
  This still looks good, but it will fail
if we try to change any of these registers,
  for instance (gdb) set $ebp = 0
windows_store_inferior_registers callsthread_rec with get_context=1
which again sets current_thread->reload_context to 1.
Then the current_thread->context.Ebp gets changed to 0,
but set_command later calls a cascade of frame functions
that end up by refetching $eip, at which point
current_thread->context.Ebp  gets restored to the value in 
saved_context.
  
  Finally the change of $ebp register failed.
This can be avoid with the second patch I sent,
that sets suspended to -1.

Pierre



  reply	other threads:[~2009-09-22 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-21 15:15 [RFA] windows-nat.c Cygwin save_context fix Pierre Muller
2009-09-21 22:26 ` Christopher Faylor
2009-09-21 22:35   ` Pierre Muller
2009-09-21 23:01     ` [RFA-v2] windows-nat.c Cygwin saved_context fix Pierre Muller
2009-09-22 13:32       ` Christopher Faylor
2009-09-22 22:35         ` Pierre Muller [this message]
2009-09-22 13:30     ` [RFA] windows-nat.c Cygwin save_context fix Christopher Faylor

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='001c01ca3bd4$f4409860$dcc1c920$@u-strasbg.fr' \
    --to=muller@ics.u-strasbg.fr \
    --cc=gdb-patches@sourceware.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