mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 18:39:34 +08:00
Change tui_source_window_base::set_contents to return bool
This changes tui_source_window_base::set_contents to return bool, rather than tui_status. It also changes one implementation of set_contents to use early returns rather than a variable, which IMO makes it easier to follow. gdb/ChangeLog 2019-12-20 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_contents>: Return bool. * tui/tui-winsource.c (tui_source_window_base::update_source_window_as_is): Update. * tui/tui-source.h (struct tui_source_window) <set_contents>: Return bool. * tui/tui-source.c (tui_source_window::set_contents): Return bool. Simplify. * tui/tui-disasm.h (struct tui_disasm_window) <set_contents>: Return bool. * tui/tui-disasm.c (tui_disasm_window::set_contents): Return bool. Change-Id: I8c5212400cd7aadf35760c22d5344cd3b9435674
This commit is contained in:
@ -1,3 +1,18 @@
|
||||
2019-12-20 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* tui/tui-winsource.h (struct tui_source_window_base)
|
||||
<set_contents>: Return bool.
|
||||
* tui/tui-winsource.c
|
||||
(tui_source_window_base::update_source_window_as_is): Update.
|
||||
* tui/tui-source.h (struct tui_source_window) <set_contents>:
|
||||
Return bool.
|
||||
* tui/tui-source.c (tui_source_window::set_contents): Return
|
||||
bool. Simplify.
|
||||
* tui/tui-disasm.h (struct tui_disasm_window) <set_contents>:
|
||||
Return bool.
|
||||
* tui/tui-disasm.c (tui_disasm_window::set_contents): Return
|
||||
bool.
|
||||
|
||||
2019-12-20 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* tui/tui-winsource.c (tui_update_source_windows_with_addr)
|
||||
|
@ -198,7 +198,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
|
||||
}
|
||||
|
||||
/* Function to set the disassembly window's content. */
|
||||
enum tui_status
|
||||
bool
|
||||
tui_disasm_window::set_contents (struct gdbarch *arch,
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr)
|
||||
@ -214,7 +214,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
|
||||
gdb_assert (line_or_addr.loa == LOA_ADDRESS);
|
||||
CORE_ADDR pc = line_or_addr.u.addr;
|
||||
if (pc == 0)
|
||||
return TUI_FAILURE;
|
||||
return false;
|
||||
|
||||
gdbarch = arch;
|
||||
start_line_or_addr.loa = LOA_ADDRESS;
|
||||
@ -251,7 +251,7 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
|
||||
src->line_or_addr.u.addr = asm_lines[i].addr;
|
||||
src->is_exec_point = asm_lines[i].addr == cur_pc;
|
||||
}
|
||||
return TUI_SUCCESS;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,8 +55,7 @@ protected:
|
||||
|
||||
void do_scroll_vertical (int num_to_scroll) override;
|
||||
|
||||
enum tui_status set_contents
|
||||
(struct gdbarch *gdbarch,
|
||||
bool set_contents (struct gdbarch *gdbarch,
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr) override;
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "gdb_curses.h"
|
||||
|
||||
/* Function to display source in the source window. */
|
||||
enum tui_status
|
||||
bool
|
||||
tui_source_window::set_contents (struct gdbarch *arch,
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr)
|
||||
@ -48,13 +48,11 @@ tui_source_window::set_contents (struct gdbarch *arch,
|
||||
gdb_assert (line_or_addr.loa == LOA_LINE);
|
||||
int line_no = line_or_addr.u.line_no;
|
||||
|
||||
enum tui_status ret = TUI_FAILURE;
|
||||
if (s == NULL)
|
||||
return false;
|
||||
|
||||
if (s != NULL)
|
||||
{
|
||||
int line_width, nlines;
|
||||
|
||||
ret = TUI_SUCCESS;
|
||||
line_width = width - TUI_EXECINFO_SIZE - 1;
|
||||
/* Take hilite (window border) into account, when
|
||||
calculating the number of lines. */
|
||||
@ -65,9 +63,8 @@ tui_source_window::set_contents (struct gdbarch *arch,
|
||||
if (!g_source_cache.get_source_lines (s, line_no, line_no + nlines,
|
||||
&srclines)
|
||||
|| !g_source_cache.get_line_charpos (s, &offsets))
|
||||
ret = TUI_FAILURE;
|
||||
else
|
||||
{
|
||||
return false;
|
||||
|
||||
int cur_line_no, cur_line;
|
||||
struct tui_locator_window *locator
|
||||
= tui_locator_win_info_ptr ();
|
||||
@ -118,10 +115,8 @@ tui_source_window::set_contents (struct gdbarch *arch,
|
||||
cur_line++;
|
||||
cur_line_no++;
|
||||
}
|
||||
ret = TUI_SUCCESS;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,8 +60,7 @@ protected:
|
||||
|
||||
void do_scroll_vertical (int num_to_scroll) override;
|
||||
|
||||
enum tui_status set_contents
|
||||
(struct gdbarch *gdbarch,
|
||||
bool set_contents (struct gdbarch *gdbarch,
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr) override;
|
||||
|
||||
|
@ -183,10 +183,9 @@ tui_source_window_base::update_source_window_as_is
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr)
|
||||
{
|
||||
enum tui_status ret
|
||||
= set_contents (gdbarch, s, line_or_addr);
|
||||
bool ret = set_contents (gdbarch, s, line_or_addr);
|
||||
|
||||
if (ret == TUI_FAILURE)
|
||||
if (!ret)
|
||||
erase_source_content ();
|
||||
else
|
||||
{
|
||||
|
@ -87,8 +87,7 @@ protected:
|
||||
|
||||
void rerender () override;
|
||||
|
||||
virtual enum tui_status set_contents
|
||||
(struct gdbarch *gdbarch,
|
||||
virtual bool set_contents (struct gdbarch *gdbarch,
|
||||
struct symtab *s,
|
||||
struct tui_line_or_address line_or_addr) = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user