aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-layout.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-17 15:45:14 -0600
committerTom Tromey <tom@tromey.com>2019-06-25 07:48:42 -0600
commitf936bca26dd7593a3b792e76eba37c5de2374961 (patch)
tree2f76d11fd8f646ff531eb926ea69cc3b2e4c16df /gdb/tui/tui-layout.c
parentd6ba6a11642cdbec4ce91fefe455920b5c073f60 (diff)
downloadgdb-f936bca26dd7593a3b792e76eba37c5de2374961.zip
gdb-f936bca26dd7593a3b792e76eba37c5de2374961.tar.gz
gdb-f936bca26dd7593a3b792e76eba37c5de2374961.tar.bz2
Remove some TUI static allocations
The TUI statically allocates the "execution_info" for the source and disassembly windows. However, there's no deep reason to do this, and this approach makes it harder to allow multiple such windows. This patch removes the static data and changes the code to simply allocate these windows as needed. This required pushing some code into the tui_gen_win_info destructor, but that seems like a good idea anyhow. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_source_or_disasm_window): Always use init_and_make_win for EXEC_INFO_WIN. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: No longer inline. (struct tui_win_info) <~tui_win_info>: Inline. (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr): Don't declare. * tui/tui-data.c (source_win, disasm_win): Remove globals. (tui_source_exec_info_win_ptr, tui_disassem_exec_info_win_ptr): Remove. (tui_initialize_static_data): Update. (~tui_gen_win_info): Handle more cleanup here. (~tui_source_window_base): Delete "execution_info". (~tui_win_info): Move code to ~tui_gen_win_info; remove.
Diffstat (limited to 'gdb/tui/tui-layout.c')
-rw-r--r--gdb/tui/tui-layout.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index f586d70..695fa35 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -814,22 +814,14 @@ static struct tui_win_info *
make_source_or_disasm_window (enum tui_win_type type,
int height, int origin_y)
{
- struct tui_gen_win_info *execution_info = NULL;
-
- /* Create the exeuction info window. */
- if (type == SRC_WIN)
- execution_info = tui_source_exec_info_win_ptr ();
- else
- execution_info = tui_disassem_exec_info_win_ptr ();
- execution_info
- = ((struct tui_gen_win_info *)
- init_and_make_win (execution_info,
- EXEC_INFO_WIN,
- height,
- 3,
- 0,
- origin_y,
- DONT_BOX_WINDOW));
+ struct tui_gen_win_info *execution_info
+ = init_and_make_win (nullptr,
+ EXEC_INFO_WIN,
+ height,
+ 3,
+ 0,
+ origin_y,
+ DONT_BOX_WINDOW);
/* Now create the source window. */
struct tui_source_window_base *result