From: "Tom Tromey (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: gdb-patches@sourceware.org
Subject: [review] Simplify tui_update_source_windows_with_line
Date: Thu, 14 Nov 2019 23:36:00 -0000 [thread overview]
Message-ID: <gerrit.1573774548000.I8803a0a6fd2938ceee859aea53a57ce582f3e80d@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1573774548000.I8803a0a6fd2938ceee859aea53a57ce582f3e80d@gnutoolchain-gerrit.osci.io>
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/642
......................................................................
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-11-14 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
---
M gdb/ChangeLog
M gdb/tui/tui-winsource.c
M gdb/tui/tui-winsource.h
M gdb/tui/tui.c
4 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 358a90f..fcd7b18 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2019-11-14 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-11-14 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 e1b19cd..4b58311 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -207,38 +207,19 @@
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.symtab = s;
- sal.line = line;
+ find_line_pc (sal.symtab, sal.line, &sal.pc);
+ struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
- gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
-
- 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 c66ea42..63042d1 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -227,8 +227,7 @@
/* 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 472d0da..ae81fc9 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -633,7 +633,7 @@
/* 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);
}
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I8803a0a6fd2938ceee859aea53a57ce582f3e80d
Gerrit-Change-Number: 642
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newchange
next parent reply other threads:[~2019-11-14 23:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-14 23:36 Tom Tromey (Code Review) [this message]
2019-12-12 2:41 ` [review v2] " Tom Tromey (Code Review)
2019-12-20 16:20 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-20 16:29 ` Sourceware to Gerrit sync (Code Review)
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=gerrit.1573774548000.I8803a0a6fd2938ceee859aea53a57ce582f3e80d@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=gdb-patches@sourceware.org \
--cc=tromey@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