diff options
author | Tom Tromey <tom@tromey.com> | 2019-12-21 11:14:56 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-19 13:08:48 -0700 |
commit | 4f13c1c00be32131845ae50aef788d4f2c652dff (patch) | |
tree | 2d269ef25cb784be2931a85b69a01bfd3bbc2e75 /gdb/tui | |
parent | fa47e4463ab4ee4ddc7858ab11063c7965b232ac (diff) | |
download | gdb-4f13c1c00be32131845ae50aef788d4f2c652dff.zip gdb-4f13c1c00be32131845ae50aef788d4f2c652dff.tar.gz gdb-4f13c1c00be32131845ae50aef788d4f2c652dff.tar.bz2 |
Make "file" clear TUI source window
I noticed that a plain "file" will leave the current source file in
the TUI source window. Instead, I think, it should clear the source
window. This patch implements this.
gdb/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_windows_with_line):
Handle case where symtab is null.
gdb/testsuite/ChangeLog
2020-01-19 Tom Tromey <tom@tromey.com>
* gdb.tui/main.exp: Add check for plain "file".
Change-Id: I8424acf837f1a47f75bc6a833d1e917d4c10b51e
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-winsource.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index fbee2e3..3ba2f2b 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -212,11 +212,12 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr) void tui_update_source_windows_with_line (struct symtab_and_line sal) { - if (!sal.symtab) - return; - - find_line_pc (sal.symtab, sal.line, &sal.pc); - struct gdbarch *gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); + struct gdbarch *gdbarch = nullptr; + if (sal.symtab != nullptr) + { + find_line_pc (sal.symtab, sal.line, &sal.pc); + gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab)); + } for (struct tui_source_window_base *win_info : tui_source_windows ()) win_info->update_source_window (gdbarch, sal); |