Patchwork [review] Change tui_update_locator_fullname to take a symtab

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 14, 2019, 11:35 p.m.
Message ID <gerrit.1573774548000.Ic61749517b44ac68561d829ff81f16976b830dec@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/35908/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 14, 2019, 11:35 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/630
......................................................................

Change tui_update_locator_fullname to take a symtab

This changes tui_update_locator_fullname to take a symtab.  This
somewhat consolidates the "??" handling.

gdb/ChangeLog
2019-11-14  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_show_source): Update.
	* tui/tui-winsource.c (tui_display_main): Update.
	* tui/tui-stack.h (tui_update_locator_fullname): Change parameter
	to symtab.
	* tui/tui-stack.c (tui_update_locator_fullname): Change parameter
	to symtab.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Update.

Change-Id: Ic61749517b44ac68561d829ff81f16976b830dec
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
M gdb/tui/tui-stack.c
M gdb/tui/tui-stack.h
M gdb/tui/tui-winsource.c
M gdb/tui/tui.c
6 files changed, 21 insertions(+), 13 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1a84242..9876734 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@ 
+2019-11-14  Tom Tromey  <tom@tromey.com>
+
+	* tui/tui.c (tui_show_source): Update.
+	* tui/tui-winsource.c (tui_display_main): Update.
+	* tui/tui-stack.h (tui_update_locator_fullname): Change parameter
+	to symtab.
+	* tui/tui-stack.c (tui_update_locator_fullname): Change parameter
+	to symtab.
+	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Update.
+
 2019-11-14  Tom Tromey  <tromey@adacore.com>
 
 	* eval.c (evaluate_subexp_standard) <BINOP_ASSIGN>: Do not pass an
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 8d5512e..74f2ca5 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -297,12 +297,8 @@ 
       val.u.line_no = sal.line;
       TUI_SRC_WIN->update_source_window (gdbarch, sal.symtab, val);
       if (sal.symtab)
-	{
-	  set_current_source_symtab_and_line (sal);
-	  tui_update_locator_fullname (symtab_to_fullname (sal.symtab));
-	}
-      else
-	tui_update_locator_fullname ("?");
+	set_current_source_symtab_and_line (sal);
+      tui_update_locator_fullname (sal.symtab);
     }
 }
 
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 078f819..7803b95 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -288,10 +288,15 @@ 
 
 /* Update only the full_name portion of the locator.  */
 void
-tui_update_locator_fullname (const char *fullname)
+tui_update_locator_fullname (struct symtab *symtab)
 {
   struct tui_locator_window *locator = tui_locator_win_info_ptr ();
 
+  const char *fullname;
+  if (symtab != nullptr)
+    fullname = symtab_to_fullname (symtab);
+  else
+    fullname = "??";
   locator->set_locator_fullname (fullname);
 }
 
diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h
index 93a79fb..3ac14c1 100644
--- a/gdb/tui/tui-stack.h
+++ b/gdb/tui/tui-stack.h
@@ -67,7 +67,7 @@ 
   std::string make_status_line () const;
 };
 
-extern void tui_update_locator_fullname (const char *);
+extern void tui_update_locator_fullname (struct symtab *symtab);
 extern void tui_show_locator_content (void);
 extern int tui_show_frame_info (struct frame_info *);
 
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 3ca723c..6c9f62f 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -57,10 +57,7 @@ 
 
 	  tui_update_source_windows_with_addr (gdbarch, addr);
 	  s = find_pc_line_symtab (addr);
-          if (s != NULL)
-             tui_update_locator_fullname (symtab_to_fullname (s));
-          else
-             tui_update_locator_fullname ("??");
+	  tui_update_locator_fullname (s);
 	}
     }
 }
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 3f5ab41..0ec10b6 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -634,7 +634,7 @@ 
   tui_add_win_to_layout (SRC_WIN);
 
   tui_update_source_windows_with_line (cursal.symtab, line);
-  tui_update_locator_fullname (fullname);
+  tui_update_locator_fullname (cursal.symtab);
 }
 
 void