From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94494 invoked by alias); 6 Oct 2018 16:36:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 94409 invoked by uid 89); 6 Oct 2018 16:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:breakpoint.c, breakpoint.c, breakpointc X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 06 Oct 2018 16:36:02 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1E7241E4C2; Sat, 6 Oct 2018 12:36:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=simark.ca; s=mail; t=1538843761; bh=/WHdRlEioyanhitGXAbf24wADvgXR0CHgnPY+WDulqQ=; h=Subject:To:References:From:Date:In-Reply-To:From; b=nqXe5+GQ1s6qChcSmhbFN8sRoJxziGGZeV5d0OQJFfhfSFIp59wstB2Fo3ecch25g V5w7LKOJdQZVOVP0C5m1U8Wb788YmCsxRCGtXWzrF2pWuGMvVdfhlmA4uQs/N1NbhF 2TMWgPASXHVbrxqAg9ASqnMvU060mPzNCp1L/yhk= Subject: Re: [RFC 5/8] Style locations when setting a breakpoint To: Tom Tromey , gdb-patches@sourceware.org References: <20180906211303.11029-1-tom@tromey.com> <20180906211303.11029-6-tom@tromey.com> From: Simon Marchi Message-ID: <820cd1d7-445a-b97f-d3b2-66f6facc1d86@simark.ca> Date: Sat, 06 Oct 2018 16:36:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20180906211303.11029-6-tom@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-10/txt/msg00148.txt.bz2 On 2018-09-06 5:13 p.m., Tom Tromey wrote: > say_where does not use ui-out, so function and file names printed by > it were not styled. This patch changes say_where to use the low-level > style code directly. > --- > gdb/breakpoint.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index 4e7dac51574..62824351ed6 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -68,6 +68,7 @@ > #include "format.h" > #include "thread-fsm.h" > #include "tid-parse.h" > +#include "cli/cli-style.h" > > /* readline include files */ > #include "readline/readline.h" > @@ -12203,9 +12204,14 @@ say_where (struct breakpoint *b) > /* If there is a single location, we can print the location > more nicely. */ > if (b->loc->next == NULL) > - printf_filtered (": file %s, line %d.", > - symtab_to_filename_for_display (b->loc->symtab), > - b->loc->line_number); > + { > + puts_filtered (": file "); > + set_output_style (gdb_stdout, file_name_style.style ()); > + puts_filtered (symtab_to_filename_for_display (b->loc->symtab)); > + set_output_style (gdb_stdout, ui_file_style ()); > + printf_filtered (", line %d.", > + b->loc->line_number); > + } In general, I guess we'll want to use an RAII object that resets the output style, in case the code between the two calls throws? Simon