public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Simplify tui_update_source_windows_with_line
@ 2019-12-20 16:19 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-12-20 16:19 UTC (permalink / raw)
  To: gdb-cvs

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

commit 5d49bf1b698124fe21017105f84b18e29221b262
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Nov 12 18:04:01 2019 -0700

    Simplify tui_update_source_windows_with_line
    
    This changes tui_update_source_windows_with_line to take a
    symtab_and_line, rather than separate parameters, and then updates the
    caller.
    
    gdb/ChangeLog
    2019-12-20  Tom Tromey  <tom@tromey.com>
    
    	* tui/tui.c (tui_show_source): Update.
    	* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
    	* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
    	a symtab_symbol_info, not a separate symtab and line.  Simplify.
    
    Change-Id: I8803a0a6fd2938ceee859aea53a57ce582f3e80d

Diff:
---
 gdb/ChangeLog           |  7 +++++++
 gdb/tui/tui-winsource.c | 36 ++++++++----------------------------
 gdb/tui/tui-winsource.h |  3 +--
 gdb/tui/tui.c           |  2 +-
 4 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 77620d0..f5d667e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui.c (tui_show_source): Update.
+	* tui/tui-winsource.h (tui_update_source_windows_with_line): Update.
+	* tui/tui-winsource.c (tui_update_source_windows_with_line): Take
+	a symtab_symbol_info, not a separate symtab and line.  Simplify.
+
+2019-12-20  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui-winsource.c (tui_update_source_windows_with_addr):
 	Simplify.
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 8f98904..3305c8c 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -214,39 +214,19 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
     win_info->update_source_window (gdbarch, sal);
 }
 
-/* Function to ensure that the source and/or disassemly windows
-   reflect the input address.  */
+/* Function to ensure that the source and/or disassembly windows
+   reflect the symtab and line.  */
 void
-tui_update_source_windows_with_line (struct symtab *s, int line)
+tui_update_source_windows_with_line (struct symtab_and_line sal)
 {
-  struct gdbarch *gdbarch;
-  CORE_ADDR pc;
-  struct symtab_and_line sal;
-
-  if (!s)
+  if (!sal.symtab)
     return;
 
-  sal.pspace = current_program_space;
-  sal.symtab = s;
-  sal.line = line;
-
-  gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
+  find_line_pc (sal.symtab, sal.line, &sal.pc);
+  struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
 
-  switch (tui_current_layout ())
-    {
-    case DISASSEM_COMMAND:
-    case DISASSEM_DATA_COMMAND:
-      find_line_pc (s, line, &pc);
-      tui_update_source_windows_with_addr (gdbarch, pc);
-      break;
-    default:
-      find_line_pc (s, line, &pc);
-      sal.pc = pc;
-      TUI_SRC_WIN->update_source_window (gdbarch, sal);
-      if (tui_current_layout () == SRC_DISASSEM_COMMAND)
-	TUI_DISASM_WIN->update_source_window (gdbarch, sal);
-      break;
-    }
+  for (struct tui_source_window_base *win_info : tui_source_windows ())
+    win_info->update_source_window (gdbarch, sal);
 }
 
 void
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index dde56a7..435203d 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -227,8 +227,7 @@ extern void tui_update_all_breakpoint_info (struct breakpoint *being_deleted);
 /* Function to display the "main" routine.  */
 extern void tui_display_main (void);
 extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
-extern void tui_update_source_windows_with_line (struct symtab *, 
-						 int);
+extern void tui_update_source_windows_with_line (struct symtab_and_line sal);
 
 /* Extract some source text from PTR.  LINE_NO is the line number.  If
    it is positive, it is printed at the start of the line.  FIRST_COL
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index deb6bb2..a0d2e4c 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -634,7 +634,7 @@ tui_show_source ()
   /* Make sure that the source window is displayed.  */
   tui_add_win_to_layout (SRC_WIN);
 
-  tui_update_source_windows_with_line (cursal.symtab, cursal.line);
+  tui_update_source_windows_with_line (cursal);
   tui_update_locator_fullname (cursal.symtab);
 }


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

only message in thread, other threads:[~2019-12-20 16:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-20 16:19 [binutils-gdb] Simplify tui_update_source_windows_with_line 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).