From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6494 invoked by alias); 1 Oct 2015 04:09:38 -0000 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 Received: (qmail 6479 invoked by uid 89); 1 Oct 2015 04:09:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-yk0-f170.google.com Received: from mail-yk0-f170.google.com (HELO mail-yk0-f170.google.com) (209.85.160.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 01 Oct 2015 04:09:36 +0000 Received: by ykft14 with SMTP id t14so67923224ykf.0 for ; Wed, 30 Sep 2015 21:09:34 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.129.98.68 with SMTP id w65mr6198185ywb.49.1443672574338; Wed, 30 Sep 2015 21:09:34 -0700 (PDT) Received: by 10.13.233.195 with HTTP; Wed, 30 Sep 2015 21:09:34 -0700 (PDT) In-Reply-To: <560BD2B7.9010706@redhat.com> References: <20150818235334.1afb0c85@pinnacle.lan> <20150819000334.62f7a867@pinnacle.lan> <55DC5B13.6030501@redhat.com> <20150917185751.22fe2937@pinnacle.lan> <560BD2B7.9010706@redhat.com> Date: Thu, 01 Oct 2015 04:09:00 -0000 Message-ID: Subject: Re: [PATCH 3/8] Break at each iteration for breakpoints placed on a while statement From: Doug Evans To: Pedro Alves Cc: Kevin Buettner , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00002.txt.bz2 On Wed, Sep 30, 2015 at 5:16 AM, Pedro Alves wrote: > Hi Kevin, > > Sorry for the delay. > > On 09/18/2015 02:57 AM, Kevin Buettner wrote: > >> If I place a breakpoint on the Loop 5 line, it ends up on on 0x4005cc, >> which is a nop. It appears that gcc has rewritten this code so that >> the the comparison comes first, which exactly the opposite of what >> happens when one writes a while loop. >> >> The presence of the nop means that things work as expected when we >> place a breakpoint on that line. It will stop just once on the >> statement instead of once for each time through the loop. >> >> This was an interesting exercise, but it doesn't really answer the >> question of what would happen if gcc would instead place an >> actual branch at the beginning. I would expect my patch >> to cause the breakpoint to be placed within the loop instead >> of at the beginning of the statement. I don't think this is >> desirable, but I can't think of a way (within the current work) to >> stop it from happening. > > Yeah, me neither. This is always going to be brittle. :-/ > Really the best would be DWARF is_stmt. I hate to enter into this late, but holy cow, is this really what the dwarf committee and gcc developers expect gdb to do? Assuming, for the moment, that dwarf handles this just fine, can't we push back on gcc?