From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18719 invoked by alias); 31 Aug 2012 15:40:27 -0000 Received: (qmail 18709 invoked by uid 22791); 31 Aug 2012 15:40:26 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_PGP_INLINE,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_DB X-Spam-Check-By: sourceware.org Received: from mail-lpp01m010-f41.google.com (HELO mail-lpp01m010-f41.google.com) (209.85.215.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 31 Aug 2012 15:40:12 +0000 Received: by lahd3 with SMTP id d3so2539787lah.0 for ; Fri, 31 Aug 2012 08:40:11 -0700 (PDT) Received: by 10.152.111.200 with SMTP id ik8mr6961083lab.15.1346427610998; Fri, 31 Aug 2012 08:40:10 -0700 (PDT) Received: from [192.168.4.39] (broadband-95-84-200-156.nationalcablenetworks.ru. [95.84.200.156]) by mx.google.com with ESMTPS id b1sm1354541lbi.2.2012.08.31.08.40.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 31 Aug 2012 08:40:09 -0700 (PDT) Message-ID: <5040DACD.3090101@gmail.com> Date: Fri, 31 Aug 2012 15:40:00 -0000 From: LRN User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/18.0 Thunderbird/18.0a1 MIME-Version: 1.0 To: gdb-patches@sourceware.org, Eli Zaretskii Subject: Re: [Bug win32/14529] Make gdb capable of JIT-debugging on W32 References: <503E575D.1000608@gmail.com> <83y5kvp0za.fsf@gnu.org> <20120831153656.GA22517@ednor.casa.cgf.cx> In-Reply-To: <20120831153656.GA22517@ednor.casa.cgf.cx> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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/msg00894.txt.bz2 -----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 >>> >>> >>> 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-----