aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-disasm.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-06 15:06:47 -0600
committerTom Tromey <tom@tromey.com>2019-08-15 12:29:28 -0600
commit088f37dd90eecb647347c1aa53d36b3f5be64b21 (patch)
tree4453f8eb6169fd83c92be094b406903830a87ef8 /gdb/tui/tui-disasm.c
parenta54700c6c45ea424b668f2201ef14906f2052412 (diff)
downloadgdb-088f37dd90eecb647347c1aa53d36b3f5be64b21.zip
gdb-088f37dd90eecb647347c1aa53d36b3f5be64b21.tar.gz
gdb-088f37dd90eecb647347c1aa53d36b3f5be64b21.tar.bz2
Change tui_addr_is_displayed into a method
This changes tui_addr_is_displayed to be a method on tui_disasm_window, now that it is obvious that it can only be called for this type. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_addr_is_displayed): Don't declare. * tui/tui-winsource.c (tui_addr_is_displayed): Move to tui-disasm.c. * tui/tui-disasm.h (struct tui_disasm_window) <addr_is_displayed>: Declare. * tui/tui-disasm.c (tui_disasm_window::addr_is_displayed): New method. (tui_disasm_window::maybe_update): Update.
Diffstat (limited to 'gdb/tui/tui-disasm.c')
-rw-r--r--gdb/tui/tui-disasm.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index fcb33bc..e55f35d 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -381,6 +381,24 @@ tui_disasm_window::location_matches_p (struct bp_location *loc, int line_no)
&& content[line_no].line_or_addr.u.addr == loc->address);
}
+bool
+tui_disasm_window::addr_is_displayed (CORE_ADDR addr) const
+{
+ bool is_displayed = false;
+ int threshold = SCROLL_THRESHOLD;
+
+ int i = 0;
+ while (i < content.size () - threshold && !is_displayed)
+ {
+ is_displayed
+ = (content[i].line_or_addr.loa == LOA_ADDRESS
+ && content[i].line_or_addr.u.addr == addr);
+ i++;
+ }
+
+ return is_displayed;
+}
+
void
tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
int line_no, CORE_ADDR addr)
@@ -402,7 +420,7 @@ tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
a.loa = LOA_ADDRESS;
a.u.addr = low;
- if (!tui_addr_is_displayed (addr, this, TRUE))
+ if (!addr_is_displayed (addr))
tui_update_source_window (this, get_frame_arch (fi),
sal.symtab, a, TRUE);
else