public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Fix regression from TUI disassembly style patch
@ 2019-11-06  1:39 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-11-06  1:39 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=825165c57e43b25ef57c3cf2cc345ec6aa40a0d3

commit 825165c57e43b25ef57c3cf2cc345ec6aa40a0d3
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Nov 5 18:12:49 2019 -0700

    Fix regression from TUI disassembly style patch
    
    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  <tom@tromey.com>
    
    	* tui/tui-disasm.c (struct tui_asm_line) <addr_size>: New member.
    	(tui_disassemble): Set addr_size.
    	(tui_disasm_window::set_contents): Use addr_size.
    
    Change-Id: Ic0152f3b82a2f79be28ae46d590096661f271580

Diff:
---
 gdb/ChangeLog        | 6 ++++++
 gdb/tui/tui-disasm.c | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5720c8e..e886480 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
 2019-11-05  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-disasm.c (struct tui_asm_line) <addr_size>: New member.
+	(tui_disassemble): Set addr_size.
+	(tui_disasm_window::set_contents): Use addr_size.
+
+2019-11-05  Tom Tromey  <tom@tromey.com>
+
 	* rust-lang.c (rust_language_defn): Update.
 	* python/py-value.c (valpy_string): Call c_get_string.
 	* p-lang.c (pascal_language_defn): Update.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 7178326..8d5512e 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 ();


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-06  1:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  1:39 [binutils-gdb] Fix regression from TUI disassembly style patch Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).