From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20802 invoked by alias); 31 Aug 2012 14:53:15 -0000 Received: (qmail 20792 invoked by uid 22791); 31 Aug 2012 14:53:13 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,SPF_SOFTFAIL,TW_DB X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 31 Aug 2012 14:52:58 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M9M00900JUDBB00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Fri, 31 Aug 2012 17:52:56 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M9M009F2K086D60@a-mtaout22.012.net.il>; Fri, 31 Aug 2012 17:52:56 +0300 (IDT) Date: Fri, 31 Aug 2012 14:53:00 -0000 From: Eli Zaretskii Subject: Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32 In-reply-to: <503E575D.1000608@gmail.com> To: LRN Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83y5kvp0za.fsf@gnu.org> References: <503E575D.1000608@gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-08/txt/msg00890.txt.bz2 > Date: Wed, 29 Aug 2012 21:54:37 +0400 > From: LRN > > 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.