From: Lerele <lerele@champenstudios.com>
To: Lerele <lerele@champenstudios.com>, gdb-patches@sourceware.org
Subject: Re: [win32] Fix suspend count handling
Date: Sun, 25 Nov 2007 14:44:00 -0000 [thread overview]
Message-ID: <47498A4F.3050101@champenstudios.com> (raw)
In-Reply-To: <20071124204828.GB4928@ednor.casa.cgf.cx>
Christopher Faylor escribió:
> On Sat, Nov 24, 2007 at 03:18:42PM +0100, Lerele wrote:
>
>>>> Christopher Faylor escribi?:
>>>>
>>>>> I have to ask, however, if the SuspendThread's are even needed at all.
>>>>> When I was writing this code, I wasn't entirely sure that gdb needed to
>>>>> do anything like this but I erred on the side of caution. So, I'm
>>>>> wondering if things would still work ok if the
>>>>> SuspendThread/ResumeThread stuff was gone.
>>>>>
>>>>>
>>>> I think they are needed. They were anyway with the new gdbserver based
>>>> (vs. Win32 API based) interrupt code I sent several days ago, and that
>>>> so very kindly Pedro prepared for commitment, but that I still haven't
>>>> found the time to sit down and look at them (however I'm absolutely
>>>> sure they're just fine), I guess his changes must be similar to what I
>>>> sent in the first place.
>>>>
>>>>
>>> *Why* did you think you needed them in gdbserver? Did you actually try
>>> not using them or did you just copy my code from win32-nat.c?
>>>
>> I thought it natural to implement win32 functionality into gdbserver not
>> starting from scratch, but from an already working implementation, such as
>> win32-nat.c, however *truly* one drawback of this is that original code
>> bugs got inherited into new implementation (such as the subject in
>> question), and the porting process however was not really as
>> straightforward as copy/paste; certain amount of work was involved (a lot
>> of debugging gdbserver and gdb themselves), however I did not stop to think
>> that SuspendThread was not actually needed, as it was already there.
>>
>
> So, in answer to my question about whether something was needed or not,
> you asserted that it wasn't needed because you copied the code that I
> wrote which was the source of my question. Sorry but that doesn't really
> answer my question.
>
>
Sure I did, however the situation seems a bit more complicated. I'll
explain below.
> If Windows already does the SuspendThread on all threads on debug event
> then there is no reason to also do it in gdb. I was asking if anyone
> had actually checked if that was the case since it has been quite some
> time since I did any experiments.
>
>
What I said basically is that it is safer to leave the SuspendThread
there as, besides being safer, it may be required for any future
enhancement.
Also, upon reception of a Win32 debug event, calling SuspendThread
should not do any harm, as the threads are already paused.
It is also the basis of the new interrupt method, which is SuspendThread
based.
In my previous message, in the paragraph I wrote:
"Apart from this, there's also the case where (at least for gdbserver)
socket data is received asynchronously while the child is running. This
socket data could indicate gdbserver to set/enable/disable a breakpoint,
read thread registers, etc., and this kind of things may require to stop
the child using SuspendThread.
Right?"
I was refering a specific gdbserver functionality that for some reason
is not currently working for current cvs gdbserver.
In fact right now I do not actually know for sure if this functionality
ever worked for cvs gdb and got broken, or it is based on local
modifications I have made to gdbserver.
Please let me clarify:
I have a gdbserver.exe version here that lets you set breakpoints into
the child while the child is running (without having to interrupt the
child --if you can, set breakpoint and continue the child).
For this functionality to work socket data availability check must be
done somewhere in the WaitForDebugEvent loop/call trace.
I think however that what I did was have get_child_debug_event return a
"spurious" signal periodically to have gdbserver check for this socket
data and act accordingly to this received data.
The really important thing is that in this case, no Win32 debug event
was received (and the child was still running), so when gdbserver wanted
to access the thread, the thread_rec function was ultimately called,
which itself calls SuspendThread.
So in this case calling SuspendThread *is* necessary.
Now as to the reason why this is not working, I think it's pointless to
figure why I have a local gdbserver that asynchrounously lets you set
breakpoints, or try figure out if some older official gdbserver version
ever had this support.
It is not currently working, and I think it is a very nice feature, not
only because it actually is useful, but also because people used to
other debugging systems (such as msvcmon) are used to this.
I think it's best to have it working upstream, and for this,
SuspendThread is mandatory.
What do you think?
Leo.
next prev parent reply other threads:[~2007-11-25 14:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-21 0:35 Pedro Alves
2007-11-21 11:25 ` Pierre Muller
2007-11-21 13:43 ` Pedro Alves
2007-11-21 14:13 ` Pierre Muller
2007-11-21 15:08 ` Pedro Alves
2007-11-21 15:32 ` Pierre Muller
2007-11-21 18:19 ` Pedro Alves
2007-11-21 23:33 ` Pedro Alves
2007-11-22 9:19 ` Pierre Muller
2007-11-23 1:07 ` Christopher Faylor
2007-11-23 10:19 ` Lerele
2007-11-23 18:30 ` Lerele
2007-11-24 12:43 ` Pedro Alves
2007-11-24 14:21 ` Lerele
2007-11-24 5:33 ` Christopher Faylor
2007-11-24 14:18 ` Lerele
2007-11-24 15:49 ` Pedro Alves
2007-11-24 17:50 ` Lerele
2007-11-24 20:49 ` Christopher Faylor
2007-11-24 20:48 ` Christopher Faylor
2007-11-25 14:44 ` Lerele [this message]
2007-11-25 18:13 ` Christopher Faylor
2007-11-25 18:56 ` Pedro Alves
2007-11-25 22:05 ` Christopher Faylor
2007-11-25 22:13 ` Lerele
2007-11-25 20:34 ` Lerele
2007-11-24 12:16 ` Pedro Alves
2007-11-24 20:51 ` 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=47498A4F.3050101@champenstudios.com \
--to=lerele@champenstudios.com \
--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