From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C029A385C40C for ; Thu, 18 Nov 2021 18:34:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C029A385C40C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-nK1dkbe2NCixn2goMdqjmg-1; Thu, 18 Nov 2021 13:34:55 -0500 X-MC-Unique: nK1dkbe2NCixn2goMdqjmg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 533111017965; Thu, 18 Nov 2021 18:34:54 +0000 (UTC) Received: from f35-m3 (ovpn-112-153.phx2.redhat.com [10.3.112.153]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B4E1B7944C; Thu, 18 Nov 2021 18:34:53 +0000 (UTC) Date: Thu, 18 Nov 2021 11:34:52 -0700 From: Kevin Buettner To: Tom Tromey Cc: gdb-patches@sourceware.org, Simon Marchi Subject: Re: [PATCH 1/2] Fix PR 28308 - dprintf breakpoints not working when run from script Message-ID: <20211118113452.5d26de4f@f35-m3> In-Reply-To: <87pmqzetwz.fsf@tromey.com> References: <20211002010054.1546736-1-kevinb@redhat.com> <20211002010054.1546736-2-kevinb@redhat.com> <20211109203426.0656c9ea@f35-m3> <87pmqzetwz.fsf@tromey.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Nov 2021 18:34:58 -0000 On Tue, 16 Nov 2021 13:18:20 -0700 Tom Tromey wrote: > >>>>> "Kevin" == Kevin Buettner via Gdb-patches writes: > > Kevin> Another way of implementing it would have been to associate three > Kevin> commands with a dprintf breakpoint: > > Kevin> quiet > Kevin> printf ... / call (void) printf (...) / agent-print ... > Kevin> continue > > Kevin> This is basically what you'd use as a breakpoint command list if GDB > Kevin> didn't have the dprintf facility. The virtue of this approach is that > Kevin> it could use the existing breakpoint w/ associated command logic > Kevin> without having to introduce some of the stuff that's only used by the > Kevin> dprintf mechanism. This current bug either wouldn't have happened or, > Kevin> if it did, would have affected the rest of the breakpoint/command > Kevin> functionality as well. > > Kevin> I think it's probable that this approach (that I'm suggesting) was > Kevin> considered but was found lacking in some way. If so, I'd guess that > Kevin> either there's some major "gotcha" which I have considered or else > Kevin> it's too slow. > > The problem with the above approach is that it interferes with other gdb > commands. For example, if you step onto a dprintf spot, this may cause > gdb to resume the inferior rather than stop. Or, if you 'next', and the > code hits a dprintf, the resulting 'continue' will cause gdb to forget > it is stepping. I see. Thanks for the explanation. Kevin