aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/tui')
-rw-r--r--gdb/tui/tui-command.h27
-rw-r--r--gdb/tui/tui-data.c10
-rw-r--r--gdb/tui/tui-data.h76
-rw-r--r--gdb/tui/tui-disasm.c31
-rw-r--r--gdb/tui/tui-disasm.h8
-rw-r--r--gdb/tui/tui-file.h4
-rw-r--r--gdb/tui/tui-hooks.c22
-rw-r--r--gdb/tui/tui-interp.c8
-rw-r--r--gdb/tui/tui-io.c51
-rw-r--r--gdb/tui/tui-layout.c171
-rw-r--r--gdb/tui/tui-layout.h35
-rw-r--r--gdb/tui/tui-location.c5
-rw-r--r--gdb/tui/tui-location.h20
-rw-r--r--gdb/tui/tui-out.h14
-rw-r--r--gdb/tui/tui-regs.c48
-rw-r--r--gdb/tui/tui-regs.h18
-rw-r--r--gdb/tui/tui-source.c17
-rw-r--r--gdb/tui/tui-source.h12
-rw-r--r--gdb/tui/tui-stack.c55
-rw-r--r--gdb/tui/tui-stack.h41
-rw-r--r--gdb/tui/tui-win.c397
-rw-r--r--gdb/tui/tui-wingeneral.c27
-rw-r--r--gdb/tui/tui-winsource.c62
-rw-r--r--gdb/tui/tui-winsource.h47
-rw-r--r--gdb/tui/tui.c74
-rw-r--r--gdb/tui/tui.h7
26 files changed, 533 insertions, 754 deletions
diff --git a/gdb/tui/tui-command.h b/gdb/tui/tui-command.h
index f684288..d6ef32c 100644
--- a/gdb/tui/tui-command.h
+++ b/gdb/tui/tui-command.h
@@ -31,24 +31,13 @@ struct tui_cmd_window : public tui_win_info
DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
- void refresh_window () override
- {
- }
+ void refresh_window () override {}
- const char *name () const override
- {
- return CMD_NAME;
- }
+ const char *name () const override { return CMD_NAME; }
- bool can_scroll () const override
- {
- return false;
- }
+ bool can_scroll () const override { return false; }
- bool can_box () const override
- {
- return false;
- }
+ bool can_box () const override { return false; }
void resize (int height, int width, int origin_x, int origin_y) override;
@@ -61,13 +50,9 @@ struct tui_cmd_window : public tui_win_info
protected:
- void do_scroll_vertical (int num_to_scroll) override
- {
- }
+ void do_scroll_vertical (int num_to_scroll) override {}
- void do_scroll_horizontal (int num_to_scroll) override
- {
- }
+ void do_scroll_horizontal (int num_to_scroll) override {}
};
/* Refresh the command window. */
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 0daed32..0d2a78b 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -43,7 +43,6 @@ tui_win_resized ()
return win_resized;
}
-
/* Set a whether the terminal window has been resized or not. */
void
tui_set_win_resized_to (bool resized)
@@ -51,7 +50,6 @@ tui_set_win_resized_to (bool resized)
win_resized = resized;
}
-
/* Answer the window with the logical focus. */
struct tui_win_info *
tui_win_with_focus (void)
@@ -59,7 +57,6 @@ tui_win_with_focus (void)
return win_with_focus;
}
-
/* Set the logical focus to win_info. */
void
tui_set_win_focus_to (struct tui_win_info *win_info)
@@ -72,7 +69,6 @@ tui_set_win_focus_to (struct tui_win_info *win_info)
}
}
-
/* Accessor for the term_height. */
int
tui_term_height (void)
@@ -80,7 +76,6 @@ tui_term_height (void)
return term_height;
}
-
/* Mutator for the term height. */
void
tui_set_term_height_to (int h)
@@ -88,7 +83,6 @@ tui_set_term_height_to (int h)
term_height = h;
}
-
/* Accessor for the term_width. */
int
tui_term_width (void)
@@ -96,7 +90,6 @@ tui_term_width (void)
return term_width;
}
-
/* Mutator for the term_width. */
void
tui_set_term_width_to (int w)
@@ -104,7 +97,6 @@ tui_set_term_width_to (int w)
term_width = w;
}
-
/* Answer the next window in the list, cycling back to the top if
necessary. */
struct tui_win_info *
@@ -128,7 +120,6 @@ tui_next_win (struct tui_win_info *cur_win)
return *iter;
}
-
/* Answer the prev window in the list, cycling back to the bottom if
necessary. */
struct tui_win_info *
@@ -152,7 +143,6 @@ tui_prev_win (struct tui_win_info *cur_win)
return *iter;
}
-
void
tui_win_info::rerender ()
{
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index c92e85c..5eb6d17 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -23,19 +23,16 @@
#define TUI_TUI_DATA_H
#include "tui/tui.h"
-#include "gdb_curses.h" /* For WINDOW. */
+#include "gdb_curses.h" /* For WINDOW. */
#include "observable.h"
/* A deleter that calls delwin. */
struct curses_deleter
{
- void operator() (WINDOW *win) const
- {
- delwin (win);
- }
+ void operator() (WINDOW *win) const { delwin (win); }
};
-#define MIN_WIN_HEIGHT 3
+#define MIN_WIN_HEIGHT 3
/* Generic window information. */
struct tui_win_info
@@ -52,6 +49,7 @@ protected:
virtual void make_window ();
public:
+
tui_win_info (tui_win_info &&) = default;
virtual ~tui_win_info () = default;
@@ -68,42 +66,26 @@ public:
virtual int max_height () const;
/* Compute the minimum height of this window. */
- virtual int min_height () const
- {
- return MIN_WIN_HEIGHT;
- }
+ virtual int min_height () const { return MIN_WIN_HEIGHT; }
/* Compute the maximum width of this window. */
int max_width () const;
/* Compute the minimum width of this window. */
- int min_width () const
- {
- return 3;
- }
+ int min_width () const { return 3; }
/* Return true if this window can be boxed. */
- virtual bool can_box () const
- {
- return true;
- }
+ virtual bool can_box () const { return true; }
/* Resize this window. The parameters are used to set the window's
size and position. */
- virtual void resize (int height, int width,
- int origin_x, int origin_y);
+ virtual void resize (int height, int width, int origin_x, int origin_y);
/* Return true if this window is visible. */
- bool is_visible () const
- {
- return handle != nullptr && tui_active;
- }
+ bool is_visible () const { return handle != nullptr && tui_active; }
/* Return true if this window can accept the focus. */
- virtual bool can_focus () const
- {
- return true;
- }
+ virtual bool can_focus () const { return true; }
/* Disable output until the next call to doupdate. */
void no_refresh ()
@@ -113,15 +95,10 @@ public:
}
/* Called after the tab width has been changed. */
- virtual void update_tab_width ()
- {
- }
+ virtual void update_tab_width () {}
/* Set whether this window is highlighted. */
- void set_highlight (bool highlight)
- {
- is_highlighted = highlight;
- }
+ void set_highlight (bool highlight) { is_highlighted = highlight; }
/* Methods to scroll the contents of this window. Note that they
are named with "_scroll" coming at the end because the more
@@ -132,17 +109,12 @@ public:
void right_scroll (int num_to_scroll);
/* Return true if this window can be scrolled, false otherwise. */
- virtual bool can_scroll () const
- {
- return true;
- }
+ virtual bool can_scroll () const { return true; }
/* Called for each mouse click inside this window. Coordinates MOUSE_X
and MOUSE_Y are 0-based relative to the window, and MOUSE_BUTTON can
be 1 (left), 2 (middle), or 3 (right). */
- virtual void click (int mouse_x, int mouse_y, int mouse_button)
- {
- }
+ virtual void click (int mouse_x, int mouse_y, int mouse_button) {}
void check_and_display_highlight_if_needed ();
@@ -174,20 +146,20 @@ protected:
};
/* Constant definitions. */
-#define SRC_NAME "src"
-#define CMD_NAME "cmd"
-#define DATA_NAME "regs"
-#define DISASSEM_NAME "asm"
-#define STATUS_NAME "status"
+#define SRC_NAME "src"
+#define CMD_NAME "cmd"
+#define DATA_NAME "regs"
+#define DISASSEM_NAME "asm"
+#define STATUS_NAME "status"
/* Global Data. */
extern struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
-#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
-#define TUI_DISASM_WIN ((tui_disasm_window *) tui_win_list[DISASSEM_WIN])
-#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
-#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
-#define TUI_STATUS_WIN ((tui_locator_window *) tui_win_list[STATUS_WIN])
+#define TUI_SRC_WIN ((tui_source_window *) tui_win_list[SRC_WIN])
+#define TUI_DISASM_WIN ((tui_disasm_window *) tui_win_list[DISASSEM_WIN])
+#define TUI_DATA_WIN ((tui_data_window *) tui_win_list[DATA_WIN])
+#define TUI_CMD_WIN ((tui_cmd_window *) tui_win_list[CMD_WIN])
+#define TUI_STATUS_WIN ((tui_locator_window *) tui_win_list[STATUS_WIN])
/* All the windows that are currently instantiated, in layout
order. */
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index f0b5576..6c23ae7 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -98,10 +98,8 @@ len_without_escapes (const std::string &str)
reason, for example, we hit invalid memory, then ASM_LINES can have
fewer entries than requested. */
static CORE_ADDR
-tui_disassemble (struct gdbarch *gdbarch,
- std::vector<tui_asm_line> &asm_lines,
- CORE_ADDR pc, int count,
- size_t *addr_size = nullptr)
+tui_disassemble (struct gdbarch *gdbarch, std::vector<tui_asm_line> &asm_lines,
+ CORE_ADDR pc, int count, size_t *addr_size = nullptr)
{
bool term_out = source_styling && gdb_stdout->can_emit_style_escape ();
string_file gdb_dis_out (term_out);
@@ -190,7 +188,7 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
CORE_ADDR new_low;
int max_lines;
- max_lines = (from > 0) ? from : - from;
+ max_lines = (from > 0) ? from : -from;
if (max_lines == 0)
return pc;
@@ -293,17 +291,18 @@ tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from)
CORE_ADDR old_next_addr = next_addr;
std::vector<tui_asm_line> single_asm_line;
- next_addr = tui_disassemble (gdbarch, single_asm_line,
- next_addr, 1);
+ next_addr
+ = tui_disassemble (gdbarch, single_asm_line, next_addr, 1);
/* If there are some problems while disassembling exit. */
if (next_addr <= old_next_addr)
return pc;
gdb_assert (single_asm_line.size () == 1);
asm_lines[pos] = single_asm_line[0];
- } while (next_addr <= pc);
+ }
+ while (next_addr <= pc);
pos++;
if (pos >= max_lines)
- pos = 0;
+ pos = 0;
new_low = asm_lines[pos].addr;
/* When scrolling backward the addresses should move backward, or at
@@ -357,10 +356,9 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
if (i < asm_lines.size ())
{
- line
- = (asm_lines[i].addr_string
- + n_spaces (insn_pos - asm_lines[i].addr_size)
- + asm_lines[i].insn);
+ line = (asm_lines[i].addr_string
+ + n_spaces (insn_pos - asm_lines[i].addr_size)
+ + asm_lines[i].insn);
addr = asm_lines[i].addr;
}
else
@@ -381,7 +379,6 @@ tui_disasm_window::set_contents (struct gdbarch *arch,
return true;
}
-
void
tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
@@ -407,7 +404,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
addr = main_symbol.value_address ();
}
}
- else /* The target is executing. */
+ else /* The target is executing. */
{
gdbarch = tui_location.gdbarch ();
addr = tui_location.addr ();
@@ -421,8 +418,8 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
disassembly window. This may or may not be the same as the low
address input. */
CORE_ADDR
-tui_get_low_disassembly_address (struct gdbarch *gdbarch,
- CORE_ADDR low, CORE_ADDR pc)
+tui_get_low_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR low,
+ CORE_ADDR pc)
{
int pos;
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index a2e321a..7fe20d4 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -34,10 +34,7 @@ struct tui_disasm_window : public tui_source_window_base
DISABLE_COPY_AND_ASSIGN (tui_disasm_window);
- const char *name () const override
- {
- return DISASSEM_NAME;
- }
+ const char *name () const override { return DISASSEM_NAME; }
bool location_matches_p (struct bp_location *loc, int line_no) override;
@@ -45,7 +42,7 @@ struct tui_disasm_window : public tui_source_window_base
void erase_source_content () override
{
- do_erase_source_content (_("[ No Assembly Available ]"));
+ do_erase_source_content (_ ("[ No Assembly Available ]"));
}
void display_start_addr (struct gdbarch **gdbarch_p,
@@ -59,6 +56,7 @@ protected:
const struct symtab_and_line &sal) override;
private:
+
/* Answer whether a particular line number or address is displayed
in the current source window. */
bool addr_is_displayed (CORE_ADDR addr) const;
diff --git a/gdb/tui/tui-file.h b/gdb/tui/tui-file.h
index 4a6d507..320ce3c 100644
--- a/gdb/tui/tui-file.h
+++ b/gdb/tui/tui-file.h
@@ -26,10 +26,12 @@
class tui_file : public stdio_file
{
public:
+
tui_file (FILE *stream, bool buffered)
: stdio_file (stream),
m_buffered (buffered)
- {}
+ {
+ }
void write (const char *buf, long length_buf) override;
void puts (const char *) override;
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index d67c3d7..f66f81d 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -50,7 +50,7 @@
#include "gdb_curses.h"
static void
-tui_new_objfile_hook (struct objfile* objfile)
+tui_new_objfile_hook (struct objfile *objfile)
{
if (tui_active)
tui_display_main ();
@@ -158,10 +158,8 @@ tui_refresh_frame_and_register_information ()
from print_frame_info. */
static void
-tui_dummy_print_frame_info_listing_hook (struct symtab *s,
- int line,
- int stopline,
- int noerror)
+tui_dummy_print_frame_info_listing_hook (struct symtab *s, int line,
+ int stopline, int noerror)
{
}
@@ -238,14 +236,11 @@ tui_attach_detach_observers (bool attach)
tui_event_delete_breakpoint, attach);
attach_or_detach (gdb::observers::breakpoint_modified,
tui_event_modify_breakpoint, attach);
- attach_or_detach (gdb::observers::inferior_exit,
- tui_inferior_exit, attach);
- attach_or_detach (gdb::observers::before_prompt,
- tui_before_prompt, attach);
- attach_or_detach (gdb::observers::normal_stop,
- tui_normal_stop, attach);
- attach_or_detach (gdb::observers::register_changed,
- tui_register_changed, attach);
+ attach_or_detach (gdb::observers::inferior_exit, tui_inferior_exit, attach);
+ attach_or_detach (gdb::observers::before_prompt, tui_before_prompt, attach);
+ attach_or_detach (gdb::observers::normal_stop, tui_normal_stop, attach);
+ attach_or_detach (gdb::observers::register_changed, tui_register_changed,
+ attach);
attach_or_detach (gdb::observers::user_selected_context_changed,
tui_context_changed, attach);
attach_or_detach (gdb::observers::current_source_symtab_and_line_changed,
@@ -278,6 +273,7 @@ tui_remove_hooks (void)
}
void _initialize_tui_hooks ();
+
void
_initialize_tui_hooks ()
{
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 812c62c..4feb216 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -42,9 +42,11 @@ static bool tui_start_enabled = false;
class tui_interp final : public cli_interp_base
{
public:
+
explicit tui_interp (const char *name)
: cli_interp_base (name)
- {}
+ {
+ }
void init (bool top_level) override;
void resume () override;
@@ -152,10 +154,9 @@ tui_interp::interp_ui_out ()
void
tui_interp::exec (const char *command_str)
{
- internal_error (_("tui_exec called"));
+ internal_error (_ ("tui_exec called"));
}
-
/* Factory for TUI interpreters. */
static struct interp *
@@ -165,6 +166,7 @@ tui_interp_factory (const char *name)
}
void _initialize_tui_interp ();
+
void
_initialize_tui_interp ()
{
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index a17cf38..8ba5f81 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -66,8 +66,7 @@ key_is_start_sequence (int ch)
/* Use definition from readline 4.3. */
#undef CTRL_CHAR
-#define CTRL_CHAR(c) \
- ((c) < control_character_threshold && (((c) & 0x80) == 0))
+#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) &0x80) == 0))
/* This file controls the IO interactions between gdb and curses.
When the TUI is enabled, gdb has two modes a curses and a standard
@@ -191,7 +190,7 @@ struct color_pair
int fg;
int bg;
- bool operator< (const color_pair &o) const
+ bool operator<(const color_pair &o) const
{
return fg < o.fg || (fg == o.fg && bg < o.bg);
}
@@ -205,16 +204,9 @@ static std::map<color_pair, int> color_pair_map;
/* This is indexed by ANSI color offset from the base color, and holds
the corresponding curses color constant. */
-static const int curses_colors[] = {
- COLOR_BLACK,
- COLOR_RED,
- COLOR_GREEN,
- COLOR_YELLOW,
- COLOR_BLUE,
- COLOR_MAGENTA,
- COLOR_CYAN,
- COLOR_WHITE
-};
+static const int curses_colors[]
+ = { COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_YELLOW,
+ COLOR_BLUE, COLOR_MAGENTA, COLOR_CYAN, COLOR_WHITE };
/* Given a color, find its index. */
@@ -238,7 +230,8 @@ get_color (const ui_file_style::color &color, int *result)
color.get_rgb (rgb);
/* We store RGB as 0..255, but curses wants 0..1000. */
if (init_color (next, rgb[0] * 1000 / 255, rgb[1] * 1000 / 255,
- rgb[2] * 1000 / 255) == ERR)
+ rgb[2] * 1000 / 255)
+ == ERR)
return false;
color_map[color] = next;
*result = next;
@@ -587,7 +580,7 @@ tui_redisplay_readline (void)
prompt = "";
else
prompt = rl_display_prompt;
-
+
c_pos = -1;
c_line = -1;
w = TUI_CMD_WIN->handle.get ();
@@ -602,7 +595,7 @@ tui_redisplay_readline (void)
for (in = 0; in <= rl_end; in++)
{
unsigned char c;
-
+
if (in == rl_point)
{
getyx (w, c_line, c_pos);
@@ -625,7 +618,8 @@ tui_redisplay_readline (void)
{
waddch (w, ' ');
col++;
- } while ((col % 8) != 0);
+ }
+ while ((col % 8) != 0);
}
else
{
@@ -645,7 +639,7 @@ tui_redisplay_readline (void)
TUI_CMD_WIN->start_line -= height - 1;
wrefresh (w);
- fflush(stdout);
+ fflush (stdout);
}
/* Readline callback to prepare the terminal. It is called once each
@@ -924,11 +918,11 @@ tui_initialize_io (void)
readline output in a pipe, read that pipe and output the content
in the curses command window. */
if (gdb_pipe_cloexec (tui_readline_pipe) != 0)
- error (_("Cannot create pipe for readline"));
+ error (_ ("Cannot create pipe for readline"));
tui_rl_outstream = fdopen (tui_readline_pipe[1], "w");
if (tui_rl_outstream == 0)
- error (_("Cannot redirect readline output"));
+ error (_ ("Cannot redirect readline output"));
setvbuf (tui_rl_outstream, NULL, _IOLBF, 0);
@@ -947,12 +941,11 @@ tui_initialize_io (void)
#ifdef __MINGW32__
/* MS-Windows port of ncurses doesn't support default foreground and
background colors, so we must record the default colors at startup. */
- HANDLE hstdout = (HANDLE)_get_osfhandle (fileno (stdout));
+ HANDLE hstdout = (HANDLE) _get_osfhandle (fileno (stdout));
DWORD cmode;
CONSOLE_SCREEN_BUFFER_INFO csbi;
- if (hstdout != INVALID_HANDLE_VALUE
- && GetConsoleMode (hstdout, &cmode) != 0
+ if (hstdout != INVALID_HANDLE_VALUE && GetConsoleMode (hstdout, &cmode) != 0
&& GetConsoleScreenBufferInfo (hstdout, &csbi))
ncurses_norm_attr = csbi.wAttributes;
#endif
@@ -970,16 +963,16 @@ tui_dispatch_mouse_event ()
return;
for (tui_win_info *wi : all_tui_windows ())
- if (mev.x > wi->x && mev.x < wi->x + wi->width - 1
- && mev.y > wi->y && mev.y < wi->y + wi->height - 1)
+ if (mev.x > wi->x && mev.x < wi->x + wi->width - 1 && mev.y > wi->y
+ && mev.y < wi->y + wi->height - 1)
{
if ((mev.bstate & BUTTON1_CLICKED) != 0
|| (mev.bstate & BUTTON2_CLICKED) != 0
|| (mev.bstate & BUTTON3_CLICKED) != 0)
{
- int button = (mev.bstate & BUTTON1_CLICKED) != 0 ? 1
- : ((mev.bstate & BUTTON2_CLICKED) != 0 ? 2
- : 3);
+ int button = (mev.bstate & BUTTON1_CLICKED) != 0
+ ? 1
+ : ((mev.bstate & BUTTON2_CLICKED) != 0 ? 2 : 3);
wi->click (mev.x - wi->x - 1, mev.y - wi->y - 1, button);
}
#ifdef BUTTON5_PRESSED
@@ -1172,7 +1165,7 @@ tui_getc_1 (FILE *fp)
case KEY_END:
return start_sequence ("\033[F");
- /* del and ins are unfortunately not hardcoded in readline for
+ /* del and ins are unfortunately not hardcoded in readline for
all systems. */
case KEY_DC: /* del */
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index ecdcd48..22ba2c6 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -238,7 +238,6 @@ tui_prev_layout_command (const char *arg, int from_tty)
tui_set_layout (layouts[index].get ());
}
-
/* See tui-layout.h. */
void
@@ -248,9 +247,8 @@ tui_regs_layout ()
if (TUI_DATA_WIN != nullptr)
return;
- tui_set_layout (TUI_DISASM_WIN != nullptr
- ? asm_regs_layout
- : src_regs_layout);
+ tui_set_layout (TUI_DISASM_WIN != nullptr ? asm_regs_layout
+ : src_regs_layout);
}
/* Implement the "layout regs" command. */
@@ -299,11 +297,9 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
}
void
-tui_win_info::resize (int height_, int width_,
- int origin_x_, int origin_y_)
+tui_win_info::resize (int height_, int width_, int origin_x_, int origin_y_)
{
- if (width == width_ && height == height_
- && x == origin_x_ && y == origin_y_
+ if (width == width_ && height == height_ && x == origin_x_ && y == origin_y_
&& handle != nullptr)
return;
@@ -329,8 +325,6 @@ tui_win_info::resize (int height_, int width_,
rerender ();
}
-
-
/* Helper function to create one of the built-in (non-locator)
windows. */
@@ -373,11 +367,11 @@ tui_get_window_by_name (const std::string &name)
auto iter = known_window_types->find (name);
if (iter == known_window_types->end ())
- error (_("Unknown window type \"%s\""), name.c_str ());
+ error (_ ("Unknown window type \"%s\""), name.c_str ());
tui_win_info *result = iter->second (name.c_str ());
if (result == nullptr)
- error (_("Could not create window \"%s\""), name.c_str ());
+ error (_ ("Could not create window \"%s\""), name.c_str ());
return result;
}
@@ -388,20 +382,16 @@ initialize_known_windows ()
{
known_window_types = new window_types_map;
- known_window_types->emplace (SRC_NAME,
- make_standard_window<SRC_WIN,
- tui_source_window>);
+ known_window_types->emplace (
+ SRC_NAME, make_standard_window<SRC_WIN, tui_source_window>);
known_window_types->emplace (CMD_NAME,
make_standard_window<CMD_WIN, tui_cmd_window>);
- known_window_types->emplace (DATA_NAME,
- make_standard_window<DATA_WIN,
- tui_data_window>);
- known_window_types->emplace (DISASSEM_NAME,
- make_standard_window<DISASSEM_WIN,
- tui_disasm_window>);
- known_window_types->emplace (STATUS_NAME,
- make_standard_window<STATUS_WIN,
- tui_locator_window>);
+ known_window_types->emplace (
+ DATA_NAME, make_standard_window<DATA_WIN, tui_data_window>);
+ known_window_types->emplace (
+ DISASSEM_NAME, make_standard_window<DISASSEM_WIN, tui_disasm_window>);
+ known_window_types->emplace (
+ STATUS_NAME, make_standard_window<STATUS_WIN, tui_locator_window>);
}
/* See tui-layout.h. */
@@ -413,22 +403,21 @@ tui_register_window (const char *name, window_factory &&factory)
if (name_copy == SRC_NAME || name_copy == CMD_NAME || name_copy == DATA_NAME
|| name_copy == DISASSEM_NAME || name_copy == STATUS_NAME)
- error (_("Window type \"%s\" is built-in"), name);
+ error (_ ("Window type \"%s\" is built-in"), name);
for (const char &c : name_copy)
{
if (ISSPACE (c))
- error (_("invalid whitespace character in window name"));
+ error (_ ("invalid whitespace character in window name"));
if (!ISALNUM (c) && strchr ("-_.", c) == nullptr)
- error (_("invalid character '%c' in window name"), c);
+ error (_ ("invalid character '%c' in window name"), c);
}
if (!ISALPHA (name_copy[0]))
- error (_("window name must start with a letter, not '%c'"), name_copy[0]);
+ error (_ ("window name must start with a letter, not '%c'"), name_copy[0]);
- known_window_types->emplace (std::move (name_copy),
- std::move (factory));
+ known_window_types->emplace (std::move (name_copy), std::move (factory));
}
/* See tui-layout.h. */
@@ -464,8 +453,8 @@ tui_layout_window::get_sizes (bool height, int *min_value, int *max_value)
if (m_window == nullptr)
m_window = tui_get_window_by_name (m_contents);
- tui_debug_printf ("window = %s, getting %s",
- m_window->name (), (height ? "height" : "width"));
+ tui_debug_printf ("window = %s, getting %s", m_window->name (),
+ (height ? "height" : "width"));
if (height)
{
@@ -540,7 +529,7 @@ void
tui_layout_split::add_split (std::unique_ptr<tui_layout_split> &&layout,
int weight)
{
- split s = {weight, std::move (layout)};
+ split s = { weight, std::move (layout) };
m_splits.push_back (std::move (s));
}
@@ -550,7 +539,7 @@ void
tui_layout_split::add_window (const char *name, int weight)
{
tui_layout_window *result = new tui_layout_window (name);
- split s = {weight, std::unique_ptr<tui_layout_base> (result)};
+ split s = { weight, std::unique_ptr<tui_layout_base> (result) };
m_splits.push_back (std::move (s));
}
@@ -563,7 +552,7 @@ tui_layout_split::clone () const
for (const split &item : m_splits)
{
std::unique_ptr<tui_layout_base> next = item.layout->clone ();
- split s = {item.weight, std::move (next)};
+ split s = { item.weight, std::move (next) };
result->m_splits.push_back (std::move (s));
}
return std::unique_ptr<tui_layout_base> (result);
@@ -642,7 +631,7 @@ tui_layout_split::tui_debug_weights_to_string () const
for (int i = 0; i < m_splits.size (); ++i)
{
if (i > 0)
- str += ", ";
+ str += ", ";
str += string_printf ("[%d] %d", i, m_splits[i].weight);
}
@@ -652,16 +641,16 @@ tui_layout_split::tui_debug_weights_to_string () const
/* See tui-layout.h. */
void
-tui_layout_split::tui_debug_print_size_info
- (const std::vector<tui_layout_split::size_info> &info)
+tui_layout_split::tui_debug_print_size_info (
+ const std::vector<tui_layout_split::size_info> &info)
{
gdb_assert (debug_tui);
tui_debug_printf ("current size info data:");
for (int i = 0; i < info.size (); ++i)
- tui_debug_printf (" [%d] { size = %d, min = %d, max = %d, share_box = %d }",
- i, info[i].size, info[i].min_size,
- info[i].max_size, info[i].share_box);
+ tui_debug_printf (
+ " [%d] { size = %d, min = %d, max = %d, share_box = %d }", i,
+ info[i].size, info[i].min_size, info[i].max_size, info[i].share_box);
}
/* See tui-layout.h. */
@@ -671,8 +660,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
{
TUI_SCOPED_DEBUG_ENTER_EXIT;
- tui_debug_printf ("this = %p, name = %s, new_size = %d",
- this, name, new_size);
+ tui_debug_printf ("this = %p, name = %s, new_size = %d", this, name,
+ new_size);
/* Look through the children. If one is a layout holding the named
window, we're done; or if one actually is the named window,
@@ -698,9 +687,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
if (found_index == -1)
return NOT_FOUND;
- int curr_size = (set_width_p
- ? m_splits[found_index].layout->width
- : m_splits[found_index].layout->height);
+ int curr_size = (set_width_p ? m_splits[found_index].layout->width
+ : m_splits[found_index].layout->height);
if (curr_size == new_size)
return HANDLED;
@@ -710,8 +698,8 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
int delta = m_splits[found_index].weight - new_size;
m_splits[found_index].weight = new_size;
- tui_debug_printf ("before delta (%d) distribution, weights: %s",
- delta, tui_debug_weights_to_string ().c_str ());
+ tui_debug_printf ("before delta (%d) distribution, weights: %s", delta,
+ tui_debug_weights_to_string ().c_str ());
/* Distribute the "delta" over all other windows, while respecting their
min/max sizes. We grow each window by 1 line at a time continually
@@ -755,19 +743,19 @@ tui_layout_split::set_size (const char *name, int new_size, bool set_width_p)
}
}
- tui_debug_printf ("index = %d, weight now: %d",
- index, m_splits[index].weight);
+ tui_debug_printf ("index = %d, weight now: %d", index,
+ m_splits[index].weight);
}
- tui_debug_printf ("after delta (%d) distribution, weights: %s",
- delta, tui_debug_weights_to_string ().c_str ());
+ tui_debug_printf ("after delta (%d) distribution, weights: %s", delta,
+ tui_debug_weights_to_string ().c_str ());
if (delta != 0)
{
if (set_width_p)
- warning (_("Invalid window width specified"));
+ warning (_ ("Invalid window width specified"));
else
- warning (_("Invalid window height specified"));
+ warning (_ ("Invalid window height specified"));
/* Effectively undo any modifications made here. */
set_weights_from_sizes ();
}
@@ -807,7 +795,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
: index (index_),
min_size (min_size_),
max_size (max_size_)
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
/* The index in m_splits where the cmd window was found. */
int index;
@@ -842,14 +831,13 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
m_splits[i].layout->get_sizes (m_vertical, &info[i].min_size,
&info[i].max_size);
- if (preserve_cmd_win_size_p
- && cmd_win_already_exists
+ if (preserve_cmd_win_size_p && cmd_win_already_exists
&& m_splits[i].layout->get_name () != nullptr
&& strcmp (m_splits[i].layout->get_name (), "cmd") == 0)
{
/* Save the old cmd window information, in case we need to
restore it later. */
- old_cmd_info.emplace (i, info[i].min_size, info[i].max_size);
+ old_cmd_info.emplace (i, info[i].min_size, info[i].max_size);
/* If this layout has never been applied, then it means the
user just changed the layout. In this situation, it's
@@ -857,9 +845,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
same. Setting the min and max sizes this way ensures
that the resizing step, below, does the right thing with
this window. */
- info[i].min_size = (m_vertical
- ? TUI_CMD_WIN->height
- : TUI_CMD_WIN->width);
+ info[i].min_size
+ = (m_vertical ? TUI_CMD_WIN->height : TUI_CMD_WIN->width);
info[i].max_size = info[i].min_size;
}
@@ -873,8 +860,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
/* Two adjacent boxed windows will share a border, making a bit
more size available. */
- if (i > 0
- && m_splits[i - 1].layout->last_edge_has_border_p ()
+ if (i > 0 && m_splits[i - 1].layout->last_edge_has_border_p ()
&& m_splits[i].layout->first_edge_has_border_p ())
info[i].share_box = true;
}
@@ -915,10 +901,10 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
if (debug_tui)
{
tui_debug_printf ("after initial size calculation");
- tui_debug_printf ("available_size = %d, used_size = %d",
- available_size, used_size);
- tui_debug_printf ("total_weight = %d, last_index = %d",
- total_weight, last_index);
+ tui_debug_printf ("available_size = %d, used_size = %d", available_size,
+ used_size);
+ tui_debug_printf ("total_weight = %d, last_index = %d", total_weight,
+ last_index);
tui_debug_print_size_info (info);
}
@@ -939,8 +925,7 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
the amount of available space. There's an escape hatch within
the loop in case we can't find any sub-layouts to resize. */
bool found_window_that_can_grow_p = true;
- for (int idx = last_index;
- available_size != used_size;
+ for (int idx = last_index; available_size != used_size;
idx = (idx + 1) % m_splits.size ())
{
/* Every time we get back to last_index, which is where the loop
@@ -975,10 +960,10 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
{
info[old_cmd_info->index].min_size = old_cmd_info->min_size;
info[old_cmd_info->index].max_size = old_cmd_info->max_size;
- tui_debug_printf
- ("restoring index %d (cmd) size limits, min = %d, max = %d",
- old_cmd_info->index, old_cmd_info->min_size,
- old_cmd_info->max_size);
+ tui_debug_printf (
+ "restoring index %d (cmd) size limits, min = %d, max = %d",
+ old_cmd_info->index, old_cmd_info->min_size,
+ old_cmd_info->max_size);
old_cmd_info.reset ();
}
else if (!found_window_that_can_grow_p)
@@ -1007,8 +992,8 @@ tui_layout_split::apply (int x_, int y_, int width_, int height_,
tui_debug_printf ("after final size calculation");
tui_debug_printf ("available_size = %d, used_size = %d",
available_size, used_size);
- tui_debug_printf ("total_weight = %d, last_index = %d",
- total_weight, last_index);
+ tui_debug_printf ("total_weight = %d, last_index = %d", total_weight,
+ last_index);
tui_debug_print_size_info (info);
}
}
@@ -1140,7 +1125,7 @@ add_layout_command (const char *name, tui_layout_split *layout)
layout->specification (&spec, 0);
gdb::unique_xmalloc_ptr<char> doc
- = xstrprintf (_("Apply the \"%s\" layout.\n\
+ = xstrprintf (_ ("Apply the \"%s\" layout.\n\
This layout was created using:\n\
tui new-layout %s %s"),
name, name, spec.c_str ());
@@ -1200,8 +1185,6 @@ initialize_layouts ()
asm_regs_layout = layout;
}
-
-
/* A helper function that returns true if NAME is the name of an
available window. */
@@ -1219,9 +1202,9 @@ tui_new_layout_command (const char *spec, int from_tty)
{
std::string new_name = extract_arg (&spec);
if (new_name.empty ())
- error (_("No layout name specified"));
+ error (_ ("No layout name specified"));
if (new_name[0] == '-')
- error (_("Layout name cannot start with '-'"));
+ error (_ ("Layout name cannot start with '-'"));
bool is_vertical = true;
spec = skip_spaces (spec);
@@ -1254,7 +1237,7 @@ tui_new_layout_command (const char *spec, int from_tty)
is_close = true;
++spec;
if (splits.size () == 1)
- error (_("Extra '}' in layout specification"));
+ error (_ ("Extra '}' in layout specification"));
}
else
{
@@ -1262,14 +1245,14 @@ tui_new_layout_command (const char *spec, int from_tty)
if (name.empty ())
break;
if (!validate_window_name (name))
- error (_("Unknown window \"%s\""), name.c_str ());
+ error (_ ("Unknown window \"%s\""), name.c_str ());
if (seen_windows.find (name) != seen_windows.end ())
- error (_("Window \"%s\" seen twice in layout"), name.c_str ());
+ error (_ ("Window \"%s\" seen twice in layout"), name.c_str ());
}
ULONGEST weight = get_ulongest (&spec, '}');
if ((int) weight != weight)
- error (_("Weight out of range: %s"), pulongest (weight));
+ error (_ ("Weight out of range: %s"), pulongest (weight));
if (is_close)
{
std::unique_ptr<tui_layout_split> last_split
@@ -1284,11 +1267,11 @@ tui_new_layout_command (const char *spec, int from_tty)
}
}
if (splits.size () > 1)
- error (_("Missing '}' in layout specification"));
+ error (_ ("Missing '}' in layout specification"));
if (seen_windows.empty ())
- error (_("New layout does not contain any windows"));
+ error (_ ("New layout does not contain any windows"));
if (seen_windows.find (CMD_NAME) == seen_windows.end ())
- error (_("New layout does not contain the \"" CMD_NAME "\" window"));
+ error (_ ("New layout does not contain the \"" CMD_NAME "\" window"));
gdb::unique_xmalloc_ptr<char> cmd_name
= make_unique_xstrdup (new_name.c_str ());
@@ -1304,28 +1287,26 @@ tui_new_layout_command (const char *spec, int from_tty)
manipulation. */
void _initialize_tui_layout ();
+
void
_initialize_tui_layout ()
{
struct cmd_list_element *layout_cmd
- = add_prefix_cmd ("layout", class_tui, tui_layout_command, _("\
+ = add_prefix_cmd ("layout", class_tui, tui_layout_command, _ ("\
Change the layout of windows.\n\
Usage: tui layout prev | next | LAYOUT-NAME"),
&layout_list, 0, tui_get_cmd_list ());
add_com_alias ("layout", layout_cmd, class_tui, 0);
add_cmd ("next", class_tui, tui_next_layout_command,
- _("Apply the next TUI layout."),
- &layout_list);
+ _ ("Apply the next TUI layout."), &layout_list);
add_cmd ("prev", class_tui, tui_prev_layout_command,
- _("Apply the previous TUI layout."),
- &layout_list);
+ _ ("Apply the previous TUI layout."), &layout_list);
add_cmd ("regs", class_tui, tui_regs_layout_command,
- _("Apply the TUI register layout."),
- &layout_list);
+ _ ("Apply the TUI register layout."), &layout_list);
add_cmd ("new-layout", class_tui, tui_new_layout_command,
- _("Create a new TUI layout.\n\
+ _ ("Create a new TUI layout.\n\
Usage: tui new-layout [-horizontal] NAME WINDOW WEIGHT [WINDOW WEIGHT]...\n\
Create a new TUI layout. The new layout will be named NAME,\n\
and can be accessed using \"layout NAME\".\n\
diff --git a/gdb/tui/tui-layout.h b/gdb/tui/tui-layout.h
index ff354fb..983ef3c 100644
--- a/gdb/tui/tui-layout.h
+++ b/gdb/tui/tui-layout.h
@@ -63,7 +63,8 @@ public:
is preserved, otherwise, the TUI_CMD_WIN will resize just like any
other window. */
virtual void apply (int x, int y, int width, int height,
- bool preserve_cmd_win_size_p) = 0;
+ bool preserve_cmd_win_size_p)
+ = 0;
/* Return the minimum and maximum height or width of this layout.
HEIGHT is true to fetch height, false to fetch width. */
@@ -79,10 +80,7 @@ public:
/* Return the name of this layout's window, or nullptr if this
layout does not represent a single window. */
- virtual const char *get_name () const
- {
- return nullptr;
- }
+ virtual const char *get_name () const { return nullptr; }
/* Set the height of the window named NAME to NEW_HEIGHT, updating
the sizes of the other windows around it. */
@@ -156,10 +154,7 @@ public:
void apply (int x, int y, int width, int height,
bool preserve_cmd_win_size_p) override;
- const char *get_name () const override
- {
- return m_contents.c_str ();
- }
+ const char *get_name () const override { return m_contents.c_str (); }
tui_adjust_result set_height (const char *name, int new_height) override
{
@@ -175,9 +170,7 @@ public:
bool last_edge_has_border_p () const override;
- void remove_windows (const char *name) override
- {
- }
+ void remove_windows (const char *name) override {}
void replace_window (const char *name, const char *new_window) override;
@@ -354,12 +347,11 @@ extern void tui_adjust_window_height (struct tui_win_info *win,
int new_height);
/* Adjust the window width of WIN to NEW_WIDTH. */
-extern void tui_adjust_window_width (struct tui_win_info *win,
- int new_width);
+extern void tui_adjust_window_width (struct tui_win_info *win, int new_width);
/* The type of a function that is used to create a TUI window. */
-typedef std::function<tui_win_info * (const char *name)> window_factory;
+typedef std::function<tui_win_info *(const char *name)> window_factory;
/* The type for a data structure that maps a window name to that window's
factory function. */
@@ -382,7 +374,8 @@ struct known_window_names_iterator
known_window_names_iterator (known_window_types_iterator &&iter)
: m_iter (std::move (iter))
- { /* Nothing. */ }
+ { /* Nothing. */
+ }
known_window_names_iterator &operator++ ()
{
@@ -390,11 +383,12 @@ struct known_window_names_iterator
return *this;
}
- const std::string &operator* () const
- { return (*m_iter).first; }
+ const std::string &operator* () const { return (*m_iter).first; }
bool operator!= (const known_window_names_iterator &other) const
- { return m_iter != other.m_iter; }
+ {
+ return m_iter != other.m_iter;
+ }
private:
@@ -405,8 +399,7 @@ private:
/* A range adapter that makes it possible to iterate over the names of all
known tui windows. */
-using known_window_names_range
- = iterator_range<known_window_names_iterator>;
+using known_window_names_range = iterator_range<known_window_names_iterator>;
/* Return a range that can be used to walk over the name of all known tui
windows in a range-for loop. */
diff --git a/gdb/tui/tui-location.c b/gdb/tui/tui-location.c
index 9d6d29b..8ab06e1 100644
--- a/gdb/tui/tui-location.c
+++ b/gdb/tui/tui-location.c
@@ -71,9 +71,8 @@ tui_location_tracker::set_location (struct symtab *symtab)
bool
tui_location_tracker::set_fullname (struct symtab *symtab)
{
- const char *fullname = (symtab == nullptr
- ? "??"
- : symtab_to_fullname (symtab));
+ const char *fullname
+ = (symtab == nullptr ? "??" : symtab_to_fullname (symtab));
bool location_changed_p = fullname != m_full_name;
m_full_name = std::string (fullname);
diff --git a/gdb/tui/tui-location.h b/gdb/tui/tui-location.h
index 8e1d5da..e77eb09 100644
--- a/gdb/tui/tui-location.h
+++ b/gdb/tui/tui-location.h
@@ -20,7 +20,7 @@
#include "tui/tui.h"
#include "tui/tui.h"
-#include "gdb_curses.h" /* For WINDOW. */
+#include "gdb_curses.h" /* For WINDOW. */
#include "observable.h"
/* Class used to track the current location that the TUI is displaying. An
@@ -36,32 +36,26 @@ struct tui_location_tracker
if any of the locator's fields were actually changed, and false
otherwise. */
bool set_location (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal,
- const char *procname);
+ const struct symtab_and_line &sal, const char *procname);
/* Update the current location with the with the provided argument.
Return true if any of the fields actually changed, otherwise false. */
bool set_location (struct symtab *symtab);
/* Return the address of the current location. */
- CORE_ADDR addr () const
- { return m_addr; }
+ CORE_ADDR addr () const { return m_addr; }
/* Return the architecture for the current location. */
- struct gdbarch *gdbarch () const
- { return m_gdbarch; }
+ struct gdbarch *gdbarch () const { return m_gdbarch; }
/* Return the full name of the file containing the current location. */
- const std::string &full_name () const
- { return m_full_name; }
+ const std::string &full_name () const { return m_full_name; }
/* Return the name of the function containing the current location. */
- const std::string &proc_name () const
- { return m_proc_name; }
+ const std::string &proc_name () const { return m_proc_name; }
/* Return the line number for the current location. */
- int line_no () const
- { return m_line_no; }
+ int line_no () const { return m_line_no; }
private:
diff --git a/gdb/tui/tui-out.h b/gdb/tui/tui-out.h
index ec7e02b..4b582fe 100644
--- a/gdb/tui/tui-out.h
+++ b/gdb/tui/tui-out.h
@@ -32,14 +32,14 @@ public:
protected:
- void do_field_signed (int fldno, int width, ui_align align, const char *fldname,
- LONGEST value) override;
- void do_field_string (int fldno, int width, ui_align align, const char *fldname,
- const char *string, const ui_file_style &style) override;
+ void do_field_signed (int fldno, int width, ui_align align,
+ const char *fldname, LONGEST value) override;
+ void do_field_string (int fldno, int width, ui_align align,
+ const char *fldname, const char *string,
+ const ui_file_style &style) override;
void do_field_fmt (int fldno, int width, ui_align align, const char *fldname,
- const ui_file_style &style,
- const char *format, va_list args) override
- ATTRIBUTE_PRINTF (7, 0);
+ const ui_file_style &style, const char *format,
+ va_list args) override ATTRIBUTE_PRINTF (7, 0);
void do_text (const char *string) override;
private:
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 3e794ae..542c4e0 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -94,8 +94,7 @@ tui_register_format (frame_info_ptr frame, int regnum)
scoped_restore save_pagination
= make_scoped_restore (&pagination_enabled, false);
- scoped_restore save_stdout
- = make_scoped_restore (&gdb_stdout, &stream);
+ scoped_restore save_stdout = make_scoped_restore (&gdb_stdout, &stream);
gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
@@ -111,8 +110,7 @@ tui_register_format (frame_info_ptr frame, int regnum)
display. When changep is set, check if the new register value has
changed with respect to the previous call. */
static void
-tui_get_register (frame_info_ptr frame,
- struct tui_data_item_window *data,
+tui_get_register (frame_info_ptr frame, struct tui_data_item_window *data,
int regnum, bool *changedp)
{
if (changedp)
@@ -201,14 +199,13 @@ tui_data_window::show_registers (const reggroup *group)
rerender ();
}
-
/* Set the data window to display the registers of the register group
using the given frame. Values are refreshed only when
refresh_values_only is true. */
void
tui_data_window::show_register_group (const reggroup *group,
- frame_info_ptr frame,
+ frame_info_ptr frame,
bool refresh_values_only)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -297,8 +294,7 @@ tui_data_window::display_registers_from (int start_element_no)
int cur_y = 1;
while (i < m_regs_content.size () && cur_y <= height - 2)
{
- for (int j = 0;
- j < m_regs_column_count && i < m_regs_content.size ();
+ for (int j = 0; j < m_regs_column_count && i < m_regs_content.size ();
j++)
{
/* Create the window if necessary. */
@@ -306,9 +302,9 @@ tui_data_window::display_registers_from (int start_element_no)
m_regs_content[i].y = cur_y;
m_regs_content[i].visible = true;
m_regs_content[i].rerender (handle.get (), m_item_width);
- i++; /* Next register. */
+ i++; /* Next register. */
}
- cur_y++; /* Next row. */
+ cur_y++; /* Next row. */
}
/* Mark register windows below the visible area. */
@@ -374,7 +370,6 @@ tui_data_window::display_registers_from_line (int line_no)
return line_no;
}
-
/* Answer the index first element displayed. If none are displayed,
then return (-1). */
int
@@ -398,7 +393,6 @@ tui_data_window::delete_data_content_windows ()
win.visible = false;
}
-
void
tui_data_window::erase_data_content (const char *prompt)
{
@@ -424,7 +418,7 @@ void
tui_data_window::rerender ()
{
if (m_regs_content.empty ())
- erase_data_content (_("[ Register Values Unavailable ]"));
+ erase_data_content (_ ("[ Register Values Unavailable ]"));
else
{
erase_data_content (NULL);
@@ -433,7 +427,6 @@ tui_data_window::rerender ()
}
}
-
/* Scroll the data window vertically forward or backward. */
void
tui_data_window::do_scroll_vertical (int num_to_scroll)
@@ -474,8 +467,7 @@ tui_data_window::check_register_values (frame_info_ptr frame)
was_hilighted = data_item_win.highlight;
- tui_get_register (frame, &data_item_win,
- data_item_win.regno,
+ tui_get_register (frame, &data_item_win, data_item_win.regno,
&data_item_win.highlight);
/* Register windows whose y == 0 are outside the visible area. */
@@ -500,7 +492,7 @@ tui_data_item_window::rerender (WINDOW *handle, int field_width)
to code that causes the compiler to generate an unused-value
warning. */
(void) wstandout (handle);
-
+
mvwaddnstr (handle, y, x, content.c_str (), field_width - 1);
if (content.size () < field_width)
waddstr (handle, n_spaces (field_width - content.size ()));
@@ -598,22 +590,22 @@ tui_reg_command (const char *args, int from_tty)
if (strncmp (group->name (), args, len) == 0)
{
if (match != NULL)
- error (_("ambiguous register group name '%s'"), args);
+ error (_ ("ambiguous register group name '%s'"), args);
match = group;
}
}
}
if (match == NULL)
- error (_("unknown register group '%s'"), args);
+ error (_ ("unknown register group '%s'"), args);
TUI_DATA_WIN->show_registers (match);
}
else
{
- gdb_printf (_("\"tui reg\" must be followed by the name of "
- "either a register group,\nor one of 'next' "
- "or 'prev'. Known register groups are:\n"));
+ gdb_printf (_ ("\"tui reg\" must be followed by the name of "
+ "either a register group,\nor one of 'next' "
+ "or 'prev'. Known register groups are:\n"));
bool first = true;
for (const struct reggroup *group : gdbarch_reggroups (gdbarch))
@@ -633,10 +625,10 @@ tui_reg_command (const char *args, int from_tty)
static void
tui_reggroup_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
- static const char * const extra[] = { "next", "prev", NULL };
+ static const char *const extra[] = { "next", "prev", NULL };
reggroup_completer (ignore, tracker, text, word);
@@ -644,6 +636,7 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
}
void _initialize_tui_regs ();
+
void
_initialize_tui_regs ()
{
@@ -651,9 +644,10 @@ _initialize_tui_regs ()
tuicmd = tui_get_cmd_list ();
- cmd = add_cmd ("reg", class_tui, tui_reg_command, _("\
+ cmd = add_cmd ("reg", class_tui, tui_reg_command, _ ("\
TUI command to control the register window.\n\
Usage: tui reg NAME\n\
-NAME is the name of the register group to display"), tuicmd);
+NAME is the name of the register group to display"),
+ tuicmd);
set_cmd_completer (cmd, tui_reggroup_completer);
}
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index 5adff63..34afa84 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -54,26 +54,19 @@ struct tui_data_window : public tui_win_info
DISABLE_COPY_AND_ASSIGN (tui_data_window);
- const char *name () const override
- {
- return DATA_NAME;
- }
+ const char *name () const override { return DATA_NAME; }
void check_register_values (frame_info_ptr frame);
void show_registers (const reggroup *group);
- const reggroup *get_current_group () const
- {
- return m_current_group;
- }
+ const reggroup *get_current_group () const { return m_current_group; }
protected:
void do_scroll_vertical (int num_to_scroll) override;
- void do_scroll_horizontal (int num_to_scroll) override
- {
- }
+
+ void do_scroll_horizontal (int num_to_scroll) override {}
void rerender () override;
@@ -100,8 +93,7 @@ private:
display off the end of the register display. */
void display_reg_element_at_line (int start_element_no, int start_line_no);
- void show_register_group (const reggroup *group,
- frame_info_ptr frame,
+ void show_register_group (const reggroup *group, frame_info_ptr frame,
bool refresh_values_only);
/* Answer the number of the last line in the regs display. If there
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 73d44417..2833b5e 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -104,7 +104,8 @@ tui_source_window::set_contents (struct gdbarch *arch,
element->line_or_addr.u.line_no = cur_line_no;
element->is_exec_point
= (filename_cmp (tui_location.full_name ().c_str (),
- symtab_to_fullname (s)) == 0
+ symtab_to_fullname (s))
+ == 0
&& cur_line_no == tui_location.line_no ());
m_content[cur_line].line = std::move (text);
@@ -116,18 +117,16 @@ tui_source_window::set_contents (struct gdbarch *arch,
return true;
}
-
/* Answer whether the source is currently displayed in the source
window. */
bool
tui_source_window::showing_source_p (const char *fullname) const
{
return (!m_content.empty ()
- && (filename_cmp (tui_location.full_name ().c_str (),
- fullname) == 0));
+ && (filename_cmp (tui_location.full_name ().c_str (), fullname)
+ == 0));
}
-
/* Scroll the source forward or backward vertically. */
void
tui_source_window::do_scroll_vertical (int num_to_scroll)
@@ -168,8 +167,8 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no)
return (m_content[line_no].line_or_addr.loa == LOA_LINE
&& m_content[line_no].line_or_addr.u.line_no == loc->line_number
&& loc->symtab != NULL
- && filename_cmp (m_fullname.get (),
- symtab_to_fullname (loc->symtab)) == 0);
+ && filename_cmp (m_fullname.get (), symtab_to_fullname (loc->symtab))
+ == 0);
}
/* See tui-source.h. */
@@ -197,8 +196,8 @@ tui_source_window::maybe_update (frame_info_ptr fi, symtab_and_line sal)
if (start_line <= 0)
start_line = 1;
- bool source_already_displayed = (sal.symtab != 0
- && showing_source_p (m_fullname.get ()));
+ bool source_already_displayed
+ = (sal.symtab != 0 && showing_source_p (m_fullname.get ()));
if (!(source_already_displayed && line_is_displayed (sal.line)))
{
diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h
index 413cfa3..dcbad43 100644
--- a/gdb/tui/tui-source.h
+++ b/gdb/tui/tui-source.h
@@ -35,10 +35,7 @@ struct tui_source_window : public tui_source_window_base
DISABLE_COPY_AND_ASSIGN (tui_source_window);
- const char *name () const override
- {
- return SRC_NAME;
- }
+ const char *name () const override { return SRC_NAME; }
/* Return true if the location LOC corresponds to the line number
LINE_NO in this source window; false otherwise. */
@@ -50,7 +47,7 @@ struct tui_source_window : public tui_source_window_base
void erase_source_content () override
{
- do_erase_source_content (_("[ No Source Available ]"));
+ do_erase_source_content (_ ("[ No Source Available ]"));
}
void display_start_addr (struct gdbarch **gdbarch_p,
@@ -63,10 +60,7 @@ protected:
bool set_contents (struct gdbarch *gdbarch,
const struct symtab_and_line &sal) override;
- int extra_margin () const override
- {
- return m_digits;
- }
+ int extra_margin () const override { return m_digits; }
void show_line_number (int lineno) const override;
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 0a75018..bba7776 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -40,22 +40,21 @@
#include "gdb_curses.h"
-#define PROC_PREFIX "In: "
-#define LINE_PREFIX "L"
-#define PC_PREFIX "PC: "
+#define PROC_PREFIX "In: "
+#define LINE_PREFIX "L"
+#define PC_PREFIX "PC: "
/* Strings to display in the TUI status line. */
-#define SINGLE_KEY "(SingleKey)"
+#define SINGLE_KEY "(SingleKey)"
/* Minimum/Maximum length of some fields displayed in the TUI status
line. */
-#define MIN_LINE_WIDTH 4 /* Use at least 4 digits for line
+#define MIN_LINE_WIDTH \
+ 4 /* Use at least 4 digits for line
numbers. */
-#define MIN_PROC_WIDTH 12
-#define MAX_TARGET_WIDTH 10
-#define MAX_PID_WIDTH 19
-
-
+#define MIN_PROC_WIDTH 12
+#define MAX_TARGET_WIDTH 10
+#define MAX_PID_WIDTH 19
std::string
tui_locator_window::make_status_line () const
@@ -100,24 +99,20 @@ tui_locator_window::make_status_line () const
/* Translate PC address. */
struct gdbarch *gdbarch = tui_location.gdbarch ();
CORE_ADDR addr = tui_location.addr ();
- std::string pc_out (gdbarch
- ? paddress (gdbarch, addr)
- : "??");
+ std::string pc_out (gdbarch ? paddress (gdbarch, addr) : "??");
const char *pc_buf = pc_out.c_str ();
int pc_width = pc_out.size ();
/* First determine the amount of proc name width we have available.
The +1 are for a space separator between fields.
The -1 are to take into account the \0 counted by sizeof. */
- proc_width = (status_size
- - (target_width + 1)
- - (pid_width + 1)
+ proc_width = (status_size - (target_width + 1) - (pid_width + 1)
- (sizeof (PROC_PREFIX) - 1 + 1)
- (sizeof (LINE_PREFIX) - 1 + line_width + 1)
- (sizeof (PC_PREFIX) - 1 + pc_width + 1)
- (tui_current_key_mode == TUI_SINGLE_KEY_MODE
- ? (sizeof (SINGLE_KEY) - 1 + 1)
- : 0));
+ ? (sizeof (SINGLE_KEY) - 1 + 1)
+ : 0));
/* If there is no room to print the function name, try by removing
some fields. */
@@ -165,16 +160,15 @@ tui_locator_window::make_status_line () const
{
const std::string &proc_name = tui_location.proc_name ();
if (proc_name.size () > proc_width)
- string.printf ("%s%*.*s* ", PROC_PREFIX,
- 1 - proc_width, proc_width - 1, proc_name.c_str ());
+ string.printf ("%s%*.*s* ", PROC_PREFIX, 1 - proc_width,
+ proc_width - 1, proc_name.c_str ());
else
- string.printf ("%s%*.*s ", PROC_PREFIX,
- -proc_width, proc_width, proc_name.c_str ());
+ string.printf ("%s%*.*s ", PROC_PREFIX, -proc_width, proc_width,
+ proc_name.c_str ());
}
if (line_width > 0)
- string.printf ("%s%*.*s ", LINE_PREFIX,
- -line_width, line_width, line_buf);
+ string.printf ("%s%*.*s ", LINE_PREFIX, -line_width, line_width, line_buf);
if (pc_width > 0)
{
string.puts (PC_PREFIX);
@@ -194,14 +188,14 @@ tui_locator_window::make_status_line () const
/* Get a printable name for the function at the address. The symbol
name is demangled if demangling is turned on. Returns a pointer to
a static area holding the result. */
-static char*
+static char *
tui_get_function_from_frame (frame_info_ptr fi)
{
static char name[256];
string_file stream;
- print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi),
- &stream, demangle, "");
+ print_address_symbolic (get_frame_arch (fi), get_frame_pc (fi), &stream,
+ demangle, "");
/* Use simple heuristics to isolate the function name. The symbol
can be demangled and we can have function parameters. Remove
@@ -265,7 +259,7 @@ tui_show_frame_info (frame_info_ptr fi)
if (get_frame_pc_if_available (fi, &sal.pc))
func_name = tui_get_function_from_frame (fi);
else
- func_name = _("<unavailable>");
+ func_name = _ ("<unavailable>");
locator_changed_p
= tui_location.set_location (get_frame_arch (fi), sal, func_name);
@@ -316,11 +310,12 @@ tui_update_command (const char *arg, int from_tty)
manipulation. */
void _initialize_tui_stack ();
+
void
_initialize_tui_stack ()
{
add_com ("update", class_tui, tui_update_command,
- _("Update the source window and locator to "
- "display the current execution point.\n\
+ _ ("Update the source window and locator to "
+ "display the current execution point.\n\
Usage: update"));
}
diff --git a/gdb/tui/tui-stack.h b/gdb/tui/tui-stack.h
index d542f21..c22fdfd 100644
--- a/gdb/tui/tui-stack.h
+++ b/gdb/tui/tui-stack.h
@@ -32,42 +32,23 @@ struct tui_locator_window : public tui_win_info
{
tui_locator_window () = default;
- const char *name () const override
- {
- return STATUS_NAME;
- }
-
- int max_height () const override
- {
- return 1;
- }
-
- int min_height () const override
- {
- return 1;
- }
-
- bool can_box () const override
- {
- return false;
- }
-
- bool can_focus () const override
- {
- return false;
- }
+ const char *name () const override { return STATUS_NAME; }
+
+ int max_height () const override { return 1; }
+
+ int min_height () const override { return 1; }
+
+ bool can_box () const override { return false; }
+
+ bool can_focus () const override { return false; }
void rerender () override;
protected:
- void do_scroll_vertical (int n) override
- {
- }
+ void do_scroll_vertical (int n) override {}
- void do_scroll_horizontal (int n) override
- {
- }
+ void do_scroll_horizontal (int n) override {}
private:
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 008189e..846b617 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -64,49 +64,35 @@ static void tui_scroll_forward_command (const char *, int);
static void tui_scroll_backward_command (const char *, int);
static void tui_scroll_left_command (const char *, int);
static void tui_scroll_right_command (const char *, int);
-static void parse_scrolling_args (const char *,
- struct tui_win_info **,
- int *);
-
+static void parse_scrolling_args (const char *, struct tui_win_info **, int *);
#ifndef ACS_LRCORNER
-# define ACS_LRCORNER '+'
+#define ACS_LRCORNER '+'
#endif
#ifndef ACS_LLCORNER
-# define ACS_LLCORNER '+'
+#define ACS_LLCORNER '+'
#endif
#ifndef ACS_ULCORNER
-# define ACS_ULCORNER '+'
+#define ACS_ULCORNER '+'
#endif
#ifndef ACS_URCORNER
-# define ACS_URCORNER '+'
+#define ACS_URCORNER '+'
#endif
#ifndef ACS_HLINE
-# define ACS_HLINE '-'
+#define ACS_HLINE '-'
#endif
#ifndef ACS_VLINE
-# define ACS_VLINE '|'
+#define ACS_VLINE '|'
#endif
/* Possible values for tui-border-kind variable. */
-static const char *const tui_border_kind_enums[] = {
- "space",
- "ascii",
- "acs",
- NULL
-};
+static const char *const tui_border_kind_enums[]
+ = { "space", "ascii", "acs", NULL };
/* Possible values for tui-border-mode and tui-active-border-mode. */
-static const char *const tui_border_mode_enums[] = {
- "normal",
- "standout",
- "reverse",
- "half",
- "half-standout",
- "bold",
- "bold-standout",
- NULL
-};
+static const char *const tui_border_mode_enums[]
+ = { "normal", "standout", "reverse", "half",
+ "half-standout", "bold", "bold-standout", NULL };
struct tui_translate
{
@@ -117,104 +103,93 @@ struct tui_translate
/* Translation table for border-mode variables.
The list of values must be terminated by a NULL.
After the NULL value, an entry defines the default. */
-static struct tui_translate tui_border_mode_translate[] = {
- { "normal", A_NORMAL },
- { "standout", A_STANDOUT },
- { "reverse", A_REVERSE },
- { "half", A_DIM },
- { "half-standout", A_DIM | A_STANDOUT },
- { "bold", A_BOLD },
- { "bold-standout", A_BOLD | A_STANDOUT },
- { 0, 0 },
- { "normal", A_NORMAL }
-};
+static struct tui_translate tui_border_mode_translate[]
+ = { { "normal", A_NORMAL },
+ { "standout", A_STANDOUT },
+ { "reverse", A_REVERSE },
+ { "half", A_DIM },
+ { "half-standout", A_DIM | A_STANDOUT },
+ { "bold", A_BOLD },
+ { "bold-standout", A_BOLD | A_STANDOUT },
+ { 0, 0 },
+ { "normal", A_NORMAL } };
/* Translation tables for border-kind, one for each border
character (see wborder, border curses operations).
-1 is used to indicate the ACS because ACS characters
are determined at run time by curses (depends on terminal). */
-static struct tui_translate tui_border_kind_translate_vline[] = {
- { "space", ' ' },
- { "ascii", '|' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '|' }
-};
-
-static struct tui_translate tui_border_kind_translate_hline[] = {
- { "space", ' ' },
- { "ascii", '-' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '-' }
-};
-
-static struct tui_translate tui_border_kind_translate_ulcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_urcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_llcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
-static struct tui_translate tui_border_kind_translate_lrcorner[] = {
- { "space", ' ' },
- { "ascii", '+' },
- { "acs", -1 },
- { 0, 0 },
- { "ascii", '+' }
-};
-
+static struct tui_translate tui_border_kind_translate_vline[]
+ = { { "space", ' ' },
+ { "ascii", '|' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '|' } };
+
+static struct tui_translate tui_border_kind_translate_hline[]
+ = { { "space", ' ' },
+ { "ascii", '-' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '-' } };
+
+static struct tui_translate tui_border_kind_translate_ulcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_urcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_llcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
+
+static struct tui_translate tui_border_kind_translate_lrcorner[]
+ = { { "space", ' ' },
+ { "ascii", '+' },
+ { "acs", -1 },
+ { 0, 0 },
+ { "ascii", '+' } };
/* Tui configuration variables controlled with set/show command. */
static const char *tui_active_border_mode = "bold-standout";
+
static void
-show_tui_active_border_mode (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_active_border_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The attribute mode to use for the active TUI window border is \"%s\".\n"),
value);
}
static const char *tui_border_mode = "normal";
+
static void
-show_tui_border_mode (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_border_mode (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
The attribute mode to use for the TUI window borders is \"%s\".\n"),
value);
}
static const char *tui_border_kind = "acs";
+
static void
-show_tui_border_kind (struct ui_file *file,
- int from_tty,
- struct cmd_list_element *c,
- const char *value)
+show_tui_border_kind (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("The kind of border for TUI windows is \"%s\".\n"),
+ gdb_printf (file, _ ("The kind of border for TUI windows is \"%s\".\n"),
value);
}
@@ -223,14 +198,12 @@ show_tui_border_kind (struct ui_file *file,
bool style_tui_current_position = false;
static void
-show_style_tui_current_position (ui_file *file,
- int from_tty,
- cmd_list_element *c,
- const char *value)
+show_style_tui_current_position (ui_file *file, int from_tty,
+ cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("\
+ gdb_printf (file, _ ("\
Styling the text highlighted by the TUI's current position indicator is %s.\n"),
- value);
+ value);
}
static void
@@ -329,8 +302,8 @@ tui_get_cmd_list (void)
{
if (tuilist == 0)
add_basic_prefix_cmd ("tui", class_tui,
- _("Text User Interface commands."),
- &tuilist, 0, &cmdlist);
+ _ ("Text User Interface commands."), &tuilist, 0,
+ &cmdlist);
return &tuilist;
}
@@ -338,15 +311,13 @@ tui_get_cmd_list (void)
borders on the TUI display. */
static void
-tui_set_var_cmd (const char *null_args,
- int from_tty, struct cmd_list_element *c)
+tui_set_var_cmd (const char *null_args, int from_tty,
+ struct cmd_list_element *c)
{
if (tui_update_variables () && tui_active)
tui_rehighlight_all ();
}
-
-
/* True if TUI resizes should print a message. This is used by the
test suite. */
@@ -356,11 +327,9 @@ static void
show_tui_resize_message (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI resize messaging is %s.\n"), value);
+ gdb_printf (file, _ ("TUI resize messaging is %s.\n"), value);
}
-
-
/* Generic window name completion function. Complete window name pointed
to by TEXT and WORD.
@@ -372,10 +341,9 @@ show_tui_resize_message (struct ui_file *file, int from_tty,
name. This is independent of EXCLUDE_CANNOT_FOCUS_P. */
static void
-window_name_completer (completion_tracker &tracker,
- bool include_next_prev_p,
- bool exclude_cannot_focus_p,
- const char *text, const char *word)
+window_name_completer (completion_tracker &tracker, bool include_next_prev_p,
+ bool exclude_cannot_focus_p, const char *text,
+ const char *word)
{
std::vector<const char *> completion_name_vec;
@@ -412,7 +380,6 @@ window_name_completer (completion_tracker &tracker,
completion_name_vec.push_back ("prev");
}
-
completion_name_vec.push_back (NULL);
complete_on_enum (tracker, completion_name_vec.data (), text, word);
}
@@ -421,8 +388,7 @@ window_name_completer (completion_tracker &tracker,
entered so far, WORD is the word currently being completed. */
static void
-focus_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
+focus_completer (struct cmd_list_element *ignore, completion_tracker &tracker,
const char *text, const char *word)
{
window_name_completer (tracker, true, true, text, word);
@@ -434,8 +400,8 @@ focus_completer (struct cmd_list_element *ignore,
static void
winheight_completer (struct cmd_list_element *ignore,
- completion_tracker &tracker,
- const char *text, const char *word)
+ completion_tracker &tracker, const char *text,
+ const char *word)
{
/* The first word is the window name. That we can complete. Subsequent
words can't be completed. */
@@ -465,7 +431,6 @@ tui_update_gdb_sizes (void)
set_screen_width_and_height (width, height);
}
-
void
tui_win_info::forward_scroll (int num_to_scroll)
{
@@ -484,7 +449,6 @@ tui_win_info::backward_scroll (int num_to_scroll)
do_scroll_vertical (-num_to_scroll);
}
-
void
tui_win_info::left_scroll (int num_to_scroll)
{
@@ -494,7 +458,6 @@ tui_win_info::left_scroll (int num_to_scroll)
do_scroll_horizontal (num_to_scroll);
}
-
void
tui_win_info::right_scroll (int num_to_scroll)
{
@@ -504,7 +467,6 @@ tui_win_info::right_scroll (int num_to_scroll)
do_scroll_horizontal (-num_to_scroll);
}
-
void
tui_refresh_all_win (void)
{
@@ -534,7 +496,7 @@ tui_resize_all (void)
{
#ifdef HAVE_RESIZE_TERM
resize_term (screenheight, screenwidth);
-#endif
+#endif
/* Turn keypad off while we resize. */
keypad (TUI_CMD_WIN->handle.get (), FALSE);
tui_update_gdb_sizes ();
@@ -606,9 +568,8 @@ void
tui_initialize_win (void)
{
#ifdef SIGWINCH
- tui_sigwinch_token
- = create_async_signal_handler (tui_async_resize_screen, NULL,
- "tui-sigwinch");
+ tui_sigwinch_token = create_async_signal_handler (tui_async_resize_screen,
+ NULL, "tui-sigwinch");
{
#ifdef HAVE_SIGACTION
@@ -627,7 +588,6 @@ tui_initialize_win (void)
#endif
}
-
static void
tui_scroll_forward_command (const char *arg, int from_tty)
{
@@ -643,7 +603,6 @@ tui_scroll_forward_command (const char *arg, int from_tty)
win_to_scroll->forward_scroll (num_to_scroll);
}
-
static void
tui_scroll_backward_command (const char *arg, int from_tty)
{
@@ -659,7 +618,6 @@ tui_scroll_backward_command (const char *arg, int from_tty)
win_to_scroll->backward_scroll (num_to_scroll);
}
-
static void
tui_scroll_left_command (const char *arg, int from_tty)
{
@@ -672,7 +630,6 @@ tui_scroll_left_command (const char *arg, int from_tty)
win_to_scroll->left_scroll (num_to_scroll);
}
-
static void
tui_scroll_right_command (const char *arg, int from_tty)
{
@@ -685,7 +642,6 @@ tui_scroll_right_command (const char *arg, int from_tty)
win_to_scroll->right_scroll (num_to_scroll);
}
-
/* Answer the window represented by name. */
static struct tui_win_info *
tui_partial_win_by_name (gdb::string_view name)
@@ -701,8 +657,8 @@ tui_partial_win_by_name (gdb::string_view name)
if (startswith (cur_name, name))
{
if (best != nullptr)
- error (_("Window name \"%*s\" is ambiguous"),
- (int) name.size (), name.data ());
+ error (_ ("Window name \"%*s\" is ambiguous"), (int) name.size (),
+ name.data ());
best = item;
}
}
@@ -717,7 +673,7 @@ tui_set_focus_command (const char *arg, int from_tty)
tui_enable ();
if (arg == NULL)
- error_no_arg (_("name of window to focus"));
+ error_no_arg (_ ("name of window to focus"));
struct tui_win_info *win_info = NULL;
@@ -757,14 +713,14 @@ tui_set_focus_command (const char *arg, int from_tty)
if (!matching_window_name.empty ())
{
if (is_ambiguous)
- error (_("No windows matching \"%s\" in the current layout"),
+ error (_ ("No windows matching \"%s\" in the current layout"),
arg);
else
- error (_("Window \"%s\" is not in the current layout"),
+ error (_ ("Window \"%s\" is not in the current layout"),
matching_window_name.c_str ());
}
else
- error (_("Unrecognized window name \"%s\""), arg);
+ error (_ ("Unrecognized window name \"%s\""), arg);
}
/* If a window is part of the current layout then it will have a
@@ -773,11 +729,10 @@ tui_set_focus_command (const char *arg, int from_tty)
gdb_assert (win_info->is_visible ());
if (!win_info->can_focus ())
- error (_("Window \"%s\" cannot be focused"), arg);
+ error (_ ("Window \"%s\" cannot be focused"), arg);
tui_set_win_focus_to (win_info);
- gdb_printf (_("Focus set to %s window.\n"),
- tui_win_with_focus ()->name ());
+ gdb_printf (_ ("Focus set to %s window.\n"), tui_win_with_focus ()->name ());
}
static void
@@ -785,7 +740,7 @@ tui_all_windows_info (const char *arg, int from_tty)
{
if (!tui_active)
{
- gdb_printf (_("The TUI is not active.\n"));
+ gdb_printf (_ ("The TUI is not active.\n"));
return;
}
@@ -808,14 +763,13 @@ tui_all_windows_info (const char *arg, int from_tty)
uiout->field_signed ("lines", win_info->height);
uiout->field_signed ("columns", win_info->width);
if (win_with_focus == win_info)
- uiout->field_string ("focus", _("(has focus)"));
+ uiout->field_string ("focus", _ ("(has focus)"));
else
uiout->field_skip ("focus");
uiout->text ("\n");
}
}
-
static void
tui_refresh_all_command (const char *arg, int from_tty)
{
@@ -825,7 +779,7 @@ tui_refresh_all_command (const char *arg, int from_tty)
tui_refresh_all_win ();
}
-#define DEFAULT_TAB_LEN 8
+#define DEFAULT_TAB_LEN 8
/* The tab width that should be used by the TUI. */
@@ -851,13 +805,13 @@ update_tab_width ()
/* Callback for "set tui tab-width". */
static void
-tui_set_tab_width (const char *ignore,
- int from_tty, struct cmd_list_element *c)
+tui_set_tab_width (const char *ignore, int from_tty,
+ struct cmd_list_element *c)
{
if (internal_tab_width == 0)
{
internal_tab_width = tui_tab_width;
- error (_("Tab width must not be 0"));
+ error (_ ("Tab width must not be 0"));
}
tui_tab_width = internal_tab_width;
@@ -870,8 +824,7 @@ static void
tui_show_tab_width (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI tab width is %s spaces.\n"), value);
-
+ gdb_printf (file, _ ("TUI tab width is %s spaces.\n"), value);
}
/* See tui-win.h. */
@@ -894,7 +847,7 @@ static void
tui_show_compact_source (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("TUI source window compactness is %s.\n"), value);
+ gdb_printf (file, _ ("TUI source window compactness is %s.\n"), value);
}
/* Set the tab width of the specified window. */
@@ -909,7 +862,7 @@ tui_set_tab_width_command (const char *arg, int from_tty)
ts = atoi (arg);
if (ts <= 0)
- warning (_("Tab widths greater than 0 must be specified."));
+ warning (_ ("Tab widths greater than 0 must be specified."));
else
{
internal_tab_width = ts;
@@ -939,7 +892,7 @@ tui_set_win_size (const char *arg, bool set_width_p)
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
- error_no_arg (_("name of window"));
+ error_no_arg (_ ("name of window"));
const char *buf = arg;
const char *buf_ptr = buf;
@@ -953,9 +906,9 @@ tui_set_win_size (const char *arg, bool set_width_p)
win_info = tui_partial_win_by_name (wname);
if (win_info == NULL)
- error (_("Unrecognized window name \"%s\""), arg);
+ error (_ ("Unrecognized window name \"%s\""), arg);
if (!win_info->is_visible ())
- error (_("Window \"%s\" is not visible"), arg);
+ error (_ ("Window \"%s\" is not visible"), arg);
/* Process the size. */
buf_ptr = skip_spaces (buf_ptr);
@@ -964,7 +917,8 @@ tui_set_win_size (const char *arg, bool set_width_p)
{
bool negate = false;
bool fixed_size = true;
- int input_no;;
+ int input_no;
+ ;
if (*buf_ptr == '+' || *buf_ptr == '-')
{
@@ -1001,9 +955,9 @@ tui_set_win_size (const char *arg, bool set_width_p)
else
{
if (set_width_p)
- error (_("Invalid window width specified"));
+ error (_ ("Invalid window width specified"));
else
- error (_("Invalid window height specified"));
+ error (_ ("Invalid window height specified"));
}
}
}
@@ -1043,8 +997,7 @@ tui_win_info::max_width () const
}
static void
-parse_scrolling_args (const char *arg,
- struct tui_win_info **win_to_scroll,
+parse_scrolling_args (const char *arg, struct tui_win_info **win_to_scroll,
int *num_to_scroll)
{
if (num_to_scroll)
@@ -1089,9 +1042,9 @@ parse_scrolling_args (const char *arg,
*win_to_scroll = tui_partial_win_by_name (wname);
if (*win_to_scroll == NULL)
- error (_("Unrecognized window `%s'"), wname);
+ error (_ ("Unrecognized window `%s'"), wname);
if (!(*win_to_scroll)->is_visible ())
- error (_("Window is not visible"));
+ error (_ ("Window is not visible"));
else if (*win_to_scroll == TUI_CMD_WIN)
*win_to_scroll = *(tui_source_windows ().begin ());
}
@@ -1115,6 +1068,7 @@ tui_window_command (const char *args, int from_tty)
manipulation. */
void _initialize_tui_win ();
+
void
_initialize_tui_win ()
{
@@ -1123,31 +1077,28 @@ _initialize_tui_win ()
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
- add_setshow_prefix_cmd ("tui", class_tui,
- _("TUI configuration variables."),
- _("TUI configuration variables."),
- &tui_setlist, &tui_showlist,
- &setlist, &showlist);
+ add_setshow_prefix_cmd ("tui", class_tui, _ ("TUI configuration variables."),
+ _ ("TUI configuration variables."), &tui_setlist,
+ &tui_showlist, &setlist, &showlist);
cmd_list_element *refresh_cmd
= add_cmd ("refresh", class_tui, tui_refresh_all_command,
- _("Refresh the terminal display."),
- tui_get_cmd_list ());
+ _ ("Refresh the terminal display."), tui_get_cmd_list ());
add_com_alias ("refresh", refresh_cmd, class_tui, 0);
cmd_list_element *tabset_cmd
- = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
+ = add_com ("tabset", class_tui, tui_set_tab_width_command, _ ("\
Set the width (in characters) of tab stops.\n\
Usage: tabset N"));
deprecate_cmd (tabset_cmd, "set tui tab-width");
/* Setup the 'tui window' list of command. */
add_prefix_cmd ("window", class_tui, tui_window_command,
- _("Text User Interface window commands."),
- &tui_window_cmds, 1, tui_get_cmd_list ());
+ _ ("Text User Interface window commands."), &tui_window_cmds,
+ 1, tui_get_cmd_list ());
cmd_list_element *winheight_cmd
- = add_cmd ("height", class_tui, tui_set_win_height_command, _("\
+ = add_cmd ("height", class_tui, tui_set_win_height_command, _ ("\
Set or modify the height of a specified window.\n\
Usage: tui window height WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1157,7 +1108,7 @@ Use \"info win\" to see the names of the windows currently being displayed."),
set_cmd_completer (winheight_cmd, winheight_completer);
cmd_list_element *winwidth_cmd
- = add_cmd ("width", class_tui, tui_set_win_width_command, _("\
+ = add_cmd ("width", class_tui, tui_set_win_width_command, _ ("\
Set or modify the width of a specified window.\n\
Usage: tui window width WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1165,11 +1116,10 @@ Use \"info win\" to see the names of the windows currently being displayed."),
add_com_alias ("winwidth", winwidth_cmd, class_tui, 0);
set_cmd_completer (winwidth_cmd, winheight_completer);
- add_info ("win", tui_all_windows_info,
- _("List of all displayed windows.\n\
+ add_info ("win", tui_all_windows_info, _ ("List of all displayed windows.\n\
Usage: info win"));
cmd_list_element *focus_cmd
- = add_cmd ("focus", class_tui, tui_set_focus_command, _("\
+ = add_cmd ("focus", class_tui, tui_set_focus_command, _ ("\
Set focus to named window or next/prev window.\n\
Usage: tui focus [WINDOW-NAME | next | prev]\n\
Use \"info win\" to see the names of the windows currently being displayed."),
@@ -1177,22 +1127,22 @@ Use \"info win\" to see the names of the windows currently being displayed."),
add_com_alias ("focus", focus_cmd, class_tui, 0);
add_com_alias ("fs", focus_cmd, class_tui, 0);
set_cmd_completer (focus_cmd, focus_completer);
- add_com ("+", class_tui, tui_scroll_forward_command, _("\
+ add_com ("+", class_tui, tui_scroll_forward_command, _ ("\
Scroll window forward.\n\
Usage: + [N] [WIN]\n\
Scroll window WIN N lines forwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com ("-", class_tui, tui_scroll_backward_command, _("\
+ add_com ("-", class_tui, tui_scroll_backward_command, _ ("\
Scroll window backward.\n\
Usage: - [N] [WIN]\n\
Scroll window WIN N lines backwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com ("<", class_tui, tui_scroll_left_command, _("\
+ add_com ("<", class_tui, tui_scroll_left_command, _ ("\
Scroll window text to the left.\n\
Usage: < [N] [WIN]\n\
Scroll window WIN N characters left. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
- add_com (">", class_tui, tui_scroll_right_command, _("\
+ add_com (">", class_tui, tui_scroll_right_command, _ ("\
Scroll window text to the right.\n\
Usage: > [N] [WIN]\n\
Scroll window WIN N characters right. Both WIN and N are optional, N\n\
@@ -1200,21 +1150,24 @@ defaults to 1, and WIN defaults to the currently focused window."));
/* Define the tui control variables. */
add_setshow_enum_cmd ("border-kind", no_class, tui_border_kind_enums,
- &tui_border_kind, _("\
-Set the kind of border for TUI windows."), _("\
-Show the kind of border for TUI windows."), _("\
+ &tui_border_kind, _ ("\
+Set the kind of border for TUI windows."),
+ _ ("\
+Show the kind of border for TUI windows."),
+ _ ("\
This variable controls the border of TUI windows:\n\
space use a white space\n\
ascii use ascii characters + - | for the border\n\
acs use the Alternate Character Set"),
- tui_set_var_cmd,
- show_tui_border_kind,
- &tui_setlist, &tui_showlist);
+ tui_set_var_cmd, show_tui_border_kind, &tui_setlist,
+ &tui_showlist);
add_setshow_enum_cmd ("border-mode", no_class, tui_border_mode_enums,
- &tui_border_mode, _("\
-Set the attribute mode to use for the TUI window borders."), _("\
-Show the attribute mode to use for the TUI window borders."), _("\
+ &tui_border_mode, _ ("\
+Set the attribute mode to use for the TUI window borders."),
+ _ ("\
+Show the attribute mode to use for the TUI window borders."),
+ _ ("\
This variable controls the attributes to use for the window borders:\n\
normal normal display\n\
standout use highlight mode of terminal\n\
@@ -1223,14 +1176,15 @@ This variable controls the attributes to use for the window borders:\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
- tui_set_var_cmd,
- show_tui_border_mode,
- &tui_setlist, &tui_showlist);
+ tui_set_var_cmd, show_tui_border_mode, &tui_setlist,
+ &tui_showlist);
add_setshow_enum_cmd ("active-border-mode", no_class, tui_border_mode_enums,
- &tui_active_border_mode, _("\
-Set the attribute mode to use for the active TUI window border."), _("\
-Show the attribute mode to use for the active TUI window border."), _("\
+ &tui_active_border_mode, _ ("\
+Set the attribute mode to use for the active TUI window border."),
+ _ ("\
+Show the attribute mode to use for the active TUI window border."),
+ _ ("\
This variable controls the attributes to use for the active window border:\n\
normal normal display\n\
standout use highlight mode of terminal\n\
@@ -1239,32 +1193,34 @@ This variable controls the attributes to use for the active window border:\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
- tui_set_var_cmd,
- show_tui_active_border_mode,
+ tui_set_var_cmd, show_tui_active_border_mode,
&tui_setlist, &tui_showlist);
- add_setshow_zuinteger_cmd ("tab-width", no_class,
- &internal_tab_width, _("\
-Set the tab width, in characters, for the TUI."), _("\
-Show the tab witdh, in characters, for the TUI."), _("\
+ add_setshow_zuinteger_cmd ("tab-width", no_class, &internal_tab_width, _ ("\
+Set the tab width, in characters, for the TUI."),
+ _ ("\
+Show the tab witdh, in characters, for the TUI."),
+ _ ("\
This variable controls how many spaces are used to display a tab character."),
tui_set_tab_width, tui_show_tab_width,
&tui_setlist, &tui_showlist);
add_setshow_boolean_cmd ("tui-resize-message", class_maintenance,
- &resize_message, _("\
-Set TUI resize messaging."), _("\
-Show TUI resize messaging."), _("\
+ &resize_message, _ ("\
+Set TUI resize messaging."),
+ _ ("\
+Show TUI resize messaging."),
+ _ ("\
When enabled GDB will print a message when the terminal is resized."),
- nullptr,
- show_tui_resize_message,
+ nullptr, show_tui_resize_message,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
- add_setshow_boolean_cmd ("compact-source", class_tui,
- &compact_source, _("\
-Set whether the TUI source window is compact."), _("\
-Show whether the TUI source window is compact."), _("\
+ add_setshow_boolean_cmd ("compact-source", class_tui, &compact_source, _ ("\
+Set whether the TUI source window is compact."),
+ _ ("\
+Show whether the TUI source window is compact."),
+ _ ("\
This variable controls whether the TUI source window is shown\n\
in a compact form. The compact form puts the source closer to\n\
the line numbers and uses less horizontal space."),
@@ -1272,16 +1228,15 @@ the line numbers and uses less horizontal space."),
&tui_setlist, &tui_showlist);
add_setshow_boolean_cmd ("tui-current-position", class_maintenance,
- &style_tui_current_position, _("\
+ &style_tui_current_position, _ ("\
Set whether to style text highlighted by the TUI's current position indicator."),
- _("\
+ _ ("\
Show whether to style text highlighted by the TUI's current position indicator."),
- _("\
+ _ ("\
When enabled, the source and assembly code highlighted by the TUI's current\n\
position indicator is styled."),
set_style_tui_current_position,
- show_style_tui_current_position,
- &style_set_list,
+ show_style_tui_current_position, &style_set_list,
&style_show_list);
tui_border_style.changed.attach (tui_rehighlight_all, "tui-win");
diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index 82a023d..30ef02d 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -79,8 +79,7 @@ tui_win_info::refresh_window ()
/* Draw a border arround the window. */
static void
-box_win (struct tui_win_info *win_info,
- bool highlight_flag)
+box_win (struct tui_win_info *win_info, bool highlight_flag)
{
WINDOW *win;
int attrs;
@@ -94,14 +93,12 @@ box_win (struct tui_win_info *win_info,
/* tui_apply_style resets the style entirely, so be sure to call it
before applying ATTRS. */
if (cli_styling)
- tui_apply_style (win, (highlight_flag
- ? tui_active_border_style.style ()
- : tui_border_style.style ()));
+ tui_apply_style (win, (highlight_flag ? tui_active_border_style.style ()
+ : tui_border_style.style ()));
wattron (win, attrs);
#ifdef HAVE_WBORDER
- wborder (win, tui_border_vline, tui_border_vline,
- tui_border_hline, tui_border_hline,
- tui_border_ulcorner, tui_border_urcorner,
+ wborder (win, tui_border_vline, tui_border_vline, tui_border_hline,
+ tui_border_hline, tui_border_ulcorner, tui_border_urcorner,
tui_border_llcorner, tui_border_lrcorner);
#else
box (win, tui_border_vline, tui_border_hline);
@@ -117,8 +114,8 @@ box_win (struct tui_win_info *win_info,
else
{
std::string truncated
- = "..." + win_info->title.substr (win_info->title.size ()
- - max_len + 3);
+ = "..."
+ + win_info->title.substr (win_info->title.size () - max_len + 3);
mvwaddstr (win, 0, 2, truncated.c_str ());
}
}
@@ -126,13 +123,10 @@ box_win (struct tui_win_info *win_info,
tui_apply_style (win, ui_file_style ());
}
-
void
tui_unhighlight_win (struct tui_win_info *win_info)
{
- if (win_info != NULL
- && win_info->can_box ()
- && win_info->handle != NULL)
+ if (win_info != NULL && win_info->can_box () && win_info->handle != NULL)
{
box_win (win_info, false);
win_info->refresh_window ();
@@ -140,13 +134,10 @@ tui_unhighlight_win (struct tui_win_info *win_info)
}
}
-
void
tui_highlight_win (struct tui_win_info *win_info)
{
- if (win_info != NULL
- && win_info->can_box ()
- && win_info->handle != NULL)
+ if (win_info != NULL && win_info->can_box () && win_info->handle != NULL)
{
box_win (win_info, true);
win_info->refresh_window ();
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 52a0f7a..cac1fa2 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -94,16 +94,13 @@ tui_copy_source_line (const char **ptr, int *length)
++lineptr;
++column;
- auto process_tab = [&] ()
- {
- int max_tab_len = tui_tab_width;
+ auto process_tab = [&] () {
+ int max_tab_len = tui_tab_width;
- --column;
- for (int j = column % max_tab_len;
- j < max_tab_len;
- column++, j++)
- result.push_back (' ');
- };
+ --column;
+ for (int j = column % max_tab_len; j < max_tab_len; column++, j++)
+ result.push_back (' ');
+ };
if (c == '\n' || c == '\r' || c == '\0')
{
@@ -148,21 +145,18 @@ tui_source_window_base::style_changed ()
/* Function to display source in the source window. This function
initializes the horizontal scroll to 0. */
void
-tui_source_window_base::update_source_window
- (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal)
+tui_source_window_base::update_source_window (
+ struct gdbarch *gdbarch, const struct symtab_and_line &sal)
{
m_horizontal_offset = 0;
update_source_window_as_is (gdbarch, sal);
}
-
/* Function to display source in the source/asm window. This function
shows the source as specified by the horizontal offset. */
void
-tui_source_window_base::update_source_window_as_is
- (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal)
+tui_source_window_base::update_source_window_as_is (
+ struct gdbarch *gdbarch, const struct symtab_and_line &sal)
{
bool ret = set_contents (gdbarch, sal);
@@ -177,13 +171,15 @@ tui_source_window_base::update_source_window_as_is
}
}
-
/* Function to ensure that the source and/or disassemly windows
reflect the input address. */
void
tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
{
- struct symtab_and_line sal {};
+ struct symtab_and_line sal
+ {
+ };
+
if (addr != 0)
sal = find_pc_line (addr, 0);
@@ -223,10 +219,7 @@ tui_source_window_base::do_erase_source_content (const char *str)
x_pos = 1;
else
x_pos = half_width - strlen (str);
- mvwaddstr (handle.get (),
- (height / 2),
- x_pos,
- (char *) str);
+ mvwaddstr (handle.get (), (height / 2), x_pos, (char *) str);
refresh_window ();
}
@@ -392,7 +385,7 @@ tui_source_window_base::show_source_content ()
{
int reduced_width = std::max (pad_width / 2, width);
if (reduced_width == pad_width)
- error (_("failed to setup source window"));
+ error (_ ("failed to setup source window"));
pad_width = reduced_width;
}
}
@@ -421,9 +414,9 @@ tui_source_window_base::tui_source_window_base ()
m_start_line_or_addr.loa = LOA_ADDRESS;
m_start_line_or_addr.u.addr = 0;
- gdb::observers::styling_changed.attach
- (std::bind (&tui_source_window::style_changed, this),
- m_observable, "tui-winsource");
+ gdb::observers::styling_changed.attach (
+ std::bind (&tui_source_window::style_changed, this), m_observable,
+ "tui-winsource");
}
tui_source_window_base::~tui_source_window_base ()
@@ -447,8 +440,7 @@ tui_source_window_base::rerender ()
if (!m_content.empty ())
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (m_start_line_or_addr.loa == LOA_LINE)
cursal.line = m_start_line_or_addr.u.line_no;
@@ -458,8 +450,7 @@ tui_source_window_base::rerender ()
}
else if (deprecated_safe_get_selected_frame () != NULL)
{
- struct symtab_and_line cursal
- = get_current_source_symtab_and_line ();
+ struct symtab_and_line cursal = get_current_source_symtab_and_line ();
frame_info_ptr frame = deprecated_safe_get_selected_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -553,7 +544,6 @@ tui_source_window_base::do_scroll_horizontal (int num_to_scroll)
}
}
-
/* Set or clear the is_exec_point flag in the line whose line is
line_no. */
@@ -567,8 +557,7 @@ tui_source_window_base::set_is_exec_point_at (struct tui_line_or_address l)
while (i < m_content.size ())
{
bool new_state;
- struct tui_line_or_address content_loa =
- m_content[i].line_or_addr;
+ struct tui_line_or_address content_loa = m_content[i].line_or_addr;
if (content_loa.loa == l.loa
&& ((l.loa == LOA_LINE && content_loa.u.line_no == l.u.line_no)
@@ -599,7 +588,6 @@ tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
}
}
-
/* Scan the source window and the breakpoints to update the break_mode
information for each line.
@@ -607,8 +595,8 @@ tui_update_all_breakpoint_info (struct breakpoint *being_deleted)
refreshed. */
bool
-tui_source_window_base::update_breakpoint_info
- (struct breakpoint *being_deleted, bool current_only)
+tui_source_window_base::update_breakpoint_info (
+ struct breakpoint *being_deleted, bool current_only)
{
int i;
bool need_refresh = false;
@@ -619,7 +607,7 @@ tui_source_window_base::update_breakpoint_info
line = &m_content[i];
if (current_only && !line->is_exec_point)
- continue;
+ continue;
/* Scan each breakpoint to see if the current line has something to
do with it. Identify enable/disabled breakpoints as well as
diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h
index 7370ae9..ab61482 100644
--- a/gdb/tui/tui-winsource.h
+++ b/gdb/tui/tui-winsource.h
@@ -35,11 +35,12 @@ enum tui_line_or_address_kind
struct tui_line_or_address
{
enum tui_line_or_address_kind loa;
+
union
- {
- int line_no;
- CORE_ADDR addr;
- } u;
+ {
+ int line_no;
+ CORE_ADDR addr;
+ } u;
};
/* Flags to tell what kind of breakpoint is at current line. */
@@ -55,10 +56,10 @@ enum tui_bp_flag
DEF_ENUM_FLAGS_TYPE (enum tui_bp_flag, tui_bp_flags);
/* Position of breakpoint markers in the exec info string. */
-#define TUI_BP_HIT_POS 0
-#define TUI_BP_BREAK_POS 1
-#define TUI_EXEC_POS 2
-#define TUI_EXECINFO_SIZE 4
+#define TUI_BP_HIT_POS 0
+#define TUI_BP_BREAK_POS 1
+#define TUI_EXEC_POS 2
+#define TUI_EXECINFO_SIZE 4
/* Elements in the Source/Disassembly Window. */
struct tui_source_element
@@ -85,13 +86,13 @@ struct tui_source_element
tui_bp_flags break_mode = 0;
};
-
/* The base class for all source-like windows, namely the source and
disassembly windows. */
struct tui_source_window_base : public tui_win_info
{
protected:
+
tui_source_window_base ();
~tui_source_window_base ();
@@ -105,21 +106,17 @@ protected:
void rerender () override;
virtual bool set_contents (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal) = 0;
+ const struct symtab_and_line &sal)
+ = 0;
/* Return the number of extra margin characters needed by this
instance. */
- virtual int extra_margin () const
- {
- return 0;
- }
+ virtual int extra_margin () const { return 0; }
/* Display the line number in the window margin. OFFSET indicates
which line to display; it is 0-based, with 0 meaning the line at
the top of the window. */
- virtual void show_line_number (int offset) const
- {
- }
+ virtual void show_line_number (int offset) const {}
/* Redraw the complete line of a source or disassembly window. */
void show_source_line (int lineno);
@@ -161,8 +158,8 @@ public:
the location is already displayed. */
virtual void maybe_update (frame_info_ptr fi, symtab_and_line sal) = 0;
- void update_source_window_as_is (struct gdbarch *gdbarch,
- const struct symtab_and_line &sal);
+ void update_source_window_as_is (struct gdbarch *gdbarch,
+ const struct symtab_and_line &sal);
void update_source_window (struct gdbarch *gdbarch,
const struct symtab_and_line &sal);
@@ -181,7 +178,8 @@ public:
/* Return the start address and gdbarch. */
virtual void display_start_addr (struct gdbarch **gdbarch_p,
- CORE_ADDR *addr_p) = 0;
+ CORE_ADDR *addr_p)
+ = 0;
private:
@@ -205,14 +203,12 @@ private:
/* Return the size of the left margin space, this is the space used to
display things like breakpoint markers. */
- int left_margin () const
- { return 1 + TUI_EXECINFO_SIZE + extra_margin (); }
+ int left_margin () const { return 1 + TUI_EXECINFO_SIZE + extra_margin (); }
/* Return the width of the area that is available for window content.
This is the window width minus the borders and the left margin, which
is used for displaying things like breakpoint markers. */
- int view_width () const
- { return width - left_margin () - 1; }
+ int view_width () const { return width - left_margin () - 1; }
void show_source_content ();
@@ -252,7 +248,6 @@ private:
int m_pad_offset = 0;
};
-
/* A wrapper for a TUI window iterator that only iterates over source
windows. */
@@ -358,6 +353,6 @@ extern std::string tui_copy_source_line (const char **ptr,
int *length = nullptr);
/* Constant definitions. */
-#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
+#define SCROLL_THRESHOLD 2 /* Threshold for lazy scroll. */
#endif /* TUI_TUI_WINSOURCE_H */
diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index cdae9ff..0ac3caf 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -57,10 +57,10 @@ bool debug_tui = false;
/* Implement 'show debug tui'. */
static void
-show_tui_debug (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_tui_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c,
+ const char *value)
{
- gdb_printf (file, _("TUI debugging is \"%s\".\n"), value);
+ gdb_printf (file, _ ("TUI debugging is \"%s\".\n"), value);
}
/* This redefines CTRL if it is not already defined, so it must come
@@ -83,18 +83,10 @@ struct tui_char_command
/* Key mapping to gdb commands when the TUI is using the single key
mode. */
static const struct tui_char_command tui_commands[] = {
- { 'c', "continue" },
- { 'd', "down" },
- { 'f', "finish" },
- { 'n', "next" },
- { 'o', "nexti" },
- { 'r', "run" },
- { 's', "step" },
- { 'i', "stepi" },
- { 'u', "up" },
- { 'v', "info locals" },
- { 'w', "where" },
- { 0, 0 },
+ { 'c', "continue" }, { 'd', "down" }, { 'f', "finish" },
+ { 'n', "next" }, { 'o', "nexti" }, { 'r', "run" },
+ { 's', "step" }, { 'i', "stepi" }, { 'u', "up" },
+ { 'v', "info locals" }, { 'w', "where" }, { 0, 0 },
};
static Keymap tui_keymap;
@@ -105,7 +97,6 @@ static Keymap tui_readline_standard_keymap;
static int
tui_rl_switch_mode (int notused1, int notused2)
{
-
/* Don't let exceptions escape. We're in the middle of a readline
callback that isn't prepared for that. */
try
@@ -245,7 +236,8 @@ tui_rl_next_keymap (int notused1, int notused2)
tui_rl_switch_mode (0 /* notused */, 0 /* notused */);
tui_set_key_mode (tui_current_key_mode == TUI_COMMAND_MODE
- ? TUI_SINGLE_KEY_MODE : TUI_COMMAND_MODE);
+ ? TUI_SINGLE_KEY_MODE
+ : TUI_COMMAND_MODE);
return 0;
}
@@ -270,8 +262,8 @@ void
tui_set_key_mode (enum tui_key_mode mode)
{
tui_current_key_mode = mode;
- rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
- ? tui_keymap : tui_readline_standard_keymap);
+ rl_set_keymap (mode == TUI_SINGLE_KEY_MODE ? tui_keymap
+ : tui_readline_standard_keymap);
tui_show_locator_content ();
}
@@ -308,7 +300,7 @@ tui_ensure_readline_initialized ()
for (i = 0; tui_commands[i].cmd; i++)
rl_bind_key_in_map (tui_commands[i].key, tui_rl_command_key, tui_keymap);
- rl_generic_bind (ISKMAP, "\\C-x", (char*) tui_ctlx_keymap, tui_keymap);
+ rl_generic_bind (ISKMAP, "\\C-x", (char *) tui_ctlx_keymap, tui_keymap);
/* Bind all other keys to tui_rl_command_mode so that we switch
temporarily from SingleKey mode and can enter a gdb command. */
@@ -380,7 +372,7 @@ tui_enable (void)
WINDOW *w;
SCREEN *s;
#ifndef __MINGW32__
- const char *cap;
+ const char *cap;
#endif
const char *interp;
@@ -388,12 +380,13 @@ tui_enable (void)
MI), enabling curses will certainly lose. */
interp = top_level_interpreter ()->name ();
if (strcmp (interp, INTERP_TUI) != 0)
- error (_("Cannot enable the TUI when the interpreter is '%s'"), interp);
+ error (_ ("Cannot enable the TUI when the interpreter is '%s'"),
+ interp);
/* Don't try to setup curses (and print funny control
characters) if we're not outputting to a terminal. */
if (!gdb_stderr->isatty ())
- error (_("Cannot enable the TUI when output is not a terminal"));
+ error (_ ("Cannot enable the TUI when output is not a terminal"));
s = newterm (NULL, stdout, stdin);
#ifdef __MINGW32__
@@ -404,7 +397,7 @@ tui_enable (void)
#endif
if (s == NULL)
{
- error (_("Cannot enable the TUI: error opening terminal [TERM=%s]"),
+ error (_ ("Cannot enable the TUI: error opening terminal [TERM=%s]"),
gdb_getenv_term ());
}
w = stdscr;
@@ -418,7 +411,7 @@ tui_enable (void)
start_color ();
}
- /* Check required terminal capabilities. The MinGW port of
+ /* Check required terminal capabilities. The MinGW port of
ncurses does have them, but doesn't expose them through "cup". */
#ifndef __MINGW32__
cap = tigetstr ((char *) "cup");
@@ -426,8 +419,8 @@ tui_enable (void)
{
endwin ();
delscreen (s);
- error (_("Cannot enable the TUI: "
- "terminal doesn't support cursor addressing [TERM=%s]"),
+ error (_ ("Cannot enable the TUI: "
+ "terminal doesn't support cursor addressing [TERM=%s]"),
gdb_getenv_term ());
}
#endif
@@ -441,8 +434,8 @@ tui_enable (void)
cbreak ();
noecho ();
/* timeout (1); */
- nodelay(w, FALSE);
- nl();
+ nodelay (w, FALSE);
+ nl ();
keypad (w, TRUE);
tui_set_term_height_to (LINES);
tui_set_term_width_to (COLS);
@@ -577,18 +570,18 @@ tui_is_window_visible (enum tui_win_type type)
}
bool
-tui_get_command_dimension (unsigned int *width,
- unsigned int *height)
+tui_get_command_dimension (unsigned int *width, unsigned int *height)
{
if (!tui_active || (TUI_CMD_WIN == NULL))
return false;
-
+
*width = TUI_CMD_WIN->width;
*height = TUI_CMD_WIN->height;
return true;
}
void _initialize_tui ();
+
void
_initialize_tui ()
{
@@ -597,20 +590,21 @@ _initialize_tui ()
tuicmd = tui_get_cmd_list ();
add_cmd ("enable", class_tui, tui_enable_command,
- _("Enable TUI display mode.\n\
+ _ ("Enable TUI display mode.\n\
Usage: tui enable"),
tuicmd);
add_cmd ("disable", class_tui, tui_disable_command,
- _("Disable TUI display mode.\n\
+ _ ("Disable TUI display mode.\n\
Usage: tui disable"),
tuicmd);
/* Debug this tui internals. */
- add_setshow_boolean_cmd ("tui", class_maintenance, &debug_tui, _("\
-Set tui debugging."), _("\
-Show tui debugging."), _("\
+ add_setshow_boolean_cmd ("tui", class_maintenance, &debug_tui, _ ("\
+Set tui debugging."),
+ _ ("\
+Show tui debugging."),
+ _ ("\
When true, tui specific internal debugging is enabled."),
- NULL,
- show_tui_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_tui_debug, &setdebuglist,
+ &showdebuglist);
}
diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h
index ca30e7c..e935042 100644
--- a/gdb/tui/tui.h
+++ b/gdb/tui/tui.h
@@ -33,8 +33,7 @@ extern bool debug_tui;
/* Print "tui" enter/exit debug statements. */
-#define TUI_SCOPED_DEBUG_ENTER_EXIT \
- scoped_debug_enter_exit (debug_tui, "tui")
+#define TUI_SCOPED_DEBUG_ENTER_EXIT scoped_debug_enter_exit (debug_tui, "tui")
#define TUI_SCOPED_DEBUG_START_END(fmt, ...) \
scoped_debug_start_end (debug_tui, "tui", fmt, ##__VA_ARGS__)
@@ -60,8 +59,8 @@ enum tui_win_type
MAX_MAJOR_WINDOWS,
};
-extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *,
- CORE_ADDR, CORE_ADDR);
+extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *, CORE_ADDR,
+ CORE_ADDR);
extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr);
extern bool tui_is_window_visible (enum tui_win_type type);
extern bool tui_get_command_dimension (unsigned int *width,