public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: gdb-buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] Simplify tui_source_window_base::maybe_update method
Date: Fri, 20 Dec 2019 21:18:00 -0000	[thread overview]
Message-ID: <1ae58f0c640ccef6ae9cc9b349547bb552274b69@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 1ae58f0c640ccef6ae9cc9b349547bb552274b69 ***

commit 1ae58f0c640ccef6ae9cc9b349547bb552274b69
Author:     Tom Tromey <tom@tromey.com>
AuthorDate: Tue Nov 12 17:08:25 2019 -0700
Commit:     Tom Tromey <tom@tromey.com>
CommitDate: Fri Dec 20 09:15:50 2019 -0700

    Simplify tui_source_window_base::maybe_update method
    
    tui_source_window_base::maybe_update takes a symtab_and_line, plus a
    separate line number and PC.  Because a symtab_and_line already holds
    a line number and a PC, it is possible to remove these extra
    parameters.
    
    gdb/ChangeLog
    2019-12-20  Tom Tromey  <tom@tromey.com>
    
            * tui/tui-winsource.h (struct tui_source_window_base)
            <maybe_update>: Remove line_no and addr parameters.
            * tui/tui-stack.c (tui_show_frame_info): Set PC on sal.  Update.
            * tui/tui-source.h (struct tui_source_window) <maybe_update>:
            Update.
            * tui/tui-source.c (tui_source_window::maybe_update): Remove
            line_no and addr parameters.
            * tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
            Update.
            * tui/tui-disasm.c (tui_disasm_window::maybe_update): Remove
            line_no and addr parameters.
    
    Change-Id: I33d8e1a669a179544edb4197f5f7c5429dfc368e

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1fc603d8d6..9ac1430ee0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,17 @@
+2019-12-20  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui-winsource.h (struct tui_source_window_base)
+	<maybe_update>: Remove line_no and addr parameters.
+	* tui/tui-stack.c (tui_show_frame_info): Set PC on sal.  Update.
+	* tui/tui-source.h (struct tui_source_window) <maybe_update>:
+	Update.
+	* tui/tui-source.c (tui_source_window::maybe_update): Remove
+	line_no and addr parameters.
+	* tui/tui-disasm.h (struct tui_disasm_window) <maybe_update>:
+	Update.
+	* tui/tui-disasm.c (tui_disasm_window::maybe_update): Remove
+	line_no and addr parameters.
+
 2019-12-20  Tom Tromey  <tom@tromey.com>
 
 	* tui/tui-winsource.c (tui_source_window_base::set_is_exec_point_at)
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 94780a56d8..63d581bd68 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -384,31 +384,30 @@ tui_disasm_window::addr_is_displayed (CORE_ADDR addr) const
 }
 
 void
-tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
-				 int line_no, CORE_ADDR addr)
+tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal)
 {
   CORE_ADDR low;
 
-  if (find_pc_partial_function (get_frame_pc (fi),
-				NULL, &low, NULL) == 0)
+  struct gdbarch *frame_arch = get_frame_arch (fi);
+
+  if (find_pc_partial_function (sal.pc, NULL, &low, NULL) == 0)
     {
       /* There is no symbol available for current PC.  There is no
 	 safe way how to "disassemble backwards".  */
-      low = get_frame_pc (fi);
+      low = sal.pc;
     }
   else
-    low = tui_get_low_disassembly_address (get_frame_arch (fi),
-					   low, get_frame_pc (fi));
+    low = tui_get_low_disassembly_address (frame_arch, low, sal.pc);
 
   struct tui_line_or_address a;
 
   a.loa = LOA_ADDRESS;
   a.u.addr = low;
-  if (!addr_is_displayed (addr))
-    update_source_window (get_frame_arch (fi), sal.symtab, a);
+  if (!addr_is_displayed (sal.pc))
+    update_source_window (frame_arch, sal.symtab, a);
   else
     {
-      a.u.addr = addr;
+      a.u.addr = sal.pc;
       set_is_exec_point_at (a);
     }
 }
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index a4b04e4ddd..28f87c67ee 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -44,9 +44,7 @@ struct tui_disasm_window : public tui_source_window_base
 
   bool location_matches_p (struct bp_location *loc, int line_no) override;
 
-  void maybe_update (struct frame_info *fi, symtab_and_line sal,
-		     int line_no, CORE_ADDR addr)
-    override;
+  void maybe_update (struct frame_info *fi, symtab_and_line sal) override;
 
   void erase_source_content () override
   {
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 6c3425fb89..a4d808faad 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -209,10 +209,9 @@ tui_source_window::line_is_displayed (int line) const
 }
 
 void
-tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
-				 int line_no, CORE_ADDR addr)
+tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal)
 {
-  int start_line = (line_no - (viewport_height / 2)) + 1;
+  int start_line = (sal.line - (viewport_height / 2)) + 1;
   if (start_line <= 0)
     start_line = 1;
 
@@ -223,12 +222,11 @@ tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
 
   l.loa = LOA_LINE;
   l.u.line_no = start_line;
-  if (!(source_already_displayed
-	&& line_is_displayed (line_no)))
+  if (!(source_already_displayed && line_is_displayed (sal.line)))
     update_source_window (get_frame_arch (fi), sal.symtab, l);
   else
     {
-      l.u.line_no = line_no;
+      l.u.line_no = sal.line;
       set_is_exec_point_at (l);
     }
 }
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index a2b7754e7e..15d14291d2 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -49,9 +49,7 @@ struct tui_source_window : public tui_source_window_base
 
   bool showing_source_p (const char *filename) const;
 
-  void maybe_update (struct frame_info *fi, symtab_and_line sal,
-		     int line_no, CORE_ADDR addr)
-    override;
+  void maybe_update (struct frame_info *fi, symtab_and_line sal) override;
 
   void erase_source_content () override
   {
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 7803b9538c..4f6fe8ebda 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -341,9 +341,13 @@ tui_show_frame_info (struct frame_info *fi)
       if (!locator_changed_p)
 	return 0;
 
+      /* find_frame_sal does not always set PC, but we want to ensure
+	 that it is available in the SAL.  */
+      sal.pc = pc;
+
       for (struct tui_source_window_base *win_info : tui_source_windows ())
 	{
-	  win_info->maybe_update (fi, sal, locator->line_no, locator->addr);
+	  win_info->maybe_update (fi, sal);
 	  win_info->update_exec_info ();
 	}
 
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 8b9620034f..1ba967c5b6 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -109,8 +109,7 @@ public:
 
   /* Update the window to display the given location.  Does nothing if
      the location is already displayed.  */
-  virtual void maybe_update (struct frame_info *fi, symtab_and_line sal,
-			     int line_no, CORE_ADDR addr) = 0;
+  virtual void maybe_update (struct frame_info *fi, symtab_and_line sal) = 0;
 
   void update_source_window_as_is  (struct gdbarch *gdbarch,
 				    struct symtab *s,


             reply	other threads:[~2019-12-20 21:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 21:18 gdb-buildbot [this message]
2019-12-20 21:11 ` Failures on Ubuntu-Aarch64-native-extended-gdbserver-m64, branch master gdb-buildbot
2019-12-21 21:02 ` Failures on Fedora-i686, " gdb-buildbot
2019-12-21 21:08 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2019-12-21 21:16 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2019-12-21 21:20 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2019-12-21 21:36 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2019-12-21 21:43 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2019-12-21 21:53 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ae58f0c640ccef6ae9cc9b349547bb552274b69@gdb-build \
    --to=gdb-buildbot@sergiodj.net \
    --cc=gdb-testers@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).