From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QELfKbzZKmQ3KyIAWB0awg (envelope-from ) for ; Mon, 03 Apr 2023 09:50:52 -0400 Received: by simark.ca (Postfix, from userid 112) id 9FE5D1E15D; Mon, 3 Apr 2023 09:50:52 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=xwm79yhQ; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F1ED61E0D3 for ; Mon, 3 Apr 2023 09:50:48 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D8243858C39 for ; Mon, 3 Apr 2023 13:50:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D8243858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680529848; bh=U76DulMOATDFuwB2fnUeb51+uOXicv/+8jkc/kb1Lzc=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xwm79yhQZGEQH8TkP18Jg2MazzuUXEfzjaHglaj3vz8U1uG+tdD6ov2EYSc1By3YZ jpYbPXjjLi257m98D/M4UoBjEpHQu7kX49f4HykrtVSgcx93zyE1isa4QlNsEyLDFf /ywbLBYoVfli4XrVuqXXDNDi6/9WMryOhQULmAjo= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 958DF3858D37 for ; Mon, 3 Apr 2023 13:50:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 958DF3858D37 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-Dk97Xr6zOn28uCU6SScvag-1; Mon, 03 Apr 2023 09:50:23 -0400 X-MC-Unique: Dk97Xr6zOn28uCU6SScvag-1 Received: by mail-qv1-f70.google.com with SMTP id w2-20020a0cc242000000b00583d8e55181so13067036qvh.23 for ; Mon, 03 Apr 2023 06:50:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680529822; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=U76DulMOATDFuwB2fnUeb51+uOXicv/+8jkc/kb1Lzc=; b=GOiWgXpWyQZbgNRw78pueeVmAQUmvnxwdMjgl6MWDasqg26MDEUAisWwrSvqT2LtfD ztIBtOZWpMyd3KjqWM0rzH4CFuZFU/G4LckT7x3zIv1pSdm7ke3Pkhg0lxV9OMyQaajt UmLWk3RSQKpBbI2klwtD7dr2Y8VYgmvHRLeunY5+DlFwGz03h1SKnEPnPzwaFSdNf66n 2AERk6OY3OWczpxdzGmF8j3rBdCL5tQ4TksjE3yiU0FmDH0Hd3Iyo92D+TTpZ0jCiExH NQtn+bMBUd/8sLNkGB+2D6MuUt6nDhfaoc0NVPacjkIhVdpSyhLoVpjnYs9y7C0itd0E RSZA== X-Gm-Message-State: AAQBX9euFs7EIYLbGkdLuiPjmAqhiW6yR663KMuYnAijGLOUNVl2CjyQ 57wRhjcGffrjH0C70BC3AAJuCVVOGWus8RBZwi44syNyVYcbgBb05XpMQGG/Dwy6ovcyL4lFRiy KTfBnt8Wg5CVp2F76hpvW7vyqfK17frgI7z0gx2lmWWxaETC/UtEat9lbaO8/TdIl8IY4bOC9BD BVBxN+cA== X-Received: by 2002:a05:6214:248b:b0:5be:ec50:7358 with SMTP id gi11-20020a056214248b00b005beec507358mr65931172qvb.3.1680529822362; Mon, 03 Apr 2023 06:50:22 -0700 (PDT) X-Google-Smtp-Source: AKy350bWBW6V11YdHrBb/Jqiv9CldnAhGrZgMXCJ2M6EPeMuRxG2jTvBxOxy9XiF6XEfoqWWJWRK6A== X-Received: by 2002:a05:6214:248b:b0:5be:ec50:7358 with SMTP id gi11-20020a056214248b00b005beec507358mr65931134qvb.3.1680529821948; Mon, 03 Apr 2023 06:50:21 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id lg9-20020a056214548900b005dd8b9345ecsm2617623qvb.132.2023.04.03.06.50.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 06:50:21 -0700 (PDT) To: gdb-patches@sourceware.org Subject: Re: [PATCHv5 01/11] gdb: include breakpoint number in testing condition error message In-Reply-To: <24b51a1fbfc6f8b8cc52e3f90d4f36c1d44aaa6b.1678987897.git.aburgess@redhat.com> References: <24b51a1fbfc6f8b8cc52e3f90d4f36c1d44aaa6b.1678987897.git.aburgess@redhat.com> Date: Mon, 03 Apr 2023 14:50:19 +0100 Message-ID: <87r0t1cbxg.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Andrew Burgess writes: > When GDB fails to test the condition of a conditional breakpoint, for > whatever reason, the error message looks like this: > > (gdb) break foo if (*(int *) 0) == 1 > Breakpoint 1 at 0x40111e: file bpcond.c, line 11. > (gdb) r > Starting program: /tmp/bpcond > Error in testing breakpoint condition: > Cannot access memory at address 0x0 > > Breakpoint 1, foo () at bpcond.c:11 > 11 int a = 32; > (gdb) > > The line I'm interested in for this commit is this one: > > Error in testing breakpoint condition: > > In the case above we can figure out that the problematic breakpoint > was #1 because in the final line of the message GDB reports the stop a > breakpoint #1. > > However, in the next few patches I plan to change this. In some cases > I don't think it makes sense for GDB to report the stop as being at > breakpoint #1, consider this case: > > (gdb) list some_func > 1 int > 2 some_func () > 3 { > 4 int *p = 0; > 5 return *p; > 6 } > 7 > 8 void > 9 foo () > 10 { > (gdb) break foo if (some_func ()) > Breakpoint 1 at 0x40111e: file bpcond.c, line 11. > (gdb) r > Starting program: /tmp/bpcond > > Program received signal SIGSEGV, Segmentation fault. > 0x0000000000401116 in some_func () at bpcond.c:5 > 5 return *p; > Error in testing breakpoint condition: > The program being debugged was signaled while in a function called from GDB. > GDB remains in the frame where the signal was received. > To change this behavior use "set unwindonsignal on". > Evaluation of the expression containing the function > (some_func) will be abandoned. > When the function is done executing, GDB will silently stop. > > Program received signal SIGSEGV, Segmentation fault. > > Breakpoint 1, 0x0000000000401116 in some_func () at bpcond.c:5 > 5 return *p; > (gdb) > > Notice that, the final lines of output report the stop as being at > breakpoint #1, even though we are actually located within some_func. > > I find this behaviour confusing, and propose that this should be > changed. However, if I make that change then every reference to > breakpoint #1 will be lost from the error message. > > So, in this commit, in preparation for the later commits, I propose to > change the 'Error in testing breakpoint condition:' line to this: > > Error in testing condition for breakpoint NUMBER: > > where NUMBER will be filled in as appropriate. Here's the first > example with the updated error: > > (gdb) break foo if (*(int *) 0) == 0 > Breakpoint 1 at 0x40111e: file bpcond.c, line 11. > (gdb) r > Starting program: /tmp/bpcond > Error in testing condition for breakpoint 1: > Cannot access memory at address 0x0 > > Breakpoint 1, foo () at bpcond.c:11 > 11 int a = 32; > (gdb) > > The breakpoint number does now appear twice in the output, but I don't > see that as a negative. > > This commit just changes the one line of the error, and updates the > few tests that either included the old error in comments, or actually > checked for the error in the expected output. > > As the only test that checked the line I modified is a Python test, > I've added a new test that doesn't rely on Python that checks the > error message in detail. > > While working on the new test, I spotted that it would fail when run > with native-gdbserver and native-extended-gdbserver target boards. > This turns out to be due to a gdbserver bug. To avoid cluttering this > commit I've added a work around to the new test script so that the > test passes for the remote boards, in the next few commits I will fix > gdbserver, and update the test script to remove the work around. I went ahead and pushed this commit. If there are any problems, please let me know, I'm happy to address any issues. Thanks, Andrew