public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [Bug win32/14529] Make gdb capable of JIT-debugging on W32
@ 2012-08-29 17:55 LRN
  2012-08-31 14:53 ` Eli Zaretskii
  2012-10-01 22:37 ` Sergio Durigan Junior
  0 siblings, 2 replies; 44+ messages in thread
From: LRN @ 2012-08-29 17:55 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

Here [3] is the changelog entry.
Here [4] is a bug entry on the tracker.

[1] http://msdn.microsoft.com/en-us/library/5hs4b7a6%28v=vs.80%29.aspx
[2] http://sourceware.org/bugzilla/attachment.cgi?id=6619&action=diff
[3] http://sourceware.org/bugzilla/attachment.cgi?id=6620
[4] http://sourceware.org/bugzilla/show_bug.cgi?id=14529

[2] and [3] are also attached.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQPldbAAoJEOs4Jb6SI2CwuPYH/iSQJq2NEmsMGJ7dECdfFlWB
TF3hmodpd+CPfo/M/jB6DwRAGVM3l5goLXH6oWU1/sffUlTWwFJmI+Z66AQXayt5
xCMYRUs8lsBNloVsGWoHeVBhBD9yLpPrnG7CIK4RyE1FmXeEa1+/8YSfg8R/VqxL
Bjo6dVynXwqwuVmoFZnIqYd0X7v86p+6znpojFAqgYlJa640XyXel1wrJb9tPpiy
NV2iW03tnNPzVm+czwl7T1IA5DQUaOmPTbuTL1O9nO7S6xJu3juo7ZcFe0tZvtZn
eFHT6r0DI4meJ1DQ4KtvT2d0k6gJkHk4/HxzjZ9neuaE/lWFG5ug6tGZcY4+GS4=
=o1gF
-----END PGP SIGNATURE-----

[-- Attachment #2: 0001-Make-gdb-JIT-capable-W32.patch --]
[-- Type: text/plain, Size: 4408 bytes --]

From 4554c48a13b22b3ed1b5f5239552e4c959d34cc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Wed, 29 Aug 2012 17:00:47 +0400
Subject: [PATCH] Make gdb JIT-capable (W32)

Adds the --event=EVENT commandline arugment. After attaching to a process,
gdb will signal that event.
Only does anything on W32. On other platforms the argument is accepted, but
gdb does nothing.
Intended to be used in conjunction with AeDebug on W32.
Can be (and is) used to attach a debugger manually.

PR gdb/14529
---
 gdb/infcmd.c   |   29 +++++++++++++++++++++++++++++
 gdb/inferior.h |    2 ++
 gdb/main.c     |   13 ++++++++++++-
 3 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 8e2f74e..218f713 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -57,6 +57,11 @@
 #include "continuations.h"
 #include "linespec.h"
 
+#ifdef __MINGW32__
+#include <windows.h>
+#include <inttypes.h>
+#endif
+
 /* Functions exported for general use, in inferior.h: */
 
 void all_registers_info (char *, int);
@@ -2636,6 +2641,30 @@ attach_command (char *args, int from_tty)
   discard_cleanups (back_to);
 }
 
+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);
+}
+
 /* We had just found out that the target was already attached to an
    inferior.  PTID points at a thread of this new inferior, that is
    the most likely to be stopped right now, but not necessarily so.
diff --git a/gdb/inferior.h b/gdb/inferior.h
index b2607c3..b9592af 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -241,6 +241,8 @@ extern void post_create_inferior (struct target_ops *, int);
 
 extern void attach_command (char *, int);
 
+extern void signal_event_command (char *, int);
+
 extern char *get_inferior_args (void);
 
 extern void set_inferior_args (char *);
diff --git a/gdb/main.c b/gdb/main.c
index 326b101..f84c278 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -278,6 +278,7 @@ captured_main (void *data)
   char *symarg = NULL;
   char *execarg = NULL;
   char *pidarg = NULL;
+  char *eventarg = NULL;
   char *corearg = NULL;
   char *pid_or_core_arg = NULL;
   char *cdarg = NULL;
@@ -403,7 +404,8 @@ captured_main (void *data)
       OPT_NOWINDOWS,
       OPT_WINDOWS,
       OPT_IX,
-      OPT_IEX
+      OPT_IEX,
+      OPT_EVENT
     };
     static struct option long_options[] =
     {
@@ -438,6 +440,7 @@ captured_main (void *data)
       {"c", required_argument, 0, 'c'},
       {"pid", required_argument, 0, 'p'},
       {"p", required_argument, 0, 'p'},
+      {"event", required_argument, 0, OPT_EVENT},
       {"command", required_argument, 0, 'x'},
       {"eval-command", required_argument, 0, 'X'},
       {"version", no_argument, &print_version, 1},
@@ -582,6 +585,9 @@ captured_main (void *data)
 	      VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
 	    }
 	    break;
+	  case OPT_EVENT:
+	    eventarg = optarg;
+	    break;
 	  case 'B':
 	    batch_flag = batch_silent = 1;
 	    gdb_stdout = ui_file_new();
@@ -928,6 +934,10 @@ captured_main (void *data)
 			      !batch_flag, RETURN_MASK_ALL);
     }
 
+  if (eventarg != NULL)
+    catch_command_errors (signal_event_command, eventarg,
+			  !batch_flag, RETURN_MASK_ALL);
+
   if (ttyarg != NULL)
     set_inferior_io_terminal (ttyarg);
 
@@ -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\
   --exec=EXECFILE    Use EXECFILE as the executable.\n\
   --fullname         Output information used by emacs-GDB interface.\n\
   --help             Print this message.\n\
-- 
1.7.4


[-- Attachment #3: ChangeLog.14529 --]
[-- Type: text/plain, Size: 168 bytes --]

2012-08-29  Руслан Ижбулатов <lrn1986@gmail.com>

	* infcmd.c, inferior.h, main.c: Add --event=%ld argument for W32 compatibility
	Fix PR gdb/14529.


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-29 17:55 [Bug win32/14529] Make gdb capable of JIT-debugging on W32 LRN
@ 2012-08-31 14:53 ` Eli Zaretskii
  2012-08-31 15:37   ` Christopher Faylor
  2012-08-31 15:37   ` LRN
  2012-10-01 22:37 ` Sergio Durigan Junior
  1 sibling, 2 replies; 44+ messages in thread
From: Eli Zaretskii @ 2012-08-31 14:53 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> 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.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-31 14:53 ` Eli Zaretskii
  2012-08-31 15:37   ` Christopher Faylor
@ 2012-08-31 15:37   ` LRN
  2012-09-10  2:22     ` LRN
  2012-09-11 18:09     ` Pedro Alves
  1 sibling, 2 replies; 44+ messages in thread
From: LRN @ 2012-08-31 15:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 31.08.2012 18:52, 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?
Well, i think the official name is "JIT-debugging", but "JIT" has
other meanings, while AeDebug can only refer to this practice. Yes, it
comes from the registry key name. It's all documented in the link i gave.

The value of event option is an integer, which is a Windows Handle
(which is, in a nutshell, a void*; actually, good point - i should
make it 64-bit-capable, although i have never seen a handle THAT long;
OTOH, i haven't done a lot of 64-bit programming either).
This is a handle to an event object.

> 
> This needs a documentation patch to explain how this option should
> be used.
I can do that. Here's the explanation (if it needs clarification or
rewording in some places, let me know) that would go to the docs:

A process crashes.
OS looks up AeDebug registry entry, gets a debugger command line.
OS then creates an event object in the crashing process, and orders
the process to wait on it.
Then OS runs the debugger [1], substituting "%ld"s in AeDebug command
line for pid and event handle, in that order.
OS duplicates the event object handle to the debugger process, so
debugger process has access to it.
Debugger initializes, attaches to the crashing process, and sets the
event.
Crashing process wakes up from waiting, once it is allowed to continue
execution by the debugger.

User makes use of this by specifying the right command line in AeDebug
registry entry, so the OS will run the debugger of user's choice
(which, obviously, would be gdb in our case).



I think it's also worth mentioning that it is possible to use this
mechanism manually: a W32 process can install an exception handler,
and in that handler create an event, spawn a suspended debugger
process, duplicate the event to debugger process, resume debugger
process, and wait for the event to be set. I.e. do the same thing OS does.
After waking up from the wait, the process returns from the exception
handler with appropriate value, which will make the OS return
execution to the point of the crash, and try to run again, but this
time it will be caught by the debugger.
In this case, obviously, process might use other ways of obtaining the
debugger command line. In GNUnet i use an environment variable for that.

Which files should the explanation go to? Should it refer to MSDN
and/or be entirely self-sufficient?

>> +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.

They were, initially. However, gdb contribution documentation said
that gdb devs frown upon extra #ifdefs in files that are not
platform-specific.
The code is mostly platform independent, it's the two W32API functions
that only work on W32 (and you can write non-W32 equivalent, if you
figure out how to make it work). Thus, i removed extra #ifdefs in
main.c and other files.

[1] I'm not actually sure it happens in that order. As my manual use
example later on shows you, you need to create debugger process with
suspended main thread, otherwise it's a race between debugger process
initialization and your attempts to duplicate event handle to it.
Windows might have special stuff for that though. Also, the code
probably runs as a default exception handler within the crashing
process, so while it's OS code that does the stuff, it does so from
within that process, not from outside, and probably uses process'
access token. And it means that the process waits on the event only
after spawning the debugger, just as in my manual use example.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQQNo2AAoJEOs4Jb6SI2CwyuUIANi7eAVFBywpWPoAA5eH1JDk
jZG1/jnp4WBqEDHrkdTw1d5/ylFAL0sPfVZr9/Y/Q+QMJXZRV3K4sqYPL6/Anccx
4k5OdIgbfURWhaZYLCIJHjRMHW8nGKmwap/jsbvPDV+gyGfuvMZZsGzi/7RFIvwW
OWOGTWSowTvvN4/hrx6b7XY5NE1o15WzmDBogM771NaydjHSH/6L/KgDPmlpawKj
dCii5xOuzBsYyhhXa5GdN4jSPajZlF2QFi9yoaXXGndUPGUv++t9V0hO4xFWIvDD
Uff4dVGWBfmxvr6P45zCJdIESslywkvFFjjK9xECl+MzXPnWwE+QeKlH98SWNjE=
=Brjg
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-31 14:53 ` Eli Zaretskii
@ 2012-08-31 15:37   ` Christopher Faylor
  2012-08-31 15:40     ` LRN
  2012-08-31 15:37   ` LRN
  1 sibling, 1 reply; 44+ messages in thread
From: Christopher Faylor @ 2012-08-31 15:37 UTC (permalink / raw)
  To: gdb-patches, LRN, Eli Zaretskii

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

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-31 15:37   ` Christopher Faylor
@ 2012-08-31 15:40     ` LRN
  0 siblings, 0 replies; 44+ messages in thread
From: LRN @ 2012-08-31 15:40 UTC (permalink / raw)
  To: gdb-patches, Eli Zaretskii

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 31.08.2012 19:36, Christopher Faylor wrote:
> 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.
Yes, it should. So maybe not __MINGW32__, but _WIN32 (Cygwin version
of gdb will have to link to appropriate W32API libraries though; not
sure if it does something like that by default).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQQNrMAAoJEOs4Jb6SI2Cwk3kH/Ao8RIeIOW+NiRd2J7EJHwJG
YSfaK0B/wnKDJM6N55+DuZ+Uc8grjvQPWoq3BnjS93itECRpv6wQS/sRf/fbfTEV
+FwAmHC765dH8Giyjq5VIJv3Zu6w3F6XkDpz6GUQBklGU1/PoBQomefXCrBnFRma
dQ8het667u3GOpRTWa6fg91or8tEw/XMTYghuW12taw4GQEWO78ZeYDaqPLQwSQa
WDY6m7jjSWe38OC+LJyoXYg4moCYpTPsBgk01xTka1HxPL7RwR3AsZhqE0EFC22y
Qk/BQJvakte8Q0fD1wiqe8l0G9TCdvOwPANh+WLHRzP4cvlwa8t8LctcP3ztuX4=
=CIBx
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-31 15:37   ` LRN
@ 2012-09-10  2:22     ` LRN
  2012-09-10 18:15       ` Tom Tromey
  2012-09-11 18:21       ` Pedro Alves
  2012-09-11 18:09     ` Pedro Alves
  1 sibling, 2 replies; 44+ messages in thread
From: LRN @ 2012-09-10  2:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2599 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 31.08.2012 19:37, LRN wrote:
> On 31.08.2012 18:52, Eli Zaretskii wrote:
>> This needs a documentation patch to explain how this option
>> should be used.
> I can do that.
Patch is attached.
>>> +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.
> 
> They were, initially. However, gdb contribution documentation said 
> that gdb devs frown upon extra #ifdefs in files that are not 
> platform-specific. The code is mostly platform independent, it's
> the two W32API functions that only work on W32 (and you can write
> non-W32 equivalent, if you figure out how to make it work). Thus, i
> removed extra #ifdefs in main.c and other files.
Revised patch is attached.
I've made a configure option to enable this "feature", and enabled it by
default on MinGW and Cygwin. Since now it's a feature, appropriate
ifdefs were placed into the code.

Also, i reviewed the argument converting code and tweaked it a bit.
Hopefully it's correct.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQTU7aAAoJEOs4Jb6SI2CwEXkIANUy6En26IfobaExOtLtI6wT
IR0MVeCTTPhBODb6cXSl6uw9fti8MmBD2vxT/SDoR4I5jszP8n7rmdwFVVL7nvvq
cBuNnLpvTq12Mz0PrdZp7H/dMTwah5zbUz9rYqULNiEAYnkRPyBbUpPOAZpsRJPa
JvvpzZwqpC2Wt83zBjF403RuoEGuBT65452iBg7MDggaadj8ettjNO9/4sebsN1B
jIp6TWisvDHARk6cs8EC12IEJX/iMdbyzkBiW/n2ltaKOc6E9kZ0DnQ8LOTAxb4M
6XQMeqDLCp9sokV4hBdIRaaTdLmmiZeQ2RTahlQjFsCbhB5k9yPOjyeiHMdVxfk=
=Ndq4
-----END PGP SIGNATURE-----

[-- Attachment #2: 0003-Add-W32-JIT-to-docs.all.patch --]
[-- Type: text/plain, Size: 1327 bytes --]

--- gdb-7.5/gdb/doc/gdb.texinfo.orig	2012-07-20 21:59:05 +0400
+++ gdb-7.5/gdb/doc/gdb.texinfo	2012-09-10 06:18:28 +0400
@@ -977,6 +977,11 @@
 @cindex @code{-p}
 Connect to process ID @var{number}, as with the @code{attach} command.
 
+@item -event @var{number}
+@cindex @code{--event}
+Signal event ID @var{number} after attaching to a process. Used on W32 to
+make crashing process unblock.
+
 @item -command @var{file}
 @itemx -x @var{file}
 @cindex @code{--command}
@@ -2390,6 +2395,16 @@
 process continue running, you may use the @code{continue} command after
 attaching @value{GDBN} to the process.
 
+On W32 when system detects unhandled exception in a process, it runs default
+exception handler, which starts a debugger, and then proceeds to wait
+indefinitely on an event object. System might ask user to choose a debugger,
+or, if HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug registry key
+is defined, it will run the debugger program with the command specified in
+that key. First "%ld" token in that key will be replaced with the process ID,
+second "%ld" token will be replaced with ID of the event the process is
+waiting upon. Once GDB attaches to the process, it will signal that event,
+allowing execution to continue, and will catch the exception.
+
 @table @code
 @kindex detach
 @item detach

[-- Attachment #3: 0001-Make-gdb-JIT-capable-W32-v1.mingw32.patch --]
[-- Type: text/plain, Size: 7033 bytes --]

From 58d3018c84b96507ae13d39d7d59c3bf5364b01b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Wed, 29 Aug 2012 17:00:47 +0400
Subject: [PATCH] Make gdb JIT-capable (W32)

Adds the --event=EVENT commandline arugment. After attaching to a process,
gdb will signal that event.
Intended to be used in conjunction with AeDebug on W32.
Can be (and is) used to attach a debugger manually.
Adds configure option to enable this feature. By default it is enabled for
MinGW and Cygwin.

PR gdb/14529
---
 gdb/configure.ac |   33 +++++++++++++++++++++++++++++++--
 gdb/infcmd.c     |   27 +++++++++++++++++++++++++++
 gdb/inferior.h   |    4 ++++
 gdb/main.c       |   25 ++++++++++++++++++++++++-
 4 files changed, 86 insertions(+), 3 deletions(-)

diff --git a/gdb/configure.ac b/gdb/configure.ac
index 0c62b46..19dec6d 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -599,6 +599,9 @@ if test x"$enable_tui" != xno; then
   fi
 fi
 
+# Default value for w32_jitdbg (see below)
+default_w32_jitdbg=0
+
 # Since GDB uses Readline, we need termcap functionality.  In many
 # cases this will be provided by the curses library, but some systems
 # have a seperate termcap library, or no curses library at all.
@@ -608,16 +611,42 @@ case $host_os in
     if test -d $srcdir/libtermcap; then
       LIBS="../libtermcap/libtermcap.a $LIBS"
       ac_cv_search_tgetent="../libtermcap/libtermcap.a"
-    fi ;;
+    fi
+    default_w32_jitdbg=1
+    ;;
   go32* | *djgpp*)
     ac_cv_search_tgetent="none required"
     ;;
   *mingw32*)	 
     ac_cv_search_tgetent="none required"
     CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
+    default_w32_jitdbg=1
     ;;
 esac
 
+# This feature requires 3 things:
+# 1) windows.h with SetEvent() and CloseHandle() prototypes
+# 2) inttypes.h with uintptr_t type defined
+# 3) libkernel32 that exports SetEvent() and CloseHandle()
+# Because functions in (1) use stdcall on W32, it's impossible to
+# check them with AC_SEARCH_LIBS.
+# Until a more elaborate check is written (compile_ifelse or something),
+# users will have to enable this feature explicitly.
+# However, this feature is enabled by default for platforms where it should
+# normally work (MinGW and Cygwin).
+
+AC_ARG_ENABLE(w32-jitdbg,
+AS_HELP_STRING([--enable-w32-jitdbg], [enable W32 JIT debugging]),
+  [case $enableval in
+    yes)  w32_jitdbg=1  ;;
+    no)   w32_jitdbg=0  ;;
+    *)
+      AC_MSG_ERROR([bad value $enableval for --enable-w32-jitdbg]) ;;
+  esac],
+ [w32_jitdbg=$default_w32_jitdbg])
+AC_DEFINE_UNQUOTED(W32_JITDBG, $w32_jitdbg,
+  [Define to 1 if W32 JIT debugging support is enabled, to 0 otherwise])
+
 # These are the libraries checked by Readline.
 AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
 
@@ -1071,7 +1100,7 @@ AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
 		  sys/reg.h sys/debugreg.h sys/select.h sys/syscall.h \
 		  sys/types.h sys/wait.h wait.h termios.h termio.h \
 		  sgtty.h unistd.h elf_hp.h ctype.h time.h locale.h \
-		  dlfcn.h sys/socket.h sys/un.h])
+		  dlfcn.h sys/socket.h sys/un.h windows.h inttypes.h])
 AC_CHECK_HEADERS(link.h, [], [],
 [#if HAVE_SYS_TYPES_H
 # include <sys/types.h>
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 8e2f74e..7d304a3 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -57,6 +57,11 @@
 #include "continuations.h"
 #include "linespec.h"
 
+#if W32_JITDBG
+#include <windows.h>
+#include <inttypes.h>
+#endif
+
 /* Functions exported for general use, in inferior.h: */
 
 void all_registers_info (char *, int);
@@ -2636,6 +2641,29 @@ attach_command (char *args, int from_tty)
   discard_cleanups (back_to);
 }
 
+#if W32_JITDBG
+void
+signal_event_command (char *args, int from_tty)
+{
+  int async_exec = 0;
+  uintptr_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 ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert event id `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+  discard_cleanups (back_to);
+}
+#endif
+
 /* We had just found out that the target was already attached to an
    inferior.  PTID points at a thread of this new inferior, that is
    the most likely to be stopped right now, but not necessarily so.
diff --git a/gdb/inferior.h b/gdb/inferior.h
index b2607c3..c733032 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -241,6 +241,10 @@ extern void post_create_inferior (struct target_ops *, int);
 
 extern void attach_command (char *, int);
 
+#if W32_JITDBG
+extern void signal_event_command (char *, int);
+#endif
+
 extern char *get_inferior_args (void);
 
 extern void set_inferior_args (char *);
diff --git a/gdb/main.c b/gdb/main.c
index 155b609..76ac3c1 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -278,6 +278,9 @@ captured_main (void *data)
   char *symarg = NULL;
   char *execarg = NULL;
   char *pidarg = NULL;
+#if W32_JITDBG
+  char *eventarg = NULL;
+#endif
   char *corearg = NULL;
   char *pid_or_core_arg = NULL;
   char *cdarg = NULL;
@@ -402,6 +405,9 @@ captured_main (void *data)
       OPT_TUI,
       OPT_NOWINDOWS,
       OPT_WINDOWS,
+#if W32_JITDBG
+      OPT_EVENT,
+#endif
       OPT_IX,
       OPT_IEX
     };
@@ -438,6 +444,9 @@ captured_main (void *data)
       {"c", required_argument, 0, 'c'},
       {"pid", required_argument, 0, 'p'},
       {"p", required_argument, 0, 'p'},
+#if W32_JITDBG
+      {"event", required_argument, 0, OPT_EVENT},
+#endif
       {"command", required_argument, 0, 'x'},
       {"eval-command", required_argument, 0, 'X'},
       {"version", no_argument, &print_version, 1},
@@ -582,6 +591,11 @@ captured_main (void *data)
 	      VEC_safe_push (cmdarg_s, cmdarg_vec, &cmdarg);
 	    }
 	    break;
+#if W32_JITDBG
+	  case OPT_EVENT:
+	    eventarg = optarg;
+	    break;
+#endif
 	  case 'B':
 	    batch_flag = batch_silent = 1;
 	    gdb_stdout = ui_file_new();
@@ -927,7 +941,11 @@ captured_main (void *data)
 	catch_command_errors (core_file_command, pid_or_core_arg,
 			      !batch_flag, RETURN_MASK_ALL);
     }
-
+#if W32_JITDBG
+  if (eventarg != NULL)
+    catch_command_errors (signal_event_command, eventarg,
+			  !batch_flag, RETURN_MASK_ALL);
+#endif
   if (ttyarg != NULL)
     set_inferior_io_terminal (ttyarg);
 
@@ -1059,6 +1077,11 @@ Options:\n\n\
   --fullname         Output information used by emacs-GDB interface.\n\
   --help             Print this message.\n\
 "), stream);
+#if W32_JITDBG
+  fputs_unfiltered (_("\
+  --event=EVENT      Signal the EVENT when attached to a process.\n\
+"), stream);
+#endif
   fputs_unfiltered (_("\
   --interpreter=INTERP\n\
                      Select a specific interpreter / user interface\n\
-- 
1.7.4


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  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
  1 sibling, 1 reply; 44+ messages in thread
From: Tom Tromey @ 2012-09-10 18:15 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

>>>>> "LRN" == LRN  <lrn1986@gmail.com> writes:

LRN> diff --git a/gdb/infcmd.c b/gdb/infcmd.c
[...]

LRN> +#if W32_JITDBG
LRN> +void
LRN> +signal_event_command (char *args, int from_tty)
LRN> +{

Two notes here.

First, does it make sense to put this in windows-nat.c instead?
(I don't know anything about the Windows port...)
It doesn't matter hugely.

Second, it is odd to call this a _command and give it the above
prototype.  Normally this convention is used for things which are really
commands -- visible to the user from the gdb CLI.

I suppose this is so you can use catch_command_errors; but it seems like
you could equally well use catch_errors.

LRN> +  struct cleanup *back_to = make_cleanup (null_cleanup, NULL);

You don't need a null cleanup unless you plan to make other cleanups.
But AFAICT there aren't any.

LRN> +  dont_repeat ();		/* Not for the faint of heart */

You only need this for a real command.

Tom

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-10 18:15       ` Tom Tromey
@ 2012-09-10 18:32         ` LRN
  0 siblings, 0 replies; 44+ messages in thread
From: LRN @ 2012-09-10 18:32 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10.09.2012 22:15, Tom Tromey wrote:
>>>>>> "LRN" == LRN  <lrn1986@gmail.com> writes:
> 
> LRN> diff --git a/gdb/infcmd.c b/gdb/infcmd.c [...]
> 
> LRN> +#if W32_JITDBG LRN> +void LRN> +signal_event_command (char
> *args, int from_tty) LRN> +{
> 
> Two notes here.
> 
> First, does it make sense to put this in windows-nat.c instead? (I
> don't know anything about the Windows port...) It doesn't matter
> hugely.
Probably. I'll try to move it there and see how it goes.

> Second, it is odd to call this a _command and give it the above 
> prototype.  Normally this convention is used for things which are
> really commands -- visible to the user from the gdb CLI.
> 
> I suppose this is so you can use catch_command_errors; but it seems
> like you could equally well use catch_errors.
I mostly copied the code around it. Since this is something related to
attaching, i started with attach command. Probably not the best
choice, since it's not what i thought it was :)

> LRN> +  struct cleanup *back_to = make_cleanup (null_cleanup,
> NULL);
> 
> You don't need a null cleanup unless you plan to make other
> cleanups. But AFAICT there aren't any.
I thought that null cleanup is to be able to call error()

> LRN> +  dont_repeat ();		/* Not for the faint of heart */
> 
> You only need this for a real command.
> 
OK.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQTjIQAAoJEOs4Jb6SI2CwoN4IAKMCSafAb2SzzIzon/J38rpn
1naD4umbbBstbzMVUqesU8NmrdRWqlOjuWbpsXd8anruKvfMk2jFZpftzqIWXzZb
df8E5wBFLMH8JECWDGU8DUGJA/bBOmfswa2R9aGTgvaWya/fLcPzXmij3DQWy5sW
kXxa9IQidKe30v6XE40lUbwd6ThWGjBLDW/N3CGOmQyOmmWMCV97f1o1A/k/CmM7
x4MI3YJ4u16GVIaLTiiegAnhAu2AjupbV+7TI97bLWvRMAhI2f+KyM8XX5hceTul
qToORY6T/aS1Gij/RSDKSPzA19BqVLAH80BS1d0n3gqKptRt4wXRDE157tAZugY=
=YWbM
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-31 15:37   ` LRN
  2012-09-10  2:22     ` LRN
@ 2012-09-11 18:09     ` Pedro Alves
  2012-09-11 18:23       ` LRN
  1 sibling, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2012-09-11 18:09 UTC (permalink / raw)
  To: LRN; +Cc: Eli Zaretskii, gdb-patches

On 08/31/2012 04:37 PM, LRN wrote:
>>> >> @@ -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.
> They were, initially. However, gdb contribution documentation said
> that gdb devs frown upon extra #ifdefs in files that are not
> platform-specific.
> The code is mostly platform independent, it's the two W32API functions
> that only work on W32 (and you can write non-W32 equivalent, if you
> figure out how to make it work). Thus, i removed extra #ifdefs in
> main.c and other files.

Please consider also cross builds.  IOW, a gdb hosted on Windows,
but that is built to target something else.  In that case, as is,
you will end up with the option compiled in.  But if you remove any
mention that this is for Windows only, it'll be confusing.
I'd maybe go as far as renaming the option to --w32-jit-event or
--aedebug-event, or some such.

Alternatively, and perhaps it really is a better option,
get rid of the --event option, but make this a real command, implemented
in windows-nat.c, so that the user has better control of when to signal
the event, like:

  gdb -ex "foo" -ex "bar" -ex "attach PID" -ex "signal-aedebug-event FOO"

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-10  2:22     ` LRN
  2012-09-10 18:15       ` Tom Tromey
@ 2012-09-11 18:21       ` Pedro Alves
  2012-09-11 18:27         ` LRN
  1 sibling, 1 reply; 44+ messages in thread
From: Pedro Alves @ 2012-09-11 18:21 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

On 09/10/2012 03:22 AM, LRN wrote:
>  
> +# This feature requires 3 things:
> +# 1) windows.h with SetEvent() and CloseHandle() prototypes
> +# 2) inttypes.h with uintptr_t type defined
> +# 3) libkernel32 that exports SetEvent() and CloseHandle()
> +# Because functions in (1) use stdcall on W32, it's impossible to
> +# check them with AC_SEARCH_LIBS.
> +# Until a more elaborate check is written (compile_ifelse or something),
> +# users will have to enable this feature explicitly.
> +# However, this feature is enabled by default for platforms where it should
> +# normally work (MinGW and Cygwin).
> +
> +AC_ARG_ENABLE(w32-jitdbg,
> +AS_HELP_STRING([--enable-w32-jitdbg], [enable W32 JIT debugging]),
> +  [case $enableval in
> +    yes)  w32_jitdbg=1  ;;
> +    no)   w32_jitdbg=0  ;;
> +    *)
> +      AC_MSG_ERROR([bad value $enableval for --enable-w32-jitdbg]) ;;
> +  esac],
> + [w32_jitdbg=$default_w32_jitdbg])
> +AC_DEFINE_UNQUOTED(W32_JITDBG, $w32_jitdbg,
> +  [Define to 1 if W32 JIT debugging support is enabled, to 0 otherwise])
> +

When would you ever want to --enable-w32-jitdbg on anything other than
Windows, where it is enabled by default?

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-11 18:09     ` Pedro Alves
@ 2012-09-11 18:23       ` LRN
  2012-09-11 18:27         ` Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-09-11 18:23 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11.09.2012 22:08, Pedro Alves wrote:
> On 08/31/2012 04:37 PM, LRN wrote:
>>>>>> @@ -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.
>> They were, initially. However, gdb contribution documentation
>> said that gdb devs frown upon extra #ifdefs in files that are
>> not platform-specific. The code is mostly platform independent,
>> it's the two W32API functions that only work on W32 (and you can
>> write non-W32 equivalent, if you figure out how to make it work).
>> Thus, i removed extra #ifdefs in main.c and other files.
> 
> Please consider also cross builds.  IOW, a gdb hosted on Windows, 
> but that is built to target something else.  In that case, as is, 
> you will end up with the option compiled in.  But if you remove
> any mention that this is for Windows only, it'll be confusing.
OK, that means moving configure.ac patches from $host_os case
to...where? Should i just make a new
    case "${target}" in
	*cygwin*|*mingw*) default_w32_jitdbg=1
	;;
    esac
somewhere? Is it ${target}, or ${target_os}? What if there are
multiple targets (i've seen something like that in configure.ac)?

> I'd maybe go as far as renaming the option to --w32-jit-event or 
> --aedebug-event, or some such.
> 
I don't really care how it's named. Agree on something, and i'll
change the patch.
That said, w32-jit-event sounds closer to truth, since it's not
exclusive to AeDebug (as i have said, you can use it manually, if you
have your own exception handler that runs gdb).

> Alternatively, and perhaps it really is a better option, get rid of
> the --event option, but make this a real command, implemented in
> windows-nat.c, so that the user has better control of when to
> signal the event, like:
> 
> gdb -ex "foo" -ex "bar" -ex "attach PID" -ex "signal-aedebug-event
> FOO"
> 
That's an interesting option. Will require better documentation though
(i haven't realized that i can do that until now; shows how well i
know gdb :). And i'll need to test it to make sure that W32 is
actually capable of, say, replacing a quoted %ld...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQT4GLAAoJEOs4Jb6SI2CwlH0IALrpqt+UsJxUQiQHd1HHJ7nU
8Zb9SO2Vu14//QNdpVh8cWExoOGTvNR7buKjRvYHbbB4lw83ZbYV4TuzaBoR96+/
s7ty3AH8sztJtQVXcQ/kSV4MUx8HQfRzBGvPyHQcCNgNQ5THH2sBAn439yHExqDv
F+dmKFbXQ8Y4znAjMRyuNqIcf+tg327UtA9kaAdYyW2r7lAaFRBW65ls2OJmBX+v
Uzi1PY7s50L+k0XIzp08tEbQvhev/0J1/mHYr1COp4Z3pdjLtAENLfvkYnpXHQHD
/w8NAmUnKrN65mQbE/sZtAmdM+WOo33XC9MagDvSdpFgFrBQClR6k7D0nkBfznM=
=PM36
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-11 18:21       ` Pedro Alves
@ 2012-09-11 18:27         ` LRN
  2012-09-11 18:30           ` Pedro Alves
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-09-11 18:27 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11.09.2012 22:21, Pedro Alves wrote:
> On 09/10/2012 03:22 AM, LRN wrote:
>> 
>> +# This feature requires 3 things: +# 1) windows.h with
>> SetEvent() and CloseHandle() prototypes +# 2) inttypes.h with
>> uintptr_t type defined +# 3) libkernel32 that exports SetEvent()
>> and CloseHandle() +# Because functions in (1) use stdcall on W32,
>> it's impossible to +# check them with AC_SEARCH_LIBS. +# Until a
>> more elaborate check is written (compile_ifelse or something), +#
>> users will have to enable this feature explicitly. +# However,
>> this feature is enabled by default for platforms where it should 
>> +# normally work (MinGW and Cygwin). + 
>> +AC_ARG_ENABLE(w32-jitdbg, +AS_HELP_STRING([--enable-w32-jitdbg],
>> [enable W32 JIT debugging]), +  [case $enableval in +    yes)
>> w32_jitdbg=1  ;; +    no)   w32_jitdbg=0  ;; +    *) +
>> AC_MSG_ERROR([bad value $enableval for --enable-w32-jitdbg]) ;; +
>> esac], + [w32_jitdbg=$default_w32_jitdbg]) 
>> +AC_DEFINE_UNQUOTED(W32_JITDBG, $w32_jitdbg, +  [Define to 1 if
>> W32 JIT debugging support is enabled, to 0 otherwise]) +
> 
> When would you ever want to --enable-w32-jitdbg on anything other
> than Windows, where it is enabled by default?
> 
No idea. But i like things to have built-in overrides, in case you
need to do something that the developer have not foresaw. Better than
patching gdb in that case.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQT4JeAAoJEOs4Jb6SI2CwWSMH/iqniyrvJUf6AB71PEFNW1NV
EBfz4wJvwny2wsLWqH6p/u2N4maYbUsoxFpEJhtcgslPz5ERJu0nJlebzlWYcLLd
zAY67H0aGvVmYG6rZOKnMeV/AI4qzUwuUlMqoWSXN2OcQF7noUN2Fk4bKgjK4Dor
w58Y+UL6EpmnG97xxyWgzCNrCHYwrvu1f8Lln6yIfHUzqL2hWfiVhtMsFWfB4f7H
9J2dszPKuSfew/2MgbthSu9p3Brt7gLQja2Iva+JtApIa+lQMbpTsaQWb2kRJI4m
j4zVlOWb6axQKtAjif78mrcs1P/E9Df3oNa96YPF7TUmMG4naeUhr3FW9OG+Tls=
=7wgJ
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  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
  0 siblings, 2 replies; 44+ messages in thread
From: Pedro Alves @ 2012-09-11 18:27 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

On 09/11/2012 07:23 PM, LRN wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 11.09.2012 22:08, Pedro Alves wrote:
>> On 08/31/2012 04:37 PM, LRN wrote:
>>>>>>> @@ -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.
>>> They were, initially. However, gdb contribution documentation
>>> said that gdb devs frown upon extra #ifdefs in files that are
>>> not platform-specific. The code is mostly platform independent,
>>> it's the two W32API functions that only work on W32 (and you can
>>> write non-W32 equivalent, if you figure out how to make it work).
>>> Thus, i removed extra #ifdefs in main.c and other files.
>>
>> Please consider also cross builds.  IOW, a gdb hosted on Windows, 
>> but that is built to target something else.  In that case, as is, 
>> you will end up with the option compiled in.  But if you remove
>> any mention that this is for Windows only, it'll be confusing.
> OK, that means moving configure.ac patches from $host_os case
> to...where? Should i just make a new
>     case "${target}" in
> 	*cygwin*|*mingw*) default_w32_jitdbg=1
> 	;;
>     esac
> somewhere? Is it ${target}, or ${target_os}? What if there are
> multiple targets (i've seen something like that in configure.ac)?

Right, that's the issue -- you can't just check the target, because
there might be more than one.  So the option should be clear
at what it does, and where it applies.

> 
>> I'd maybe go as far as renaming the option to --w32-jit-event or 
>> --aedebug-event, or some such.
>>
> I don't really care how it's named. Agree on something, and i'll
> change the patch.

I don't care either, as long as it isn't confusing on the cross
scenario.  :-)

> That said, w32-jit-event sounds closer to truth, since it's not
> exclusive to AeDebug (as i have said, you can use it manually, if you
> have your own exception handler that runs gdb).

Alright.

> 
>> Alternatively, and perhaps it really is a better option, get rid of
>> the --event option, but make this a real command, implemented in
>> windows-nat.c, so that the user has better control of when to
>> signal the event, like:
>>
>> gdb -ex "foo" -ex "bar" -ex "attach PID" -ex "signal-aedebug-event
>> FOO"
>>
> That's an interesting option. Will require better documentation though
> (i haven't realized that i can do that until now; shows how well i
> know gdb :). And i'll need to test it to make sure that W32 is
> actually capable of, say, replacing a quoted %ld...
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (MingW32)
> Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
> 
> iQEcBAEBAgAGBQJQT4GLAAoJEOs4Jb6SI2CwlH0IALrpqt+UsJxUQiQHd1HHJ7nU
> 8Zb9SO2Vu14//QNdpVh8cWExoOGTvNR7buKjRvYHbbB4lw83ZbYV4TuzaBoR96+/
> s7ty3AH8sztJtQVXcQ/kSV4MUx8HQfRzBGvPyHQcCNgNQ5THH2sBAn439yHExqDv
> F+dmKFbXQ8Y4znAjMRyuNqIcf+tg327UtA9kaAdYyW2r7lAaFRBW65ls2OJmBX+v
> Uzi1PY7s50L+k0XIzp08tEbQvhev/0J1/mHYr1COp4Z3pdjLtAENLfvkYnpXHQHD
> /w8NAmUnKrN65mQbE/sZtAmdM+WOo33XC9MagDvSdpFgFrBQClR6k7D0nkBfznM=
> =PM36
> -----END PGP SIGNATURE-----
> 

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-11 18:27         ` LRN
@ 2012-09-11 18:30           ` Pedro Alves
  0 siblings, 0 replies; 44+ messages in thread
From: Pedro Alves @ 2012-09-11 18:30 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

On 09/11/2012 07:26 PM, LRN wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 11.09.2012 22:21, Pedro Alves wrote:
>> On 09/10/2012 03:22 AM, LRN wrote:
>>>
>>> +# This feature requires 3 things: +# 1) windows.h with
>>> SetEvent() and CloseHandle() prototypes +# 2) inttypes.h with
>>> uintptr_t type defined +# 3) libkernel32 that exports SetEvent()
>>> and CloseHandle() +# Because functions in (1) use stdcall on W32,
>>> it's impossible to +# check them with AC_SEARCH_LIBS. +# Until a
>>> more elaborate check is written (compile_ifelse or something), +#
>>> users will have to enable this feature explicitly. +# However,
>>> this feature is enabled by default for platforms where it should 
>>> +# normally work (MinGW and Cygwin). + 
>>> +AC_ARG_ENABLE(w32-jitdbg, +AS_HELP_STRING([--enable-w32-jitdbg],
>>> [enable W32 JIT debugging]), +  [case $enableval in +    yes)
>>> w32_jitdbg=1  ;; +    no)   w32_jitdbg=0  ;; +    *) +
>>> AC_MSG_ERROR([bad value $enableval for --enable-w32-jitdbg]) ;; +
>>> esac], + [w32_jitdbg=$default_w32_jitdbg]) 
>>> +AC_DEFINE_UNQUOTED(W32_JITDBG, $w32_jitdbg, +  [Define to 1 if
>>> W32 JIT debugging support is enabled, to 0 otherwise]) +
>>
>> When would you ever want to --enable-w32-jitdbg on anything other
>> than Windows, where it is enabled by default?
>>
> No idea. But i like things to have built-in overrides, in case you
> need to do something that the developer have not foresaw. Better than
> patching gdb in that case.

--enable-w32-jitdbg makes gdb include windows.h, and call Windows
functions.  To make this work anywhere else will always require
gdb patching.  I'd vote for less-is-more until we find a need.  :-)

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-11 18:27         ` Pedro Alves
@ 2012-09-11 18:31           ` LRN
  2012-09-29 12:42           ` LRN
  1 sibling, 0 replies; 44+ messages in thread
From: LRN @ 2012-09-11 18:31 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11.09.2012 22:27, Pedro Alves wrote:
> On 09/11/2012 07:23 PM, LRN wrote: On 11.09.2012 22:08, Pedro Alves
> wrote:
>>>> On 08/31/2012 04:37 PM, LRN wrote:
>>>>>>>>> @@ -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.
>>>>> They were, initially. However, gdb contribution
>>>>> documentation said that gdb devs frown upon extra #ifdefs
>>>>> in files that are not platform-specific. The code is mostly
>>>>> platform independent, it's the two W32API functions that
>>>>> only work on W32 (and you can write non-W32 equivalent, if
>>>>> you figure out how to make it work). Thus, i removed extra
>>>>> #ifdefs in main.c and other files.
>>>> 
>>>> Please consider also cross builds.  IOW, a gdb hosted on
>>>> Windows, but that is built to target something else.  In that
>>>> case, as is, you will end up with the option compiled in.
>>>> But if you remove any mention that this is for Windows only,
>>>> it'll be confusing.
> OK, that means moving configure.ac patches from $host_os case 
> to...where? Should i just make a new case "${target}" in 
> *cygwin*|*mingw*) default_w32_jitdbg=1 ;; esac somewhere? Is it
> ${target}, or ${target_os}? What if there are multiple targets
> (i've seen something like that in configure.ac)?
> 
>> Right, that's the issue -- you can't just check the target,
>> because there might be more than one.  So the option should be
>> clear at what it does, and where it applies.
How do i make it clear? By renaming it? Removing the code that enables
it by default?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQT4NcAAoJEOs4Jb6SI2CwC1AH/2BGTYrXSwl0F6Ij3sRSzu5a
M5I4jMHIYc+EaUdTibTNQP4Pw2yXSmOAf0ass3ZL8VNrvyl/Gz4mXRk8EvSoEI11
tT6MwUNcrHk2TBuz7h/yl1HN/fvp9sm5p1ahgwV8WCyladtk8X61AmhOrxLA/wha
+JlWbM+VLL6Wk4ZTpEBPSlUEIL2kxQFP7yGZ1O2QKRZ/EDcKcpXnMhpQNrBOMEfz
/oAmF94iyn+KdqEy5oDNVN8c87jBlUMxi0U970FxIBIuEmx6UJekcPWf37Ada1Ba
HxOmxQvGSF5sBvgyCMWUWsqg5pxtHLLp/8s/PQAlP/iDTeWxeoiXVz+Sqa/d4Nc=
=2r+9
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  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
  1 sibling, 1 reply; 44+ messages in thread
From: LRN @ 2012-09-29 12:42 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 On 09/11/2012 07:23 PM, LRN wrote:
> On 11.09.2012 22:08, Pedro Alves wrote:
>> Alternatively, and perhaps it really is a better option, get rid
>> of the --event option, but make this a real command, implemented
>> in windows-nat.c, so that the user has better control of when to 
>> signal the event, like:
>> 
>> gdb -ex "foo" -ex "bar" -ex "attach PID" -ex
>> "signal-aedebug-event FOO"
>> 
> That's an interesting option. Will require better documentation
> though (i haven't realized that i can do that until now; shows how
> well i know gdb :). And i'll need to test it to make sure that W32
> is actually capable of, say, replacing a quoted %ld...
> 

OK, here's the patch. It is much smaller and simpler indeed.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQZuyZAAoJEOs4Jb6SI2Cw8fsH/iQGmgDalamwOwrsVPl8RoB3
HG8OhUjGdb3CmO5m9FGfntsp/B4b/mloPytRQfRrGg/txcuQ5OiHcP2hffA1XGbz
YaizJWDAH/qKEXBBok3jNeJoh2wt4FFPguMPGnUVtu7Orf72aQYgV0vWnErPJYKk
p7p9qsh2nInBU7y1jgAaIR9snyok5MD3BzuGyfW8rPV1H6e+HvctZIt83vzUaBFb
5QtoDrBcm5M5/Mnj/xkMu3YVfbvmj/l2HBRfwNf9KGVReu2uATM5SnlafD/hlCFt
XVUC2wbdRF1IrUhEF+YSwS9EOe4VEJ+mIRNo/faaapKSgkVJgGuQJF4Vf8jm4zQ=
=Q6V+
-----END PGP SIGNATURE-----

[-- Attachment #2: 0001-Make-gdb-JIT-capable-W32-v3.mingw32.patch --]
[-- Type: text/plain, Size: 2635 bytes --]

From 66f1c7d0df80834cd640fad657aefaf8dbcd6819 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sat, 29 Sep 2012 03:33:01 +0400
Subject: [PATCH] Make gdb JIT-capable (W32)

Adds the signal-event command (W32-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via W32 JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo |  5 +++++
 gdb/windows-nat.c   | 22 ++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5fcbada..9dc559d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18859,6 +18859,11 @@ This is a Cygwin-specific alias of @code{info shared}.
 This command loads symbols from a dll similarly to
 add-sym command but without the need to specify a base address.
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}. Used to resume crashing
+process when attached to it using W32 JIT debugging (AeDebug).
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 905d4bf..f003ece 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -933,6 +933,25 @@ dll_symbol_command (char *args, int from_tty)
   safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2547,6 +2566,9 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  c = add_com ("signal-event", class_run, signal_event_command,
+	       _("Signal an object with ID."));
+
   c = add_com ("dll-symbols", class_files, dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
-- 
1.7.11


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-29 12:42           ` LRN
@ 2012-09-29 13:05             ` Eli Zaretskii
  2012-09-29 19:32               ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2012-09-29 13:05 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> Date: Sat, 29 Sep 2012 16:42:03 +0400
> From: LRN <lrn1986@gmail.com>
> 
> +@kindex signal-event
> +@item signal-event @var{id}
> +This command signals an event with user-provided @var{id}. Used to resume crashing
> +process when attached to it using W32 JIT debugging (AeDebug).

First, please use "MS-Windows" instead of "W32".

More importantly, I think we should document the Registry entry the
user needs to tweak, and how to define it, in order to install GDB as
a JIT debugger.  In other words, the above does not explain enough
about the expected use of this command, which (AFAIU) is from the GDB
command line using the -ex switch, which I understand is the only way
to get hold of the mysterious ID parameter this command needs.

> +  c = add_com ("signal-event", class_run, signal_event_command,
> +	       _("Signal an object with ID."));

This, too, is too vague to be useful.  After you show the full
description for the manual of how to use this command, I can help you
making its short variant for the documentation string of the command.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-29 13:05             ` Eli Zaretskii
@ 2012-09-29 19:32               ` LRN
  2012-09-30  7:51                 ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-09-29 19:32 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 29.09.2012 17:05, Eli Zaretskii wrote:
>> Date: Sat, 29 Sep 2012 16:42:03 +0400 From: LRN
>> <lrn1986@gmail.com>
>> 
>> +@kindex signal-event +@item signal-event @var{id} +This command
>> signals an event with user-provided @var{id}. Used to resume
>> crashing +process when attached to it using W32 JIT debugging
>> (AeDebug).
> 
> First, please use "MS-Windows" instead of "W32".
OK, although it might not be technically correct. I have no idea
whether ReactOS implements this debugging facility or not, but if it
does, then it is not right to name it "MS-Windows", since ReactOS is
neither MS, nor Windows.
I usually use "W32", because most of the time doing something with
WinAPI means interacting with Win32 subsystem, which, as i've
mentioned above, [is not/will not be] implemented exclusively by Windows.
Now, since GNU folks frown upon "win" in Win32, and naming it Woe32
sounds weird to me, i just use "W32".
Anyway, i've changed the patch.

> More importantly, I think we should document the Registry entry
> the user needs to tweak, and how to define it, in order to install
> GDB as a JIT debugger.  In other words, the above does not explain
> enough about the expected use of this command, which (AFAIU) is
> from the GDB command line using the -ex switch, which I understand
> is the only way to get hold of the mysterious ID parameter this
> command needs.
> 
Done.

Hopefully i didn't screw up texinfo file with wrong commands or
formatting.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQZ0zPAAoJEOs4Jb6SI2CwjxcIALmQvhA1rfRv/UJeAx4nsavM
jdWA52BbG2uaHiBI31TGmzDIecEk24yvWPTWx0F3Y/XbGojHuXpFCa4d7ekUbGFr
HBO/1DP5ZeoOEgHxK3YvnuDUkGtLnvU04q5IJmGfEOVC88nRjEr3gveGRTU9lvI0
3buThR+6sLC8+KhKk/zDtIC8MrohUGGhiVrH5oZyiiSUJ0BByicszd8U90B784qP
N0ceVolAEsIV8x6Pk+nnU12G87pB9sItpNwmwFBfjWNANUSA165mAnnDCMltmZAU
7QlKK7IxR6MyRwPxYjU9qzcS/E+/0qyNx5BSy3cqsLvzd8AfvKdZeHNphPUT1FY=
=c6nq
-----END PGP SIGNATURE-----

[-- Attachment #2: 0001-Make-gdb-JIT-capable-W32-v4.mingw32.patch --]
[-- Type: text/plain, Size: 3575 bytes --]

From 68db59b52726d0838b5974ec201becfebed8f27d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sat, 29 Sep 2012 18:16:16 +0400
Subject: [PATCH] Make gdb JIT-capable (MS-Windows)

Adds the signal-event command (MS-Windows-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via MS-Windows JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo | 26 ++++++++++++++++++++++++++
 gdb/windows-nat.c   | 22 ++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5fcbada..555563a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18859,6 +18859,32 @@ This is a Cygwin-specific alias of @code{info shared}.
 This command loads symbols from a dll similarly to
 add-sym command but without the need to specify a base address.
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}. Used to resume
+crashing process when attached to it using MS-Windows JIT debugging (AeDebug).
+
+To use it, create or edit the following keys in
+@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
+@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
+(for x86_64 versions):
+
+@itemize @minus
+@item
+Debugger (REG_SZ) - a command to launch the debugger. Suggested command is:
+<fully-qualified-path-to-gdb.exe> -ex "attach %ld" -ex "signal-event %ld"
+-ex "c"
+
+First %ld will be replaced by process ID, second %ld will be replaced by ID
+of the event that blocks the crashing process, waiting for debugger to attach.
+
+@item
+Auto (REG_SZ) - either @code{1} or @code{0}. @code{1} will make the system run
+debugger specified by Debugger key automatically, @code{0} will cause a dialog
+box with "OK" and "Cancel" buttons to appear, which allows the user to either
+terminate crashing process (OK) or debug it (Cancel).
+@end itemize
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 905d4bf..f003ece 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -933,6 +933,25 @@ dll_symbol_command (char *args, int from_tty)
   safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2547,6 +2566,9 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  c = add_com ("signal-event", class_run, signal_event_command,
+	       _("Signal an object with ID."));
+
   c = add_com ("dll-symbols", class_files, dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
-- 
1.7.11


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-29 19:32               ` LRN
@ 2012-09-30  7:51                 ` Eli Zaretskii
  2012-09-30 12:46                   ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2012-09-30  7:51 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> Date: Sat, 29 Sep 2012 23:32:31 +0400
> From: LRN <lrn1986@gmail.com>
> 
> > First, please use "MS-Windows" instead of "W32".
> OK, although it might not be technically correct. I have no idea
> whether ReactOS implements this debugging facility or not, but if it
> does, then it is not right to name it "MS-Windows", since ReactOS is
> neither MS, nor Windows.
> I usually use "W32", because most of the time doing something with
> WinAPI means interacting with Win32 subsystem, which, as i've
> mentioned above, [is not/will not be] implemented exclusively by Windows.
> Now, since GNU folks frown upon "win" in Win32, and naming it Woe32
> sounds weird to me, i just use "W32".

W32 is not an acronym known to users.  We can use "Windows API", if
you think this is more accurate.

> +@kindex signal-event
> +@item signal-event @var{id}
> +This command signals an event with user-provided @var{id}. Used to resume
                                                            ^^

Please use 2 spaces between sentences.

> +To use it, create or edit the following keys in
> +@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
> +@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
> +(for x86_64 versions):
> +
> +@itemize @minus
> +@item
> +Debugger (REG_SZ)

"Debugger" should be in @code{}.

>  - a command to launch the debugger. Suggested command is:
   ^

Three dashes here, "---", so that in print there will be a nice
em-dash character.  One dash is typeset as a minus sign, not what you
wanted.

> +<fully-qualified-path-to-gdb.exe> -ex "attach %ld" -ex "signal-event %ld"
> +-ex "c"

The command should be in @code, and it should use @var for something
the user should substitute.  Like this:

 Suggested command: @code{@var{absolute-file-name-of-gdb.exe} -ex
 "attach %ld" -ex "signal-event %ld" -ex "continue"}.

> +First %ld will be replaced by process ID, second %ld will be replaced by ID
> +of the event that blocks the crashing process, waiting for debugger to attach.

Please put the %ld in @code{}.

> +@item
> +Auto (REG_SZ) - either @code{1} or @code{0}. @code{1} will make the system run

"Auto" should be in @code{}.

> +debugger specified by Debugger key automatically, @code{0} will cause a dialog
> +box with "OK" and "Cancel" buttons to appear, which allows the user to either
> +terminate crashing process (OK) or debug it (Cancel).

Please use ``OK'' and ``Cancel'', not double quotes, for better looks
in print.

The documentation patch is OK with those changes.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-30  7:51                 ` Eli Zaretskii
@ 2012-09-30 12:46                   ` LRN
  2012-10-01 13:18                     ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-09-30 12:46 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30.09.2012 11:51, Eli Zaretskii wrote:
> Please use 2 spaces between sentences.
Done.

> "Debugger" should be in @code{}.
Done.

> Three dashes here, "---", so that in print there will be a nice 
> em-dash character.  One dash is typeset as a minus sign, not what
> you wanted.
Done.

> The command should be in @code, and it should use @var for
> something the user should substitute.
Done.

> Please put the %ld in @code{}.
Done.

> "Auto" should be in @code{}.
Done.

> Please use ``OK'' and ``Cancel'', not double quotes, for better
> looks in print.
Done.

Attached the patch.

> 
> The documentation patch is OK with those changes.
You said you'd suggest a better short message for add_com().


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQaD8mAAoJEOs4Jb6SI2CwE8kIAIgh3GBWsjZWBBNTygm7kx05
mxgbUwAjamxc26+eOXQ8CAjOxbS4PelCo86UQ8XHuAPmCRDYJpjOA+VoyDeRyjhG
ekzEV3w9C3bDs72PKsBWMnUOYRm94hL396yIu2oKxZc8W9b5PdOjQmXTeE/T0sqX
Or4BbULwNxF7zqnCn9vgJLFwLYqdoicuX3kIj9JPSX/7qHw+HAOZKNGy6Btx1n7x
spuyrymp64dhmN8M4LJtubyRS2ngbtZb0C3yvM7pj3s/a5BGbOUwfY4JIOr7i+Kx
6ielIkPZ4IAlr4NhS0GKOE0JkER6EQfU2TOLba9Dgc2TgaljTyseC78nvIOmh/A=
=VV/e
-----END PGP SIGNATURE-----

[-- Attachment #2: 0001-Make-gdb-JIT-capable-W32-v5.mingw32.patch --]
[-- Type: text/plain, Size: 3632 bytes --]

From 68db59b52726d0838b5974ec201becfebed8f27d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sat, 29 Sep 2012 18:16:16 +0400
Subject: [PATCH] Make gdb JIT-capable (MS-Windows)

Adds the signal-event command (MS-Windows-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via MS-Windows JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo | 26 ++++++++++++++++++++++++++
 gdb/windows-nat.c   | 22 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5fcbada..555563a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18859,6 +18859,33 @@ This is a Cygwin-specific alias of @code{info shared}.
 This command loads symbols from a dll similarly to
 add-sym command but without the need to specify a base address.
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}.  Used to resume
+crashing process when attached to it using MS-Windows JIT debugging (AeDebug).
+
+To use it, create or edit the following keys in
+@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
+@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
+(for x86_64 versions):
+
+@itemize @minus
+@item
+@code{Debugger} (REG_SZ) --- a command to launch the debugger.  Suggested
+command is: @code{@var{fully-qualified-path-to-gdb.exe} -ex "attach %ld"
+-ex "signal-event %ld" -ex "continue"}
+
+First @code{%ld} will be replaced by process ID, second @code{%ld} will be
+replaced by ID of the event that blocks the crashing process, waiting for
+debugger to attach.
+
+@item
+@code{Auto} (REG_SZ) --- either @code{1} or @code{0}. @code{1} will make the
+system run debugger specified by Debugger key automatically, @code{0} will
+cause a dialog box with ``OK'' and ``Cancel'' buttons to appear, which allows
+the user to either terminate crashing process (OK) or debug it (Cancel).
+@end itemize
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 905d4bf..f003ece 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -933,6 +933,25 @@ dll_symbol_command (char *args, int from_tty)
   safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2547,6 +2566,9 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  c = add_com ("signal-event", class_run, signal_event_command,
+	       _("Signal an object with ID."));
+
   c = add_com ("dll-symbols", class_files, dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
-- 
1.7.11


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-09-30 12:46                   ` LRN
@ 2012-10-01 13:18                     ` Eli Zaretskii
  2012-10-01 16:22                       ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2012-10-01 13:18 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> Date: Sun, 30 Sep 2012 16:46:30 +0400
> From: LRN <lrn1986@gmail.com>
> 
> Attached the patch.

Thanks.  Final 2 comments:

  . you patch has 2 stray ^M characters, please remove them when
    committing
  . you still have at least one place with 1 space between sentences


> > The documentation patch is OK with those changes.
> You said you'd suggest a better short message for add_com().

Right, thanks for the reminder.  Here it is:

   Signal a crashed process with event ID, to allow its debugging.
 This command is needed in support of setting up GDB as JIT debugger
 on MS-Windows.  The command should be invoked from the GDB command
 line using the '-ex' command-line option.  The ID of the event that
 blocks the crashed process will be supplied by the Windows JIT
 debugging mechanism.

Well, maybe not so short ;-)

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-01 13:18                     ` Eli Zaretskii
@ 2012-10-01 16:22                       ` LRN
  0 siblings, 0 replies; 44+ messages in thread
From: LRN @ 2012-10-01 16:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01.10.2012 17:18, Eli Zaretskii wrote:
>> Date: Sun, 30 Sep 2012 16:46:30 +0400 From: LRN
>> <lrn1986@gmail.com>
>> 
>> Attached the patch.
> 
> Thanks.  Final 2 comments:
> 
> . you patch has 2 stray ^M characters, please remove them when 
> committing
Ran dos2unix on it. Should be fine now.

> . you still have at least one place with 1 space between sentences
ARGH! Yeah, fixed.

P.S. I'm not committing it. Last 2 or 3 patch modifications were made
by editing the patch file directly, i didn't go through
git-commit-format-patch routine.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQacMtAAoJEOs4Jb6SI2CwOS8IAJkAhFysaExHJok1cCZ7xP30
dD8YA8QwtrhIIt/CK1y9JA34AEw9DTw9AWASsSeAvIBsaDi8AVxaqhCpqqU5AzZs
fvdxW1kYyKdSzKJmzqvw26Ip1pbjCNNBxdpevnQHTvHArE0Ylcy++hDKQ0TbP4l1
8tBP70aqXEHuN4ynp+sSA0S++fU4hpnkA/yUzd57DcIs2tMqQfAEIWiejsTGaPLX
7IhNIseabyoOGVePDie7aYoApjQuyV7dytzo4WlGuPgH5uLo7oGzFk2cePbvjiGs
Gk5iLUO/UfUykkG6ChQK9D4WsMMLKcZ4DhCDeYOOqdaxGa7TS50V8cFhWNrdkaA=
=xKbA
-----END PGP SIGNATURE-----

[-- Attachment #2: 0001-Make-gdb-JIT-capable-W32-v6.mingw32.patch --]
[-- Type: text/plain, Size: 3964 bytes --]

From 68db59b52726d0838b5974ec201becfebed8f27d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1=D1?=
 =?UTF-8?q?=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sat, 29 Sep 2012 18:16:16 +0400
Subject: [PATCH] Make gdb JIT-capable (MS-Windows)

Adds the signal-event command (MS-Windows-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via MS-Windows JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo | 26 ++++++++++++++++++++++++++
 gdb/windows-nat.c   | 22 ++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 5fcbada..555563a 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -18859,6 +18859,33 @@ This is a Cygwin-specific alias of @code{info shared}.
 This command loads symbols from a dll similarly to
 add-sym command but without the need to specify a base address.
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}.  Used to resume
+crashing process when attached to it using MS-Windows JIT debugging (AeDebug).
+
+To use it, create or edit the following keys in
+@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
+@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
+(for x86_64 versions):
+
+@itemize @minus
+@item
+@code{Debugger} (REG_SZ) --- a command to launch the debugger.  Suggested
+command is: @code{@var{fully-qualified-path-to-gdb.exe} -ex "attach %ld"
+-ex "signal-event %ld" -ex "continue"}
+
+First @code{%ld} will be replaced by process ID, second @code{%ld} will be
+replaced by ID of the event that blocks the crashing process, waiting for
+debugger to attach.
+
+@item
+@code{Auto} (REG_SZ) --- either @code{1} or @code{0}.  @code{1} will make the
+system run debugger specified by Debugger key automatically, @code{0} will
+cause a dialog box with ``OK'' and ``Cancel'' buttons to appear, which allows
+the user to either terminate crashing process (OK) or debug it (Cancel).
+@end itemize
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 905d4bf..f003ece 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -933,6 +933,25 @@ dll_symbol_command (char *args, int from_tty)
   safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED);
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2547,6 +2566,13 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  c = add_com ("signal-event", class_run, signal_event_command, _("\
+Signal a crashed process with event ID, to allow its debugging.\n\
+This command is needed in support of setting up GDB as JIT debugger on \
+MS-Windows.  The command should be invoked from the GDB command line using \
+the '-ex' command-line option.  The ID of the event that blocks the \
+crashed process will be supplied by the Windows JIT debugging mechanism."));
+
   c = add_com ("dll-symbols", class_files, dll_symbol_command,
 	       _("Load dll library symbols from FILE."));
   set_cmd_completer (c, filename_completer);
-- 
1.7.11


^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-08-29 17:55 [Bug win32/14529] Make gdb capable of JIT-debugging on W32 LRN
  2012-08-31 14:53 ` Eli Zaretskii
@ 2012-10-01 22:37 ` Sergio Durigan Junior
  2012-10-01 22:48   ` LRN
  1 sibling, 1 reply; 44+ messages in thread
From: Sergio Durigan Junior @ 2012-10-01 22:37 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

On Wednesday, August 29 2012, LRN wrote:

> 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.

Sorry for being late on this thread, but do you have a copyright
assignment on file for contributing for GDB?  I don't see your name on
gdb/MAINTAINERS.

If you don't have it, please mail me offlist and I can send you the
form.  If you do have it, please update gdb/MAINTAINERS.

Thanks,

-- 
Sergio

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-01 22:37 ` Sergio Durigan Junior
@ 2012-10-01 22:48   ` LRN
  2012-10-02  5:53     ` Sergio Durigan Junior
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-10-01 22:48 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02.10.2012 2:37, Sergio Durigan Junior wrote:
> On Wednesday, August 29 2012, LRN wrote:
> 
>> 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.
> 
> Sorry for being late on this thread, but do you have a copyright 
> assignment on file for contributing for GDB?  I don't see your name
> on gdb/MAINTAINERS.
I have a copyright assignment filed for GNUtls [1], would that suffice?

> If you do have it, please update gdb/MAINTAINERS.
I do not fit into any category. Not even Write After Approval
Maintainers, since i do not have write access to the GDB source tree.

[1]
http://git.savannah.gnu.org/gitweb/?p=gnutls.git;a=blob_plain;f=AUTHORS;hb=HEAD

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQah20AAoJEOs4Jb6SI2Cw+GQIAM5HkDaoUvRPaxdNlhgv8B7J
MREnpwYSQ/uSFyrTZ3WXcZ59z12G8psoit3cgoh2DybUbh6Ht1I5zXHbLXYvM8Ku
KQy4QzDb0UA4q3tX2q2X9njA5owhbCIRUaLXatn3Xg+xJjpfaB5RZIe/pxcJ9Xqv
bhFcX2gfphvYQ+bQLFQEAXy/FSTZkq7J1JtvQwyxlejUtsWlfyNe4tl6fbDAGrpl
NnJuyFdtXvGOEHeN5CJOuZsWFAgqSzwtpfZEwH4LM4CkCN0Rgq5L6HDfiLHluzyw
MaQZ7rq5gZ+V+5ojt8M58pKN81bYrxzj2EGJlOBkou8uYMh9yNDCgLRXlHCQyes=
=KrHy
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-01 22:48   ` LRN
@ 2012-10-02  5:53     ` Sergio Durigan Junior
  2012-10-02 12:48       ` Joel Brobecker
  0 siblings, 1 reply; 44+ messages in thread
From: Sergio Durigan Junior @ 2012-10-02  5:53 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

On Monday, October 01 2012, LRN wrote:

> On 02.10.2012 2:37, Sergio Durigan Junior wrote:
>> On Wednesday, August 29 2012, LRN wrote:
>> 
>>> 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.
>> 
>> Sorry for being late on this thread, but do you have a copyright 
>> assignment on file for contributing for GDB?  I don't see your name
>> on gdb/MAINTAINERS.
> I have a copyright assignment filed for GNUtls [1], would that suffice?

Not sure, we will probably have to ask someone else.  Maybe some GM
knows the answer?

Anyway, if you have a GNU copyright assignment for a project, I guess it
is much easier to extend this to other project.

>> If you do have it, please update gdb/MAINTAINERS.
> I do not fit into any category. Not even Write After Approval
> Maintainers, since i do not have write access to the GDB source tree.

That's because you do not have a copyright assignment for GDB.  *If your
patch is approved and committed*, you can ask for Write After Approval
at <http://sourceware.org/cgi-bin/pdw/ps_form.cgi>, and then you will be
able to update gdb/MAINTAINERS.

Thanks,

-- 
Sergio

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-02  5:53     ` Sergio Durigan Junior
@ 2012-10-02 12:48       ` Joel Brobecker
  2012-10-02 12:57         ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Joel Brobecker @ 2012-10-02 12:48 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: LRN, gdb-patches

> > I have a copyright assignment filed for GNUtls [1], would that suffice?

Unfortunately, that's not enough. It needs to include GDB (you also
have the option of saying "ANY" and be covered for all projects).
Do you want to start the paperwork?

-- 
Joel

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-02 12:48       ` Joel Brobecker
@ 2012-10-02 12:57         ` LRN
  2016-06-30 13:17           ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2012-10-02 12:57 UTC (permalink / raw)
  To: gdb-patches

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02.10.2012 16:48, Joel Brobecker wrote:
>>> I have a copyright assignment filed for GNUtls [1], would that
>>> suffice?
> 
> Unfortunately, that's not enough. It needs to include GDB (you
> also have the option of saying "ANY" and be covered for all
> projects). Do you want to start the paperwork?
> 
Not now. Maybe later. I'll up this thread when i'm ready.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQauTDAAoJEOs4Jb6SI2CwO/IH/2a6EtKmEEk9jEOKSZGQL63p
ai7xK0wjbx9hUWhhG+MkPKQoi1PHzeeHaOof6SI4VaYg5oYPn7mekGarlwEWxHzZ
L51WK4K8h3AT4h3cLafsU37WFcyb3/JFAl2cvnQvTJUZM1PfzxGTnE4jH0b/539a
wGXJ1Si9HkMWKNzUM6IcRGg9epOSygHEwwEE8BQAUovsOmhxr1bfzMFtXb3CCRPU
asJJK9OBhSdDwzc4zPpkOlwmZ4Mn6k6J6yYxKRlt/lDucpqNIMcvINr/HrxeV4mu
XmRGEtZl9GSS8siYdr2l7el9gZBEMMVMhAu/WfpCG1YsPgqHiMTivl0JLt/GX3k=
=fksf
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2012-10-02 12:57         ` LRN
@ 2016-06-30 13:17           ` LRN
  2016-06-30 15:25             ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-06-30 13:17 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 693 bytes --]

On 02.10.2012 15:57, LRN wrote:
> On 02.10.2012 16:48, Joel Brobecker wrote:
>>>> I have a copyright assignment filed for GNUtls [1], would that
>>>> suffice?
> 
>> Unfortunately, that's not enough. It needs to include GDB (you
>> also have the option of saying "ANY" and be covered for all
>> projects). Do you want to start the paperwork?
> 
> Not now. Maybe later. I'll up this thread when i'm ready.
> 

I did the paperwork and now my rights on code that will be included in gdb
are assigned to FSF.
So i'm upping the thread. Also, attaching a version of the patch that can
be applied to current git master.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0001-Make-gdb-JIT-capable-MS-Windows.patch --]
[-- Type: text/plain, Size: 4057 bytes --]

From 2378ccf380f400cfc25eda95939dcc7767921e13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sun, 26 Jun 2016 11:05:11 +0000
Subject: [PATCH] Make gdb JIT-capable (MS-Windows)

Adds the signal-event command (MS-Windows-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via MS-Windows JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo | 27 +++++++++++++++++++++++++++
 gdb/windows-nat.c   | 27 +++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a068622..62a99e2 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21520,6 +21520,33 @@ This command displays thread specific information stored in the
 Thread Information Block (readable on the X86 CPU family using @code{$fs}
 selector for 32-bit programs and @code{$gs} for 64-bit programs).
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}.  Used to resume
+crashing process when attached to it using MS-Windows JIT debugging (AeDebug).
+
+To use it, create or edit the following keys in
+@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
+@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
+(for x86_64 versions):
+
+@itemize @minus
+@item
+@code{Debugger} (REG_SZ) --- a command to launch the debugger.  Suggested
+command is: @code{@var{fully-qualified-path-to-gdb.exe} -ex "attach %ld"
+-ex "signal-event %ld" -ex "continue"}
+
+First @code{%ld} will be replaced by process ID, second @code{%ld} will be
+replaced by ID of the event that blocks the crashing process, waiting for
+debugger to attach.
+
+@item
+@code{Auto} (REG_SZ) --- either @code{1} or @code{0}.  @code{1} will make the
+system run debugger specified by Debugger key automatically, @code{0} will
+cause a dialog box with ``OK'' and ``Cancel'' buttons to appear, which allows
+the user to either terminate crashing process (OK) or debug it (Cancel).
+@end itemize
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 149403a..b1ab6c8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -56,6 +56,7 @@
 #include "solist.h"
 #include "solib.h"
 #include "xml-support.h"
+#include "inttypes.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -825,6 +826,25 @@ windows_clear_solib (void)
   solib_end = &solib_start;
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2551,6 +2571,13 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  add_com ("signal-event", class_run, signal_event_command, _("\
+Signal a crashed process with event ID, to allow its debugging.\n\
+This command is needed in support of setting up GDB as JIT debugger on \
+MS-Windows.  The command should be invoked from the GDB command line using \
+the '-ex' command-line option.  The ID of the event that blocks the \
+crashed process will be supplied by the Windows JIT debugging mechanism."));
+
 #ifdef __CYGWIN__
   add_setshow_boolean_cmd ("shell", class_support, &useshell, _("\
 Set use of shell to start subprocess."), _("\
-- 
2.4.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 13:17           ` LRN
@ 2016-06-30 15:25             ` Eli Zaretskii
  2016-06-30 15:44               ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-06-30 15:25 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Thu, 30 Jun 2016 16:16:40 +0300
> 
> I did the paperwork and now my rights on code that will be included in gdb
> are assigned to FSF.
> So i'm upping the thread. Also, attaching a version of the patch that can
> be applied to current git master.

Thanks.  The documentation change is approved, but please include a
NEWS entry, and also please show the ChangeLog entries for the
changes.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 15:25             ` Eli Zaretskii
@ 2016-06-30 15:44               ` LRN
  2016-06-30 16:23                 ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-06-30 15:44 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 798 bytes --]

On 30.06.2016 18:25, Eli Zaretskii wrote:
>> From: LRN <lrn1986@gmail.com>
>> Date: Thu, 30 Jun 2016 16:16:40 +0300
>>
>> I did the paperwork and now my rights on code that will be included in gdb
>> are assigned to FSF.
>> So i'm upping the thread. Also, attaching a version of the patch that can
>> be applied to current git master.
> 
> Thanks.  The documentation change is approved, but please include a
> NEWS entry, and also please show the ChangeLog entries for the
> changes.
> 
Attached the NEWS and ChangeLog patches.

There's also a bug report[1] that will have to be updated/closed
(it also has obsolete patch and ChangeLog entries attached).

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=14529

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0002-Add-a-changelog-entry-for-the-signal-event-command.patch --]
[-- Type: text/plain, Size: 915 bytes --]

From 537ee9817d0ecd60752b0312f171945a44b62f28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:41:29 +0000
Subject: [PATCH 2/2] Add a changelog entry for the 'signal-event' command

---
 gdb/ChangeLog | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e98a565..891d125 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-30  Руслан Ижбулатов <lrn1986@gmail.com>
+
+	* windows-nat.c: New command 'signal-event' for W32 compatibility
+	* gdb.texinfo: document the new 'signal-event' command.
+	* NEWS: Add an entry about the new 'signal-event' command.
+	Fix PR gdb/14529.
+
 2016-06-25  Tom Tromey  <tom@tromey.com>
 
 	* rust-lang.c (rust_get_disr_info, rust_print_type): Fix
-- 
2.4.0


[-- Attachment #1.1.3: 0001-Add-signal-event-command-to-the-NEWS-file.patch --]
[-- Type: text/plain, Size: 1101 bytes --]

From bf191c7936c812162744e5413559f805f55c1dfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:34:06 +0000
Subject: [PATCH 1/2] Add "signal-event" command to the NEWS file

---
 gdb/NEWS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 3823f20..c3ce69e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -80,6 +80,12 @@ new-ui INTERP TTY
   Start a new user interface instance running INTERP as interpreter,
   using the TTY file for input/output.
 
+signal-event EVENTID
+  Signal ("set") given Windows event object. This is used together
+  with Windows JIT debugging (AeDebug), where the OS suspends
+  a crashing process until a debugger can attach to it. Resuming
+  the process is done by siganlling an event.
+
 * Support for tracepoints and fast tracepoints on s390-linux and s390x-linux
   was added in GDBserver, including JIT compiling fast tracepoint's
   conditional expression bytecode into native code.
-- 
2.4.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 15:44               ` LRN
@ 2016-06-30 16:23                 ` Eli Zaretskii
  2016-06-30 17:19                   ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-06-30 16:23 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Thu, 30 Jun 2016 18:44:28 +0300
> 
> > Thanks.  The documentation change is approved, but please include a
> > NEWS entry, and also please show the ChangeLog entries for the
> > changes.
> > 
> Attached the NEWS and ChangeLog patches.

Thanks, but please format the ChangeLog entries according to our
coding standards.  You should be able to see many examples in the
repository.

The NEWS entry is OK, but this sentence:

> +signal-event EVENTID
> +  Signal ("set") given Windows event object.

lacks "the".  IOW, say "Signal the given Windows event object."

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 16:23                 ` Eli Zaretskii
@ 2016-06-30 17:19                   ` LRN
  2016-06-30 17:42                     ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-06-30 17:19 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 804 bytes --]

On 30.06.2016 19:23, Eli Zaretskii wrote:
> On Thu, 30 Jun 2016 18:44:28 +0300, LRN wrote:
>>> Thanks.  The documentation change is approved, but please include a
>>> NEWS entry, and also please show the ChangeLog entries for the
>>> changes.
>>>
>> Attached the NEWS and ChangeLog patches.
> 
> Thanks, but please format the ChangeLog entries according to our
> coding standards.  You should be able to see many examples in the
> repository.

I did. What did i do wrong? Had a single space (instead of two spaces)
after the name? Used "Fix PR gdb/14529" at the end instead of "PR
gdb/14529" at the beginning? No function name in parentheses (should it
have been signal_event_command?)? Can't spot any other differences.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 17:19                   ` LRN
@ 2016-06-30 17:42                     ` Eli Zaretskii
  2016-06-30 18:36                       ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-06-30 17:42 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Thu, 30 Jun 2016 20:18:52 +0300
> 
> > Thanks, but please format the ChangeLog entries according to our
> > coding standards.  You should be able to see many examples in the
> > repository.
> 
> I did. What did i do wrong? Had a single space (instead of two spaces)
> after the name? Used "Fix PR gdb/14529" at the end instead of "PR
> gdb/14529" at the beginning? No function name in parentheses (should it
> have been signal_event_command?)?

The latter.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 17:42                     ` Eli Zaretskii
@ 2016-06-30 18:36                       ` LRN
  2016-06-30 18:57                         ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-06-30 18:36 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 675 bytes --]

On 30.06.2016 20:42, Eli Zaretskii wrote:
> On Thu, 30 Jun 2016 20:18:52 +0300, LRN wrote:
>> On 30.06.2016 19:23, Eli Zaretskii wrote:
>>> Thanks, but please format the ChangeLog entries according to our
>>> coding standards.  You should be able to see many examples in the
>>> repository.
>>
>> I did. What did i do wrong? Had a single space (instead of two spaces)
>> after the name? Used "Fix PR gdb/14529" at the end instead of "PR
>> gdb/14529" at the beginning? No function name in parentheses (should it
>> have been signal_event_command?)?
> 
> The latter.
> 

Fixed patches attached.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0001-Add-signal-event-command-to-the-NEWS-file.patch --]
[-- Type: text/plain, Size: 1105 bytes --]

From 87d5a55484ef412b0c79e66ac508150d81112186 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:34:06 +0000
Subject: [PATCH 1/2] Add "signal-event" command to the NEWS file

---
 gdb/NEWS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 3823f20..da04ae6 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -80,6 +80,12 @@ new-ui INTERP TTY
   Start a new user interface instance running INTERP as interpreter,
   using the TTY file for input/output.
 
+signal-event EVENTID
+  Signal ("set") the given Windows event object. This is used together
+  with Windows JIT debugging (AeDebug), where the OS suspends
+  a crashing process until a debugger can attach to it. Resuming
+  the process is done by siganlling an event.
+
 * Support for tracepoints and fast tracepoints on s390-linux and s390x-linux
   was added in GDBserver, including JIT compiling fast tracepoint's
   conditional expression bytecode into native code.
-- 
2.4.0


[-- Attachment #1.1.3: 0002-Add-a-changelog-entry-for-the-signal-event-command.patch --]
[-- Type: text/plain, Size: 945 bytes --]

From 59df288924ba3714476f45dffe760ab04188e8ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:41:29 +0000
Subject: [PATCH 2/2] Add a changelog entry for the 'signal-event' command

---
 gdb/ChangeLog | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e98a565..f1e2d9e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>
+
+	PR gdb/14529
+	* windows-nat.c (signal_event_command): New command
+        'signal-event' for W32 compatibility.
+	* gdb.texinfo: document the new 'signal-event' command.
+	* NEWS: Add an entry about the new 'signal-event' command.
+
 2016-06-25  Tom Tromey  <tom@tromey.com>
 
 	* rust-lang.c (rust_get_disr_info, rust_print_type): Fix
-- 
2.4.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 18:36                       ` LRN
@ 2016-06-30 18:57                         ` Eli Zaretskii
  2016-06-30 19:14                           ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-06-30 18:57 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Thu, 30 Jun 2016 21:36:12 +0300
> 
> >> I did. What did i do wrong? Had a single space (instead of two spaces)
> >> after the name? Used "Fix PR gdb/14529" at the end instead of "PR
> >> gdb/14529" at the beginning? No function name in parentheses (should it
> >> have been signal_event_command?)?
> > 
> > The latter.
> > 
> 
> Fixed patches attached.

Thanks.  One last nit is that the ChangeLog entry for gdb.texinfo
should also state a "function name", which is the node name where you
made the changes.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 18:57                         ` Eli Zaretskii
@ 2016-06-30 19:14                           ` LRN
  2016-07-02  1:16                             ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-06-30 19:14 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 781 bytes --]

On 30.06.2016 21:56, Eli Zaretskii wrote:
> On Thu, 30 Jun 2016 21:36:12 +0300, LRN wrote:
>> On 30.06.2016 20:42, Eli Zaretskii wrote:
>>> On Thu, 30 Jun 2016 20:18:52 +0300, LRN wrote:
>>>> I did. What did i do wrong? Had a single space (instead of two spaces)
>>>> after the name? Used "Fix PR gdb/14529" at the end instead of "PR
>>>> gdb/14529" at the beginning? No function name in parentheses (should
>>>> it have been signal_event_command?)?
>>>
>>> The latter.
>>>
>>
>> Fixed patches attached.
> 
> Thanks.  One last nit is that the ChangeLog entry for gdb.texinfo
> should also state a "function name", which is the node name where you
> made the changes.
> 

Fixed patch is attached.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0002-Add-a-changelog-entry-for-the-signal-event-command.patch --]
[-- Type: text/plain, Size: 971 bytes --]

From 573a82c5efbaa46584c99bab86602ef1973b145e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:41:29 +0000
Subject: [PATCH 2/2] Add a changelog entry for the 'signal-event' command

---
 gdb/ChangeLog | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e98a565..3822d2c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>
+
+	PR gdb/14529
+	* windows-nat.c (signal_event_command): New command
+        'signal-event' for W32 compatibility.
+	* gdb.texinfo (Cygwin Native): document the new 'signal-event'
+        command.
+	* NEWS: Add an entry about the new 'signal-event' command.
+
 2016-06-25  Tom Tromey  <tom@tromey.com>
 
 	* rust-lang.c (rust_get_disr_info, rust_print_type): Fix
-- 
2.4.0


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-06-30 19:14                           ` LRN
@ 2016-07-02  1:16                             ` LRN
  2016-07-02  7:48                               ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-07-02  1:16 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1: Type: text/plain, Size: 1071 bytes --]

On 30.06.2016 22:13, LRN wrote:
> On 30.06.2016 21:56, Eli Zaretskii wrote:
>> On Thu, 30 Jun 2016 21:36:12 +0300, LRN wrote:
>>> On 30.06.2016 20:42, Eli Zaretskii wrote:
>>>> On Thu, 30 Jun 2016 20:18:52 +0300, LRN wrote:
>>>>> I did. What did i do wrong? Had a single space (instead of two spaces)
>>>>> after the name? Used "Fix PR gdb/14529" at the end instead of "PR
>>>>> gdb/14529" at the beginning? No function name in parentheses (should
>>>>> it have been signal_event_command?)?
>>>>
>>>> The latter.
>>>>
>>>
>>> Fixed patches attached.
>>
>> Thanks.  One last nit is that the ChangeLog entry for gdb.texinfo
>> should also state a "function name", which is the node name where you
>> made the changes.
>>
> 
> Fixed patch is attached.
> 

So, anyway, is anything else expected of me? When should i expect to see
the patches pushed?

I also have a different patch that i want to submit. Should i do it now, in
a separate email, or wait until this one is through?

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-02  1:16                             ` LRN
@ 2016-07-02  7:48                               ` Eli Zaretskii
  2016-07-10 13:06                                 ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-07-02  7:48 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Sat, 2 Jul 2016 04:16:15 +0300
> 
> So, anyway, is anything else expected of me? When should i expect to see
> the patches pushed?

Please wait for a week, and if it doesn't get pushed, ping us here.

> I also have a different patch that i want to submit. Should i do it now, in
> a separate email, or wait until this one is through?

You could send it (with a separate Subject) right now, but since this
is your first submission to GDB, I suggest to wait for the previous
one to be pushed, in case there are some comments applicable to both
patches.

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-02  7:48                               ` Eli Zaretskii
@ 2016-07-10 13:06                                 ` LRN
  2016-07-10 14:55                                   ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-07-10 13:06 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 326 bytes --]

On 02.07.2016 10:47, Eli Zaretskii wrote:
> On 02.07.2016 4:16, LRN wrote:
>> So, anyway, is anything else expected of me? When should i expect to see
>> the patches pushed?
> 
> Please wait for a week, and if it doesn't get pushed, ping us here.

ping

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0x6759BA74.asc --]
[-- Type: application/pgp-keys, Size: 3540 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-10 13:06                                 ` LRN
@ 2016-07-10 14:55                                   ` Eli Zaretskii
  2016-07-18 10:08                                     ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-07-10 14:55 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Sun, 10 Jul 2016 16:05:56 +0300
> 
> On 02.07.2016 10:47, Eli Zaretskii wrote:
> > On 02.07.2016 4:16, LRN wrote:
> >> So, anyway, is anything else expected of me? When should i expect to see
> >> the patches pushed?
> > 
> > Please wait for a week, and if it doesn't get pushed, ping us here.
> 
> ping

Any objections to me pushing this to master?  Anyone?

Thanks.

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-10 14:55                                   ` Eli Zaretskii
@ 2016-07-18 10:08                                     ` LRN
  2016-07-19 19:10                                       ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-07-18 10:08 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 500 bytes --]

On 10.07.2016 17:54, Eli Zaretskii wrote:
> On 10.07.2016 16:05, LRN wrote:
>> On 02.07.2016 10:47, Eli Zaretskii wrote:
>>> On 02.07.2016 4:16, LRN wrote:
>>>> So, anyway, is anything else expected of me? When should i expect to
>>>> see the patches pushed?
>>>
>>> Please wait for a week, and if it doesn't get pushed, ping us here.
>> 
>> ping
>> 
> 
> Any objections to me pushing this to master?  Anyone?
> 

ping

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0x6759BA74.asc --]
[-- Type: application/pgp-keys, Size: 3540 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-18 10:08                                     ` LRN
@ 2016-07-19 19:10                                       ` Eli Zaretskii
  2016-07-20  4:43                                         ` LRN
  0 siblings, 1 reply; 44+ messages in thread
From: Eli Zaretskii @ 2016-07-19 19:10 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Mon, 18 Jul 2016 13:08:35 +0300
> 
> On 10.07.2016 17:54, Eli Zaretskii wrote:
> > On 10.07.2016 16:05, LRN wrote:
> >> On 02.07.2016 10:47, Eli Zaretskii wrote:
> >>> On 02.07.2016 4:16, LRN wrote:
> >>>> So, anyway, is anything else expected of me? When should i expect to
> >>>> see the patches pushed?
> >>>
> >>> Please wait for a week, and if it doesn't get pushed, ping us here.
> >> 
> >> ping
> >> 
> > 
> > Any objections to me pushing this to master?  Anyone?
> > 
> 
> ping

Sorry for the delay: life intervened big time.

If no one beats me to it, I will push this weekend.  Thank you for
your patience.

P.S. Do we really need a configure-time option?  Why not enable the
feature by default in the MinGW and Cygwin builds?

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-19 19:10                                       ` Eli Zaretskii
@ 2016-07-20  4:43                                         ` LRN
  2016-07-23  8:41                                           ` Eli Zaretskii
  0 siblings, 1 reply; 44+ messages in thread
From: LRN @ 2016-07-20  4:43 UTC (permalink / raw)
  To: gdb-patches


[-- Attachment #1.1.1: Type: text/plain, Size: 1227 bytes --]

On 19.07.2016 22:09, Eli Zaretskii wrote:
> On 18.07.2016 13:08, LRN wrote:
>> On 10.07.2016 17:54, Eli Zaretskii wrote:
>>> On 10.07.2016 16:05, LRN wrote:
>>>> On 02.07.2016 10:47, Eli Zaretskii wrote:
>>>>> On 02.07.2016 4:16, LRN wrote:
>>>>>> So, anyway, is anything else expected of me? When should i expect to
>>>>>> see the patches pushed?
>>>>>
>>>>> Please wait for a week, and if it doesn't get pushed, ping us here.
>>>>
>>>> ping
>>>>
>>>
>>> Any objections to me pushing this to master?  Anyone?
>>>
>> 
>> ping
>> 
> 
> Sorry for the delay: life intervened big time.
> 
> If no one beats me to it, I will push this weekend.  Thank you for
> your patience.
> 
> P.S. Do we really need a configure-time option?  Why not enable the
> feature by default in the MinGW and Cygwin builds?
> 

The latest version of the patch does not have a configure-time option. You
must be either looking at a patch from one of the early emails, or at a
patch on the bug tracker (which was never updated after the discussion
moved to the mailing list).

Just to ensure that you push the right thing, i'm attaching the patches again.

-- 
O< ascii ribbon - stop html email! - www.asciiribbon.org

[-- Attachment #1.1.2: 0001-Make-gdb-JIT-capable-MS-Windows.patch --]
[-- Type: text/plain, Size: 4061 bytes --]

From 04b8ea3eee4714f027159d2a496a2fa6569c7b8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Sun, 26 Jun 2016 11:05:11 +0000
Subject: [PATCH 1/3] Make gdb JIT-capable (MS-Windows)

Adds the signal-event command (MS-Windows-only) that signals
an event with user-provided ID. Used to resume crashing
process when attached to it via MS-Windows JIT debugging (AeDebug).

PR gdb/14529
---
 gdb/doc/gdb.texinfo | 27 +++++++++++++++++++++++++++
 gdb/windows-nat.c   | 27 +++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index a068622..62a99e2 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21520,6 +21520,33 @@ This command displays thread specific information stored in the
 Thread Information Block (readable on the X86 CPU family using @code{$fs}
 selector for 32-bit programs and @code{$gs} for 64-bit programs).
 
+@kindex signal-event
+@item signal-event @var{id}
+This command signals an event with user-provided @var{id}.  Used to resume
+crashing process when attached to it using MS-Windows JIT debugging (AeDebug).
+
+To use it, create or edit the following keys in
+@code{HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug} and/or
+@code{HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug}
+(for x86_64 versions):
+
+@itemize @minus
+@item
+@code{Debugger} (REG_SZ) --- a command to launch the debugger.  Suggested
+command is: @code{@var{fully-qualified-path-to-gdb.exe} -ex "attach %ld"
+-ex "signal-event %ld" -ex "continue"}
+
+First @code{%ld} will be replaced by process ID, second @code{%ld} will be
+replaced by ID of the event that blocks the crashing process, waiting for
+debugger to attach.
+
+@item
+@code{Auto} (REG_SZ) --- either @code{1} or @code{0}.  @code{1} will make the
+system run debugger specified by Debugger key automatically, @code{0} will
+cause a dialog box with ``OK'' and ``Cancel'' buttons to appear, which allows
+the user to either terminate crashing process (OK) or debug it (Cancel).
+@end itemize
+
 @kindex set cygwin-exceptions
 @cindex debugging the Cygwin DLL
 @cindex Cygwin DLL, debugging
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 149403a..b1ab6c8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -56,6 +56,7 @@
 #include "solist.h"
 #include "solib.h"
 #include "xml-support.h"
+#include "inttypes.h"
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
@@ -825,6 +826,25 @@ windows_clear_solib (void)
   solib_end = &solib_start;
 }
 
+static void
+signal_event_command (char *args, int from_tty)
+{
+  uintptr_t event_id = 0;
+  char *endargs = NULL;
+
+  if (args == NULL)
+    error (_("signal-event requires an argument (integer event id)"));
+
+  event_id = strtoumax (args, &endargs, 10);
+
+  if ((errno == ERANGE) || (event_id == 0) || (event_id > UINTPTR_MAX) ||
+      ((HANDLE) event_id == INVALID_HANDLE_VALUE))
+    error (_("Failed to convert `%s' to event id"), args);
+
+  SetEvent ((HANDLE) event_id);
+  CloseHandle ((HANDLE) event_id);
+}
+
 /* Handle DEBUG_STRING output from child process.
    Cygwin prepends its messages with a "cygwin:".  Interpret this as
    a Cygwin signal.  Otherwise just print the string as a warning.  */
@@ -2551,6 +2571,13 @@ _initialize_windows_nat (void)
   cygwin_internal (CW_SET_DOS_FILE_WARNING, 0);
 #endif
 
+  add_com ("signal-event", class_run, signal_event_command, _("\
+Signal a crashed process with event ID, to allow its debugging.\n\
+This command is needed in support of setting up GDB as JIT debugger on \
+MS-Windows.  The command should be invoked from the GDB command line using \
+the '-ex' command-line option.  The ID of the event that blocks the \
+crashed process will be supplied by the Windows JIT debugging mechanism."));
+
 #ifdef __CYGWIN__
   add_setshow_boolean_cmd ("shell", class_support, &useshell, _("\
 Set use of shell to start subprocess."), _("\
-- 
2.4.0


[-- Attachment #1.1.3: 0002-Add-signal-event-command-to-the-NEWS-file.patch --]
[-- Type: text/plain, Size: 1105 bytes --]

From 756456c50c6bc2046ff6c37fcca4955086326946 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:34:06 +0000
Subject: [PATCH 2/3] Add "signal-event" command to the NEWS file

---
 gdb/NEWS | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 3823f20..da04ae6 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -80,6 +80,12 @@ new-ui INTERP TTY
   Start a new user interface instance running INTERP as interpreter,
   using the TTY file for input/output.
 
+signal-event EVENTID
+  Signal ("set") the given Windows event object. This is used together
+  with Windows JIT debugging (AeDebug), where the OS suspends
+  a crashing process until a debugger can attach to it. Resuming
+  the process is done by siganlling an event.
+
 * Support for tracepoints and fast tracepoints on s390-linux and s390x-linux
   was added in GDBserver, including JIT compiling fast tracepoint's
   conditional expression bytecode into native code.
-- 
2.4.0


[-- Attachment #1.1.4: 0003-Add-a-changelog-entry-for-the-signal-event-command.patch --]
[-- Type: text/plain, Size: 986 bytes --]

From c56681b5940cbe46d457028764819a00e6aa96ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?=
 =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1986@gmail.com>
Date: Thu, 30 Jun 2016 15:41:29 +0000
Subject: [PATCH 3/3] Add a changelog entry for the 'signal-event' command

---
 gdb/ChangeLog | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 92c1337..f49ebe1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2016-06-30  Руслан Ижбулатов  <lrn1986@gmail.com>
+
+	PR gdb/14529
+	* windows-nat.c (signal_event_command): New command
+        'signal-event' for W32 compatibility.
+	* gdb.texinfo (Cygwin Native): document the new 'signal-event'
+        command.
+	* NEWS: Add an entry about the new 'signal-event' command.
+
 2016-07-07  Walfred Tedeschi  <walfred.tedeschi@intel.com>
 
 	* cp-namespace.c (cp_lookup_bare_symbol): Initialize 
-- 
2.4.0


[-- Attachment #1.1.5: 0x6759BA74.asc --]
[-- Type: application/pgp-keys, Size: 3540 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32
  2016-07-20  4:43                                         ` LRN
@ 2016-07-23  8:41                                           ` Eli Zaretskii
  0 siblings, 0 replies; 44+ messages in thread
From: Eli Zaretskii @ 2016-07-23  8:41 UTC (permalink / raw)
  To: LRN; +Cc: gdb-patches

> From: LRN <lrn1986@gmail.com>
> Date: Wed, 20 Jul 2016 07:42:44 +0300
> 
> > P.S. Do we really need a configure-time option?  Why not enable the
> > feature by default in the MinGW and Cygwin builds?
> > 
> 
> The latest version of the patch does not have a configure-time option. You
> must be either looking at a patch from one of the early emails, or at a
> patch on the bug tracker (which was never updated after the discussion
> moved to the mailing list).
> 
> Just to ensure that you push the right thing, i'm attaching the patches again.

Thanks.  I pushed these to the master branch, after fixing a few typos.

Thanks again for working on this and for persevering.

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2016-07-23  8:41 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-29 17:55 [Bug win32/14529] Make gdb capable of JIT-debugging on W32 LRN
2012-08-31 14:53 ` Eli Zaretskii
2012-08-31 15:37   ` Christopher Faylor
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

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).