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.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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680529828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=U76DulMOATDFuwB2fnUeb51+uOXicv/+8jkc/kb1Lzc=; b=XuKBINM/8Ajicr5uIjAbnvP5DK9w5lsOAAyWKKng5lwKqwobrd39B/OWyrm5/puMjZV5Hm gyQNSpL+hFVnUepq0R9+3RNxpw/xsn6VFx+YEmS1cpM5hYWLzFEmwGilINTXEhi0Jgq27T hbt9NJUcaNQKvW/za9PAva3tF1P3Sc0= 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) From: Andrew Burgess 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-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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