From patchwork Wed Nov 6 01:38:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 35665 Received: (qmail 110646 invoked by alias); 6 Nov 2019 01:39:06 -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 110638 invoked by uid 89); 6 Nov 2019 01:39:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.7 required=5.0 tests=AWL, 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.1 spammy= X-HELO: gateway22.websitewelcome.com Received: from gateway22.websitewelcome.com (HELO gateway22.websitewelcome.com) (192.185.47.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 06 Nov 2019 01:39:04 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway22.websitewelcome.com (Postfix) with ESMTP id C7F4B3663 for ; Tue, 5 Nov 2019 19:39:02 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id SAHmiwdNeqNtvSAHminBJF; Tue, 05 Nov 2019 19:39:02 -0600 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=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: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=RDyTyQ/HKdx1uQW+PLtvBd0zNC3tiag+p58FXhimxK8=; b=ZZpPPREnSjkZI/DFbhIHDOpZ8l 1/5P+Hnjt78EvoO1RWqK38U3/VYj4C/cPvqAPUHyd8fBPyBDH4ENU9f57fEN1BYaKo2Qr/RpXqmdL bPTzBEh3DOg0L+wEs5PSmoZDh; Received: from 75-166-66-104.hlrn.qwest.net ([75.166.66.104]:40378 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iSAHl-001UQ3-RI; Tue, 05 Nov 2019 18:39:01 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [FYI] Fix regression from TUI disassembly style patch Date: Tue, 5 Nov 2019 18:38:58 -0700 Message-Id: <20191106013858.7539-1-tom@tromey.com> My previous patch to add styling to the TUI disassembly failed to correctly fix a bug that Simon had pointed out in review. This patch fixes the bug. gdb/ChangeLog 2019-11-05 Tom Tromey * tui/tui-disasm.c (struct tui_asm_line) : New member. (tui_disassemble): Set addr_size. (tui_disasm_window::set_contents): Use addr_size. Change-Id: Ic0152f3b82a2f79be28ae46d590096661f271580 --- gdb/ChangeLog | 6 ++++++ gdb/tui/tui-disasm.c | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 71783266391..8d5512efb2c 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -47,6 +47,7 @@ struct tui_asm_line { CORE_ADDR addr; std::string addr_string; + size_t addr_size; std::string insn; }; @@ -110,6 +111,7 @@ tui_disassemble (struct gdbarch *gdbarch, else new_size = asm_lines[pos + i].addr_string.size (); *addr_size = std::max (*addr_size, new_size); + asm_lines[pos + i].addr_size = new_size; } pc = pc + gdb_print_insn (gdbarch, pc, &gdb_dis_out, NULL); @@ -239,8 +241,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch, std::string line = (asm_lines[i].addr_string - + n_spaces (insn_pos - - asm_lines[i].addr_string.size ()) + + n_spaces (insn_pos - asm_lines[i].addr_size) + asm_lines[i].insn); const char *ptr = line.c_str ();