[Bug win32/14529] Make gdb capable of JIT-debugging on W32

LRN lrn1986@gmail.com
Fri Aug 31 15:40:00 GMT 2012


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



More information about the Gdb-patches mailing list