From patchwork Thu Nov 16 19:08:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 838751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-467041-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="tX2KU8bk"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yd9hp5y7kz9s4s for ; Fri, 17 Nov 2017 06:06:50 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=qS+JD8wzbyGx 4WGdtgTw+BqE7R7Bfdyu9Kt0lOrP8vFg2vHiMx0dzkQQ3uJKS+0qb5WFIUAJVxJP LUby7Myqs8YGRWvtW5xQcS4yJpgHZUxhegb2liSc3NawQsrKOwU30Sd0i8RRZfzW UDHMsns44Lbtipve6BW70zeKAbDQf3U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=wHGd/4XJc4qiZSFL2d Cw1JRAB/s=; b=tX2KU8bkMOqSJNoOO/jb1qxs4EHg/Knv7cE5jprPmkJis9mfhl tzPykoUnf0mPHXsnePR2Kgw5YoPQ/IxXNdtHjJBh7kYgQSaWVGXAYPlq6pJ+cUA9 lgRuC3MWEL7VIw82cxVNKvZPgUtebTQN01R5L2oNwUeHOBYoEAAYyoLhY= Received: (qmail 73539 invoked by alias); 16 Nov 2017 19:06:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 72536 invoked by uid 89); 16 Nov 2017 19:06:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KB_WAM_FROM_NAME_SINGLEWORD, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=gdbinit.in, gdbinitin, sk:fnodia, sk:fno-dia X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Nov 2017 19:06:36 +0000 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 mx1.redhat.com (Postfix) with ESMTPS id D45E82C7D2 for ; Thu, 16 Nov 2017 19:06:35 +0000 (UTC) Received: from c64.redhat.com (ovpn-112-13.phx2.redhat.com [10.3.112.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A0BF5C3FF; Thu, 16 Nov 2017 19:06:34 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH] gdbinit.in: add "break-on-diagnostic" command Date: Thu, 16 Nov 2017 14:08:38 -0500 Message-Id: <1510859318-31411-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes It's useful to be able to put a breakpoint on the *emission* of a diagnostic (without having to step past all of the warnings that are suppressed because of command-line options). The invocation: (gdb) break diagnostic_show_locus has been my approach for this for a while (it even works in the presence of -fno-diagnostics-show-caret). This patch adds a pre-canned gdb command for adding this breakpoint. Not sure if I can self-approve this, but it's been very useful; it works nicely with tab-completion. I guess I'll commit it in a few days, unless people here can suggest improvements. gcc/ChangeLog: * gdbinit.in (break-on-diagnostic): New command. --- gcc/gdbinit.in | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/gdbinit.in b/gcc/gdbinit.in index 3e1279e..ebdeaf0 100644 --- a/gcc/gdbinit.in +++ b/gcc/gdbinit.in @@ -208,6 +208,16 @@ document pcfun Print current function. end +define break-on-diagnostic +break diagnostic_show_locus +end + +document break-on-diagnostic +Put a breakpoint on diagnostic_show_locus, called whenever a diagnostic +is emitted (as opposed to those warnings that are suppressed by +command-line options). +end + # Define some macros helpful to gdb when it is expanding macros. macro define __FILE__ "gdb" macro define __LINE__ 1