aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
authorРуслан Ижбулатов <lrn1986@gmail.com>2016-07-23 11:38:03 +0300
committerEli Zaretskii <eliz@gnu.org>2016-07-23 11:38:03 +0300
commit463888ab6be549e8dcc9eac36dc07c1c237e2968 (patch)
tree41ef8df68696e267f5f6d35a600e935d31767f2c /gdb/windows-nat.c
parentcac709756b00c57a375f40e032d2eb4f5dbd3804 (diff)
downloadgdb-463888ab6be549e8dcc9eac36dc07c1c237e2968.zip
gdb-463888ab6be549e8dcc9eac36dc07c1c237e2968.tar.gz
gdb-463888ab6be549e8dcc9eac36dc07c1c237e2968.tar.bz2
Support JIT debugging on MS-Windows
gdb/ChangeLog: 2016-06-30 Руслан Ижбулатов <lrn1986@gmail.com> PR gdb/14529 * windows-nat.c (signal_event_command): New command 'signal-event' for W32 JIT debug support. * NEWS: Add an entry about the new 'signal-event' command. gdb/doc/ChangeLog: 2016-06-30 Руслан Ижбулатов <lrn1986@gmail.com> * gdb.texinfo (Cygwin Native): Document the new 'signal-event' command.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index c95dc9a..3f67486 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. */
@@ -2550,6 +2570,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."), _("\