From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96088 invoked by alias); 22 Mar 2016 17:00:39 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 95963 invoked by uid 89); 22 Mar 2016 17:00:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=studying, noise, racy X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 22 Mar 2016 17:00:23 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id DD6B7C049D68; Tue, 22 Mar 2016 17:00:20 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2MH0J6G025268; Tue, 22 Mar 2016 13:00:20 -0400 Subject: Re: JIT debugging (Attach and speed) To: Yichao Yu References: <56F168D7.9050405@redhat.com> <56F16F8F.9050404@redhat.com> <56F1759F.3070100@redhat.com> Cc: gdb@sourceware.org, Paul Pluzhnikov From: Pedro Alves Message-ID: <56F17A23.90909@redhat.com> Date: Tue, 22 Mar 2016 17:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-03/txt/msg00030.txt.bz2 On 03/22/2016 04:47 PM, Yichao Yu wrote: > On Tue, Mar 22, 2016 at 12:41 PM, Pedro Alves wrote: >> On 03/22/2016 04:22 PM, Yichao Yu wrote: >>> On Tue, Mar 22, 2016 at 12:15 PM, Pedro Alves wrote: >>>> On 03/22/2016 03:46 PM, Pedro Alves wrote: >>> >>>> I re-read the 2011 discussion, and it seems like we had an idea for a fix: >>> >>> IIUC the proposed fix might cause regression in some cases? >> >> Yeah, there's no full fix available, only some ideas thrown out. >> The last discussed one wouldn't cause a regression -- the >> "longjmp"-caching idea. We may still need to defer breakpoint re-set >> to at most once per jit load event, something like Paul's original >> patch, but with a breakpoint_re_set call somewhere. >> >> It'd even be better to somehow restrict breakpoint re-setting >> to the jit modules that were added/removed/changed, but >> that's harder. >> >>> >>>>> >>>>> Do you know whether this happens with 7.11 and master, and if so, >>>>> would it be possible for you to git bisect the culprit? >>> >>> This is 7.11 package from ArchLinux. I could try bi-secting although >>> apparently you are faster at pin-point the issue. >>> >>>> >>>> Currently, jit_inferior_created_hook -> jit_inferior_init is only >>>> called when the inferior execs... >>>> >>>> Grepping around, I think that might have been >>>> the fix for PR gdb/13431 (03bef283c2d3): >>>> https://sourceware.org/ml/gdb-patches/2012-02/msg00023.html >>>> which removed the inferior_created (jit_inferior_created_observer). >>>> >>>> Adding an inferior_created observer back likely fixes the issue. >>> >>> I'm happy to test patches. >> >> I'm happy to provide guidance, but a fix would likely happen faster >> if someone else stepped up to write it. > > Are these lines (or at least the first one) the ones you think should > be added back? > > - observer_attach_inferior_created (jit_inferior_created_observer); > observer_attach_inferior_exit (jit_inferior_exit_hook); > - observer_attach_executable_changed (jit_executable_changed_observer); > Something like that. At least the first one. Not sure the second is needed, since with Tromey's change the data is associated with the objfile. > I can try that although I'm not particularly sure what was the reason > they are removed Not sure either. I assume studying Tromey's description of the original change helps bring that to light. > and how to check for regressions. GDB has a regression test suite under src/gdb/testsuite/. The gdb/testsuite/README file has instructions. Basically, run "make check -j8" before the patch, "make check -j8" after the patch, and diff the resulting testsuite/gdb.sum files. Note that there are some tests that may be racy on your machine, so you may get unrelated some noise. Running a particular test a couple times, with: make check TESTS="gdb.base/foo.exp" should help you determine whether that's the case. It'd be very nice if we had a _new_ test that covers your use case, to avoid regressing again. That likely makes the patch bigger than what we could accept without a copyright assignment though. If you'd like to pursue that, let me know and I'll send you the forms. Thanks, Pedro Alves