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: [Patch] Win32 gdbserver new interrupt support, and attach to    process  fix.
Date: Mon, 05 Mar 2007 13:17:00 -0000	[thread overview]
Message-ID: <45EC1815.2000002@champenstudios.com> (raw)
In-Reply-To: <45EB6AC8.3090307@portugalmail.pt>

Pedro Alves wrote:

>
>>> I plan on eventually adding a third option to GenerateConsoleCtrlEvent
>>> and DebugBreakProcess, that injects a thread into the debuggee, since
>>> WinCE doesn't have any of the above.  That should make every
>>> stoppable process stoppable, in all Windows versions.
>>>
>>
>> Do you find appropriate to use this method?
>
>
> It is exactly what DebugBreakProcess does internally, so if you
> have a problem with the approach, you shouldn't be using it :)
> The thread is short-lived.  It is something like:
>
>

Well so it seems. :-)
GenerateConsoleCtrlEvent seems to create a remote thread too.

It's not only that I'm concerned about it, personally I just find it 
unacceptable for a debugger to do that kind of thing (or Windows 
anyway); user code (or standard windows dlls) can do plainly anything in 
DllEntry for instance, that can make debugged code behave very differently.

It seems after all the solution proposed may be the best resort, instead 
of the last: more compatible, less interfereable with child, however a 
bit more difficult to write.
In fact, the first version of interrupt code I wrote several months ago 
worked like that (I still keep a copy somewhere). It worked, but it was 
buggy, so I dropped it and wrote that other simpler new version.
This other solution may be the one-for-all solution, because it uses 
rather more standard Win32 calls.
Another problem besides one commented in my last message, is that signal 
handlers will not be called in child, but is this really an issue when 
doing a remote interrupt request?


>
>> 1) May be solved by doing:
>>
>> 1. Create in gdbserver process as much threads as number of cpus -1 
>> the computer has. These threads should consume all scheduled cpu for 
>> them.
>> 2. SetPriorityClass on gdbserver process with real-time priority.
>> 3. GetPriorityClass on child and store it to restore later on.
>> 4. SetPriorityClass on child with below normal or idle.
>> 5. Suspend all child threads.
>> Child should be stopped here.
>>
>> Only problem I see with this can be if child changes its own priority 
>> class between steps 3 and 4 above, however this is a very remote 
>> possibility, because if this happens it is because child is already 
>> running in real-time priority, and in this case gdbserver possibly 
>> may not even work at all (unless you run gdbserver itself with this 
>> priority).
>>
>> What do you think about this?
>
>
> I was leaving something like this as a last resort, but should be 
> possible,
> I guess.  Would need extra logic to handle the fact that there isn't
> any real breakpoint exception live (in resume, for instance).
>

Yes, but it would be something just internal to win32 low, gdbserver nor 
gdb should notice.




  parent reply	other threads:[~2007-03-05 13:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-23 23:52 Lerele
2007-02-24 12:07 ` Eli Zaretskii
2007-02-24 13:03   ` Lerele
2007-02-24 14:07     ` Eli Zaretskii
2007-02-24 15:23       ` Lerele
2007-02-24 19:10         ` Eli Zaretskii
2007-02-24 21:19         ` Pedro Alves
2007-02-24 21:44           ` Andreas Schwab
2007-02-24 23:35           ` Lerele
2007-02-25  0:15             ` Daniel Jacobowitz
2007-02-25  1:57             ` Pedro Alves
2007-02-25 22:46 ` Pedro Alves
2007-03-04 22:53   ` Lerele
2007-03-05  0:56     ` Pedro Alves
2007-03-05  1:21       ` Pedro Alves
2007-03-05 13:17       ` Lerele [this message]
2007-03-05 20:34         ` Lerele
2007-03-05 20:44         ` Pedro Alves
2007-03-06  0:04           ` Pedro Alves
2007-03-06 20:39           ` Pedro Alves
2007-03-06 22:18             ` Lerele
2007-03-06 23:22               ` Pedro Alves
2007-03-05 12:44     ` Daniel Jacobowitz
2007-03-05 20:30       ` 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=45EC1815.2000002@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