From patchwork Wed Nov 28 00:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 30344 Received: (qmail 27531 invoked by alias); 28 Nov 2018 00:14:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27428 invoked by uid 89); 28 Nov 2018 00:14:45 -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, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Style X-HELO: gateway33.websitewelcome.com Received: from gateway33.websitewelcome.com (HELO gateway33.websitewelcome.com) (192.185.146.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Nov 2018 00:14:41 +0000 Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 4AC2F1AC877 for ; Tue, 27 Nov 2018 18:14:40 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id RnV2g8Qm4SjJARnV2gVvKo; Tue, 27 Nov 2018 18:14:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=f7rZVBa7+/aYcBf+Yt2zZDtY1wrs3biuyp/ACt4xI1o=; b=sohaMzKGuDldLu0IXw5s+YagYw WRnjP8fL2BlYbSx8vXfws+Wjnf4NguwmC2s60bOGPARd30JNQzM8NPxM7buPUIr4vM46Z0giOUC92 ZkohgFhktPdTsVXLeKbHfQMEY; Received: from 97-122-190-66.hlrn.qwest.net ([97.122.190.66]:33804 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gRnV2-004MMp-2M; Tue, 27 Nov 2018 18:14:40 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 09/16] Style print_address_symbolic Date: Tue, 27 Nov 2018 17:14:28 -0700 Message-Id: <20181128001435.12703-10-tom@tromey.com> In-Reply-To: <20181128001435.12703-1-tom@tromey.com> References: <20181128001435.12703-1-tom@tromey.com> print_address_symbolic does not use ui-out, so it did not style function names. This patch changes it to use the low-level style code directly. gdb/ChangeLog 2018-11-27 Tom Tromey * printcmd.c (print_address_symbolic): Style function name. gdb/testsuite/ChangeLog 2018-11-27 Tom Tromey * gdb.base/style.exp: Add test for print_address_symbolic. --- gdb/ChangeLog | 4 ++++ gdb/printcmd.c | 9 +++++---- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/style.exp | 2 ++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gdb/printcmd.c b/gdb/printcmd.c index dd1626455b..c5b6b1a75b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -50,6 +50,7 @@ #include "format.h" #include "source.h" #include "common/byte-vector.h" +#include "cli/cli-style.h" /* Last specified output format. */ @@ -535,7 +536,7 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr, fputs_filtered ("<*", stream); else fputs_filtered ("<", stream); - fputs_filtered (name.c_str (), stream); + fputs_styled (name.c_str (), function_name_style.style (), stream); if (offset != 0) fprintf_filtered (stream, "+%u", (unsigned int) offset); @@ -543,10 +544,10 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr, line # of this addr, if we have it; else line # of the nearest symbol. */ if (print_symbol_filename && !filename.empty ()) { + fputs_filtered (line == -1 ? " in " : " at ", stream); + fputs_styled (filename.c_str (), file_name_style.style (), stream); if (line != -1) - fprintf_filtered (stream, " at %s:%d", filename.c_str (), line); - else - fprintf_filtered (stream, " in %s", filename.c_str ()); + fprintf_filtered (stream, ":%d", line); } if (unmapped) fputs_filtered ("*>", stream); diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index df73e25a16..8b82ae99fa 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -42,4 +42,6 @@ save_vars { env(TERM) } { gdb_test "info breakpoints" "$main_expr at $file_expr.*" gdb_test "break main" "file $base_file_expr.*" + + gdb_test "print &main" " = .* <$main_expr>" }