From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15869 invoked by alias); 31 Aug 2012 15:37:15 -0000 Received: (qmail 15512 invoked by uid 22791); 31 Aug 2012 15:37:12 -0000 X-SWARE-Spam-Status: No, hits=-50.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,TW_DB X-Spam-Check-By: sourceware.org Received: from mho-04-ewr.mailhop.org (HELO mho-02-ewr.mailhop.org) (204.13.248.74) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 31 Aug 2012 15:36:59 +0000 Received: from pool-173-76-55-36.bstnma.fios.verizon.net ([173.76.55.36] helo=cgf.cx) by mho-02-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1T7THF-000GXN-5x; Fri, 31 Aug 2012 15:36:57 +0000 Received: from localhost (ednor.casa.cgf.cx [192.168.187.5]) by cgf.cx (Postfix) with ESMTP id 1DBBD42800E; Fri, 31 Aug 2012 11:36:56 -0400 (EDT) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+FIq99beebJWm5oDuF4T4i Date: Fri, 31 Aug 2012 15:37:00 -0000 From: Christopher Faylor To: gdb-patches@sourceware.org, LRN , Eli Zaretskii Subject: Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32 Message-ID: <20120831153656.GA22517@ednor.casa.cgf.cx> Mail-Followup-To: gdb-patches@sourceware.org, LRN , Eli Zaretskii References: <503E575D.1000608@gmail.com> <83y5kvp0za.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83y5kvp0za.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00892.txt.bz2 On Fri, Aug 31, 2012 at 05:52:57PM +0300, Eli Zaretskii wrote: >> 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. It sounds like it would work on Cygwin too. cgf