From patchwork Wed May 17 09:40:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 69511 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C5F1B3857027 for ; Wed, 17 May 2023 09:40:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C5F1B3857027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684316447; bh=qGdqchnYxNM9aNKA3UcbVIm+OL7C6AmnYcSWYUtLtMs=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=pAbZyS4XDca6IF/YW49V0JaMcyS7rYMthLo8HyLU/bo9ObAu8kAWz8ysUysIQEjdy qGyaToX5JYV3VGWdADDsmZzBReE1A+k+RHA9SBDzYo3UINIXHPedPYssEX2mTESQtQ NnNN7lkIyzx0yc+T/qsbchbl1U4mL5PW5BIA254U= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org 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 CF4F83858C2F for ; Wed, 17 May 2023 09:40:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF4F83858C2F Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-3jISpe36PQi1sy1URQTfYg-1; Wed, 17 May 2023 05:40:23 -0400 X-MC-Unique: 3jISpe36PQi1sy1URQTfYg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f422150893so3486165e9.2 for ; Wed, 17 May 2023 02:40:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684316422; x=1686908422; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qGdqchnYxNM9aNKA3UcbVIm+OL7C6AmnYcSWYUtLtMs=; b=CICkjHB7hqgZqG/zQTXyOO1Q3WRGRsNTTs0MSRSlbOuvUcECP+WhSnQVVqRleh9jyJ UhmKZtpJOfXEajIiGHO3ndcZWmeWgQYcj7rz77pRF0Qj+BJiMCDEku6VoF/TsbAKrOT1 dev1OK4mKHw8GA4HLySfL4gsiLOdflx9UdKjq2y4GQgHBLY5LouuUorkIP8qa4n5EL/D tJuwTFkmwoSwKAvAYZpjVawoqXtMEU35yOkSJdKypYAUXW5ksOWNYm8ReI/PwmzoAr/m Y3TBpV1A149vbOamPTZdSCec9czK0I0ZDnYYMLH84H052b/zGTa1P4SfD0/dcGPV5wHi iG+A== X-Gm-Message-State: AC+VfDx5cYgRlqiY45lqZizoEh4NuHkpZxfYsAlUKXhCmYDexEQ29Hsb ctUcTdDu5tbw2/2uIrvdx/hmBCqdZkXF4SbBxecXFZl3tokUD9NHYOYj8LoYuyo5h2kf+uB1XqA I4sRm31ijR+diqum+WfmxkFxy4yTJAjWkTuc40zOE6DXCPgHshW+N16Dy5WQnxo6oEpcMxL42DI HQMLaR7A== X-Received: by 2002:a5d:5288:0:b0:309:3e49:e4d4 with SMTP id c8-20020a5d5288000000b003093e49e4d4mr169653wrv.9.1684316421975; Wed, 17 May 2023 02:40:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6xhGYz/T6mZv4Q8/CVzXwwMRiTGHQIT9Bquft+z+SiRS6cRZlYShCFk+xQ2nnyjMv03rBnqg== X-Received: by 2002:a5d:5288:0:b0:309:3e49:e4d4 with SMTP id c8-20020a5d5288000000b003093e49e4d4mr169638wrv.9.1684316421621; Wed, 17 May 2023 02:40:21 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id x10-20020adff64a000000b0030630120e56sm2227366wrp.57.2023.05.17.02.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 02:40:21 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb/breakpoint: use warning function instead of gdb_printf Date: Wed, 17 May 2023 10:40:18 +0100 Message-Id: <5ee8acaac3e62fb0ac9b5cb64aa707b5f478ad42.1684316400.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: Andrew Burgess via Gdb-patches From: Andrew Burgess Reply-To: Andrew Burgess Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Noticed that in breakpoint.c, in one place, we do this: gdb_printf (_("warning: Error removing " "breakpoint %d\n"), old_loc->owner->number); Instead of using the `warning` function. There are a number of differences between using gdb_printf like this and calling `warning`, the main one is probably that real warnings are sent to gdb_stderr, while the above gdb_printf call will go to gdb_stdout. In this commit I: 1. Change to call `warning`, we can drop the "warning: " prefix from the string in breakpoint.c, 2. Update the warning text, I now start with a lower case 'e', which I believe is the GDB style for warnings, 3. And I have included the address of the bp_location in the warning messsage, 4. Finally, I update all the tests (2) that include this error message. Reviewed-By: Tom Tromey --- gdb/breakpoint.c | 6 +++--- gdb/testsuite/gdb.base/break-main-file-remove-fail.exp | 4 ++-- gdb/testsuite/gdb.base/hw-sw-break-same-address.exp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) base-commit: 66b8e6c7b8d3c137029f4f2ab8c5b798aa1cbdd7 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index fdb184ae81f..552b789cba1 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11342,9 +11342,9 @@ update_global_location_list (enum ugll_insert_mode insert_mode) Note that at this point, old_loc->owner is still valid, as delete_breakpoint frees the breakpoint only after calling us. */ - gdb_printf (_("warning: Error removing " - "breakpoint %d\n"), - old_loc->owner->number); + warning (_("error removing breakpoint %d at %s"), + old_loc->owner->number, + paddress (old_loc->gdbarch, old_loc->address)); } removed = true; } diff --git a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp index c7cf4f3df00..5e689fae5d3 100644 --- a/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp +++ b/gdb/testsuite/gdb.base/break-main-file-remove-fail.exp @@ -100,7 +100,7 @@ proc test_remove_bp { initial_load } { # get_integer_valueof. set munmap -1 gdb_test_multiple "print /d ${munmap_expr}" "get result of munmap call" { - -re -wrap "^(?:warning: Error removing breakpoint $::decimal\r\n)?\\$\[0-9\]* = (\[-\]*\[0-9\]*).*" { + -re -wrap "^(?:warning: error removing breakpoint $::decimal at $::hex\r\n)?\\$\[0-9\]* = (\[-\]*\[0-9\]*).*" { set munmap $expect_out(1,string) pass $gdb_test_name } @@ -112,7 +112,7 @@ proc test_remove_bp { initial_load } { } gdb_test "delete \$bpnum" \ - "warning: Error removing breakpoint .*" \ + "^warning: error removing breakpoint $::decimal at $::hex" \ "failure to remove breakpoint warns" } } diff --git a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp index 9f941186454..6ac69e5630f 100644 --- a/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp +++ b/gdb/testsuite/gdb.base/hw-sw-break-same-address.exp @@ -50,7 +50,7 @@ with_test_prefix "hw-sw" { # A bad GDB debugging against GDBserver would output a warning # here: # delete breakpoints - # warning: Error removing breakpoint 3 + # warning: error removing breakpoint 3 at
# (gdb) FAIL: gdb.base/hw-sw-break-same-address.exp: hw-sw: delete breakpoints gdb_test_no_output "delete breakpoints" }