Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lerele <lerele@champenstudios.com>
To: Pedro Alves <pedro_alves@portugalmail.pt>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] New gdbserver Win32 interrupt code
Date: Sun, 04 Nov 2007 12:40:00 -0000	[thread overview]
Message-ID: <472DBDB3.1040602@champenstudios.com> (raw)
In-Reply-To: <472D2E1B.2020203@portugalmail.pt>


> Welcome back!
>
Thanks!

> I also implemented the synthetic suspending here, because soon
> after that thread, I had a need for it in WinCE.  Unfortunatelly, I got
> distracted with other things and never submitted.  I hate it when
> work gets duplicated  :(
Yep, me too. :(
There's one benefit though, which is that things that slip through one's 
mind, may not through the other's. Merging may give us the super-patch! ;)


>
> At a quick glance, I think your patch should be at least split
> in 3.
You mean three different patches? Submitted individually?
I didn't submit thread pause counting separately, as it was a really 
simple fix (one line).
I'll write that down for next time.


>
> 1 - the synthetic suspending
>
>   On WinCE, the synthetic suspending is also needed when
> attaching, since in opposition to 9xNT, the OS doesn't stop
> the inferior at all (neither when attaching nor running).
> If you're OK with it, I'll clean up my patch a bit, and merge
> with your bits so 1 can go in first.  It will be easier for me
> this way, since I've already taken care of the function
> reusing and ifdefing minimising.  I'll then volunteer to
> clean up the rest of your patch for you, as a reward for
> you patience  ;)
>
Sure, no problem with that.
When you do so, please note that in the patch main pausing function 
synthetic_child_interrupt, which just pauses or resumes the child 
process, every single line is important (at least for Win32) and is 
there for a reason, as is also the order of calls, according to the 
conversation in the old thread.

I'd like to know what you are referring to when you say clean up the 
rest of my patch. I took care of properly formatting code, full stops, 
and even fixed some previous erroneous code indentation and formatting. 
I'd like to know, what is it I missed that you are talking about?
I'd also like to know what ifdefing in the patch I submitted that you 
don't like. The NEW_INT macro is the only one I sent, and I left it 
there just in case this new interrupt code isn't suitable for all, but 
can be removed easily.

Also, note that I did not include this synthetic_child_interrupt into 
separate architecture files (i386/arm) because of one of the benefits of 
this pausing method, which is portability among Windows versions, and 
this new code is compatible from Win95 and newer, however I don't know 
about WinCE.


> 2 - the suspend count handling
>
>   This is also a problem in native debugging
>   (gdb/win32-nat.c).  I also saw this when doing my version

Yes, actually when I wrote win32 gdbserver port, I started from 
modifying gdb/win32-nat.c, and the thread_rec function if I remember 
right is the same one, apart from the arch (i386/arm) modifications you 
made, so truly the problem must be there in native gdb too.
By the way, maybe this interrupt method could be of interest for native 
Win32 gdb.
If so, should we handle the native win32 patch, or should that be done 
by their respective maintainers?

Also note, that this problem is not a problem I have seen to fail in 
practice, so maybe it isn't a problem at all (for some reason). This fix 
is just something I noticed when I wrote the new interrupt function, 
which ultimately relies on thread_rec function.


>   of 1.  I got a chance to look at the logs of the native
>   WinCE debugger, and could infer that it also takes care of
>   this correctly.  The way they do it, is to read the current
>   suspend count by always doing a SuspendThread + ResumeThread
>   sequence on a debug event (ResumeThread return the current
>   suspend count).
But isn't this wrong too, according to my explanation in my previous 
message?
The problem actually is that when resuming a thread in win32-nat.c, in 
function continue_one_thread, which resumes a thread suspend_count 
times, which itself was being set to the number of suspends of the 
thread as reported by Windows, so for example if the client app had a 
thread, say suspended 2 times, and then gdbserver suspends the thread 
again, the internal gdbserver count would be 3, and when resuming it, 
gdbserver would wake it up three times, which is wrong because the child 
wanted it to be suspended 2 times.


>
> 3 - the elevation
>
What do you mean by this?


Regards,
Leo.



  reply	other threads:[~2007-11-04 12:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-04  1:28 Lerele
2007-11-04  2:27 ` Pedro Alves
2007-11-04 12:40   ` Lerele [this message]
2007-11-04 17:22     ` Pedro Alves
2007-11-04 19:54       ` Lerele

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=472DBDB3.1040602@champenstudios.com \
    --to=lerele@champenstudios.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro_alves@portugalmail.pt \
    /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