public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
To: gdb-patches@sourceware.org, LRN <lrn1986@gmail.com>,
	Eli Zaretskii <eliz@gnu.org>
Subject: Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
Date: Fri, 31 Aug 2012 15:37:00 -0000	[thread overview]
Message-ID: <20120831153656.GA22517@ednor.casa.cgf.cx> (raw)
In-Reply-To: <83y5kvp0za.fsf@gnu.org>

On Fri, Aug 31, 2012 at 05:52:57PM +0300, Eli Zaretskii wrote:
>> Date: Wed, 29 Aug 2012 21:54:37 +0400
>> From: LRN <lrn1986@gmail.com>
>> 
>> To be a JIT-debugger [1] on Windows, gdb has to be able to signal an
>> event, which is passed to it by command line. If that is not done, the
>> process being debugged will not come out of a waiting loop after gdb
>> attaches to it.
>> If the event is signaled, Windows will break the loop, and let the
>> exception fall into gdb's lap (well, stack will be a bit borked, but
>> that's another issue for another day, and there are ways of working
>> around it), after gdb user does 'continue'.
>> 
>> The attached patch [2] does exactly that by adding extra
>> "--event=EVENT" argument, thus AeDebug command line will look like this:
>> c:\mingw32\bin\gdb.exe --pid=%ld --event=%ld
>
>What is AeDebug? do you mean the Registry entry of that name?  And
>what value should be used in --event= option?
>
>This needs a documentation patch to explain how this option should be
>used.
>
>> +void
>> +signal_event_command (char *args, int from_tty)
>> +{
>> +  int async_exec = 0;
>> +  uintmax_t event_id = 0;
>> +  char *endargs = NULL;
>> +  struct cleanup *back_to = make_cleanup (null_cleanup, NULL);
>> +
>> +  dont_repeat ();		/* Not for the faint of heart */
>> +
>> +  event_id = strtoumax (args, &endargs, 10);
>> +
>> +  if ((event_id == UINTMAX_MAX && errno == ERANGE) || event_id == 0)
>> +    error (_("Failed to convert event id `%s' to integer"), args);
>> +
>> +#ifdef __MINGW32__
>> +  SetEvent ((HANDLE) event_id);
>> +  CloseHandle ((HANDLE) event_id);
>> +#else
>> +  /* Does nothing on other platforms */
>> +#endif
>> +  discard_cleanups (back_to);
>> +}
>
>I wonder whether it would be cleaner to have the entire function to be
>conditionally compiled on MinGW only.
>
>> @@ -1055,6 +1065,7 @@ Options:\n\n\
>>    --dbx              DBX compatibility mode.\n\
>>    --directory=DIR    Search for source files in DIR.\n\
>>    --epoch            Output information used by epoch emacs-GDB interface.\n\
>> +  --event=EVENT      Signal the EVENT when attached to a process. W32 only.\n\
>
>And also this part.

It sounds like it would work on Cygwin too.

cgf

  reply	other threads:[~2012-08-31 15:37 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-29 17:55 LRN
2012-08-31 14:53 ` Eli Zaretskii
2012-08-31 15:37   ` Christopher Faylor [this message]
2012-08-31 15:40     ` LRN
2012-08-31 15:37   ` LRN
2012-09-10  2:22     ` LRN
2012-09-10 18:15       ` Tom Tromey
2012-09-10 18:32         ` LRN
2012-09-11 18:21       ` Pedro Alves
2012-09-11 18:27         ` LRN
2012-09-11 18:30           ` Pedro Alves
2012-09-11 18:09     ` Pedro Alves
2012-09-11 18:23       ` LRN
2012-09-11 18:27         ` Pedro Alves
2012-09-11 18:31           ` LRN
2012-09-29 12:42           ` LRN
2012-09-29 13:05             ` Eli Zaretskii
2012-09-29 19:32               ` LRN
2012-09-30  7:51                 ` Eli Zaretskii
2012-09-30 12:46                   ` LRN
2012-10-01 13:18                     ` Eli Zaretskii
2012-10-01 16:22                       ` LRN
2012-10-01 22:37 ` Sergio Durigan Junior
2012-10-01 22:48   ` LRN
2012-10-02  5:53     ` Sergio Durigan Junior
2012-10-02 12:48       ` Joel Brobecker
2012-10-02 12:57         ` LRN
2016-06-30 13:17           ` LRN
2016-06-30 15:25             ` Eli Zaretskii
2016-06-30 15:44               ` LRN
2016-06-30 16:23                 ` Eli Zaretskii
2016-06-30 17:19                   ` LRN
2016-06-30 17:42                     ` Eli Zaretskii
2016-06-30 18:36                       ` LRN
2016-06-30 18:57                         ` Eli Zaretskii
2016-06-30 19:14                           ` LRN
2016-07-02  1:16                             ` LRN
2016-07-02  7:48                               ` Eli Zaretskii
2016-07-10 13:06                                 ` LRN
2016-07-10 14:55                                   ` Eli Zaretskii
2016-07-18 10:08                                     ` LRN
2016-07-19 19:10                                       ` Eli Zaretskii
2016-07-20  4:43                                         ` LRN
2016-07-23  8:41                                           ` Eli Zaretskii

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=20120831153656.GA22517@ednor.casa.cgf.cx \
    --to=cgf-use-the-mailinglist-please@sourceware.org \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=lrn1986@gmail.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).