
The TUI has two types of windows derived from tui_source_window_base:
- tui_source_window (the source window), and
- tui_disasm_window (the disassembly window).
The two windows share a common concept: the left margin.
With a hello world a.out, we can see the source window:
...
┌─/home/vries/hello.c───────────────────────────────────────┐
│ 5 { │
│B+> 6 printf ("hello\n"); │
│ 7 return 0; │
│ 8 } │
│ 9 │
│
...
where the left margin is the part holding "B+>" and the line number, and the
disassembly window:
...
┌───────────────────────────────────────────────────────────┐
│ 0x555555555149 <main> endbr64 │
│ 0x55555555514d <main+4> push %rbp │
│ 0x55555555514e <main+5> mov %rsp,%rbp │
│B+> 0x555555555151 <main+8> lea 0xeac(%rip),%rax│
│ 0x555555555158 <main+15> mov %rax,%rdi │
...
where the left margin is just the bit holding "B+>".
Because the left margin contains some spaces, it's not clear where it starts
and ends, making it harder to observe problems related to it.
Add a new maintenance command "maint set tui-left-margin-verbose", that when
set to on replaces the spaces in the left margin with either '_' or '0',
giving us this for the source window:
...
┌─/home/vries/hello.c───────────────────────────────────────┐
│___000005__{ │
│B+>000006__ printf ("hello\n"); │
│___000007__ return 0; │
│___000008__} │
...
and this for the disassembly window:
...
┌───────────────────────────────────────────────────────────┐
│___ 0x555555555149 <main> endbr64 │
│___ 0x55555555514d <main+4> push %rbp │
│___ 0x55555555514e <main+5> mov %rsp,%rbp │
│B+> 0x555555555151 <main+8> lea 0xeac(%rip),%rax│
│___ 0x555555555158 <main+15> mov %rax,%rdi │
...
Note the space between "B+>" and 0x555555555151. The space shows that a bit
of the left margin is not written, a problem reported as PR tui/30325.
Specifically, PR tui/30325 is about the fact that the '[' character from the
string "[ No Assembly Available ]" ends up in that same spot:
...
│B+>[0x555555555151 <main+8> lea 0xeac(%rip),%rax│
...
which only happens for certain window widths.
The new command allows us to spot the problem with any window width.
Likewise, when we revert the fix from commit 1b6d4bb223
("Redraw both spaces
between line numbers and source code"), we have:
...
┌─/home/vries/hello.c───────────────────────────────────────┐
│___000005_ { │
│B+>000006_ printf ("hello\n"); │
│___000007_ return 0; │
│___000008_ } │
...
showing a similar problem at the space between '_' and '{'.
Tested on x86_64-linux.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
61 lines
1.9 KiB
C
61 lines
1.9 KiB
C
/* TUI window generic functions.
|
|
|
|
Copyright (C) 1998-2023 Free Software Foundation, Inc.
|
|
|
|
Contributed by Hewlett-Packard Company.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef TUI_TUI_WIN_H
|
|
#define TUI_TUI_WIN_H
|
|
|
|
#include "tui/tui-data.h"
|
|
|
|
extern void tui_set_win_focus_to (struct tui_win_info *);
|
|
extern void tui_resize_all (void);
|
|
extern void tui_refresh_all_win (void);
|
|
extern void tui_rehighlight_all (void);
|
|
|
|
extern chtype tui_border_ulcorner;
|
|
extern chtype tui_border_urcorner;
|
|
extern chtype tui_border_lrcorner;
|
|
extern chtype tui_border_llcorner;
|
|
extern chtype tui_border_vline;
|
|
extern chtype tui_border_hline;
|
|
extern int tui_border_attrs;
|
|
extern int tui_active_border_attrs;
|
|
|
|
extern bool tui_update_variables ();
|
|
|
|
extern void tui_initialize_win (void);
|
|
|
|
/* Update gdb's knowledge of the terminal size. */
|
|
extern void tui_update_gdb_sizes (void);
|
|
|
|
/* Create or get the TUI command list. */
|
|
struct cmd_list_element **tui_get_cmd_list (void);
|
|
|
|
/* Whether compact source display should be used. */
|
|
extern bool compact_source;
|
|
|
|
/* Whether to style the source and assembly code highlighted by the TUI's
|
|
current position indicator. */
|
|
extern bool style_tui_current_position;
|
|
|
|
/* Whether to replace the spaces in the left margin with '_' and '0'. */
|
|
extern bool tui_left_margin_verbose;
|
|
|
|
#endif /* TUI_TUI_WIN_H */
|