Remove m_has_locator
[deliverable/binutils-gdb.git] / gdb / tui / tui-layout.c
CommitLineData
f377b406 1/* TUI layout window management.
f33c6cbf 2
42a4f53d 3 Copyright (C) 1998-2019 Free Software Foundation, Inc.
f33c6cbf 4
f377b406 5 Contributed by Hewlett-Packard Company.
c906108c 6
f377b406
SC
7 This file is part of GDB.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
a9762ec7 11 the Free Software Foundation; either version 3 of the License, or
f377b406
SC
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
a9762ec7 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
21
22#include "defs.h"
957b8b5a 23#include "arch-utils.h"
c906108c
SS
24#include "command.h"
25#include "symtab.h"
26#include "frame.h"
52575520 27#include "source.h"
84b1e7c7 28#include <ctype.h>
c906108c 29
d7b2e967 30#include "tui/tui.h"
ce38393b 31#include "tui/tui-command.h"
d7b2e967 32#include "tui/tui-data.h"
d7b2e967
AC
33#include "tui/tui-wingeneral.h"
34#include "tui/tui-stack.h"
35#include "tui/tui-regs.h"
36#include "tui/tui-win.h"
37#include "tui/tui-winsource.h"
38#include "tui/tui-disasm.h"
2c0b251b 39#include "tui/tui-layout.h"
bfad4537 40#include "tui/tui-source.h"
6a83354a 41#include "gdb_curses.h"
96ec9981 42
c906108c
SS
43/*******************************
44** Static Local Decls
45********************************/
6ba8e26f 46static void show_layout (enum tui_layout_type);
6ba8e26f 47static void show_source_or_disasm_and_command (enum tui_layout_type);
6ba8e26f
AC
48static void show_source_command (void);
49static void show_disasm_command (void);
50static void show_source_disasm_command (void);
51static void show_data (enum tui_layout_type);
52static enum tui_layout_type next_layout (void);
53static enum tui_layout_type prev_layout (void);
0b39b52e 54static void tui_layout_command (const char *, int);
13274fc3 55static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *);
c906108c
SS
56
57
62cf57fe
TT
58static enum tui_layout_type current_layout = UNDEFINED_LAYOUT;
59
60/* Accessor for the current layout. */
61enum tui_layout_type
62tui_current_layout (void)
63{
64 return current_layout;
65}
66
c906108c
SS
67/***************************************
68** DEFINITIONS
69***************************************/
70
c7037be1
SC
71/* Show the screen layout defined. */
72static void
6ba8e26f 73show_layout (enum tui_layout_type layout)
c906108c 74{
6ba8e26f 75 enum tui_layout_type cur_layout = tui_current_layout ();
c906108c 76
6ba8e26f 77 if (layout != cur_layout)
c906108c 78 {
3f3ffe54 79 tui_make_all_invisible ();
cc0c3ffb 80 switch (layout)
c906108c 81 {
cc0c3ffb
TT
82 case SRC_DATA_COMMAND:
83 case DISASSEM_DATA_COMMAND:
6ba8e26f 84 show_data (layout);
1ce3e844 85 tui_refresh_all ();
cc0c3ffb
TT
86 break;
87 /* Now show the new layout. */
88 case SRC_COMMAND:
89 show_source_command ();
cc0c3ffb
TT
90 break;
91 case DISASSEM_COMMAND:
92 show_disasm_command ();
cc0c3ffb
TT
93 break;
94 case SRC_DISASSEM_COMMAND:
95 show_source_disasm_command ();
cc0c3ffb
TT
96 break;
97 default:
98 break;
c906108c 99 }
fede5273
TT
100
101 tui_delete_invisible_windows ();
c906108c 102 }
bc712bbf 103}
c906108c
SS
104
105
080ce8c0 106/* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
7bd0be3a 107 SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND. */
b7fbad91 108void
7bd0be3a 109tui_set_layout (enum tui_layout_type layout_type)
c906108c 110{
b7fbad91 111 gdb_assert (layout_type != UNDEFINED_LAYOUT);
c906108c 112
b7fbad91
TT
113 enum tui_layout_type cur_layout = tui_current_layout ();
114 struct gdbarch *gdbarch;
115 CORE_ADDR addr;
116 struct tui_win_info *win_with_focus = tui_win_with_focus ();
c906108c 117
b7fbad91 118 extract_display_start_addr (&gdbarch, &addr);
c906108c 119
b7fbad91 120 enum tui_layout_type new_layout = layout_type;
c906108c 121
b7fbad91
TT
122 if (new_layout != cur_layout)
123 {
124 show_layout (new_layout);
ef5eab5a 125
b7fbad91
TT
126 /* Now determine where focus should be. */
127 if (win_with_focus != TUI_CMD_WIN)
128 {
129 switch (new_layout)
7bd0be3a 130 {
b7fbad91
TT
131 case SRC_COMMAND:
132 tui_set_win_focus_to (TUI_SRC_WIN);
b7fbad91
TT
133 break;
134 case DISASSEM_COMMAND:
135 /* The previous layout was not showing code.
136 This can happen if there is no source
137 available:
138
139 1. if the source file is in another dir OR
140 2. if target was compiled without -g
141 We still want to show the assembly though! */
142
143 tui_get_begin_asm_address (&gdbarch, &addr);
144 tui_set_win_focus_to (TUI_DISASM_WIN);
b7fbad91
TT
145 break;
146 case SRC_DISASSEM_COMMAND:
147 /* The previous layout was not showing code.
148 This can happen if there is no source
149 available:
150
151 1. if the source file is in another dir OR
152 2. if target was compiled without -g
153 We still want to show the assembly though! */
154
155 tui_get_begin_asm_address (&gdbarch, &addr);
156 if (win_with_focus == TUI_SRC_WIN)
157 tui_set_win_focus_to (TUI_SRC_WIN);
158 else
159 tui_set_win_focus_to (TUI_DISASM_WIN);
160 break;
161 case SRC_DATA_COMMAND:
162 if (win_with_focus != TUI_DATA_WIN)
163 tui_set_win_focus_to (TUI_SRC_WIN);
164 else
165 tui_set_win_focus_to (TUI_DATA_WIN);
b7fbad91
TT
166 break;
167 case DISASSEM_DATA_COMMAND:
168 /* The previous layout was not showing code.
169 This can happen if there is no source
170 available:
171
172 1. if the source file is in another dir OR
173 2. if target was compiled without -g
174 We still want to show the assembly though! */
175
176 tui_get_begin_asm_address (&gdbarch, &addr);
177 if (win_with_focus != TUI_DATA_WIN)
178 tui_set_win_focus_to (TUI_DISASM_WIN);
179 else
180 tui_set_win_focus_to (TUI_DATA_WIN);
b7fbad91
TT
181 break;
182 default:
183 break;
c906108c 184 }
c906108c 185 }
b7fbad91
TT
186 /*
187 * Now update the window content.
188 */
189 tui_update_source_windows_with_addr (gdbarch, addr);
190 if (new_layout == SRC_DATA_COMMAND
191 || new_layout == DISASSEM_DATA_COMMAND)
192 tui_show_registers (TUI_DATA_WIN->current_group);
c906108c 193 }
bc712bbf 194}
c906108c 195
080ce8c0
AC
196/* Add the specified window to the layout in a logical way. This
197 means setting up the most logical layout given the window to be
198 added. */
c906108c 199void
080ce8c0 200tui_add_win_to_layout (enum tui_win_type type)
c906108c 201{
6ba8e26f 202 enum tui_layout_type cur_layout = tui_current_layout ();
c906108c
SS
203
204 switch (type)
205 {
206 case SRC_WIN:
e5908723
MS
207 if (cur_layout != SRC_COMMAND
208 && cur_layout != SRC_DISASSEM_COMMAND
209 && cur_layout != SRC_DATA_COMMAND)
c906108c 210 {
dd1abb8c 211 tui_clear_source_windows_detail ();
6ba8e26f
AC
212 if (cur_layout == DISASSEM_DATA_COMMAND)
213 show_layout (SRC_DATA_COMMAND);
c906108c 214 else
6ba8e26f 215 show_layout (SRC_COMMAND);
c906108c
SS
216 }
217 break;
218 case DISASSEM_WIN:
e5908723
MS
219 if (cur_layout != DISASSEM_COMMAND
220 && cur_layout != SRC_DISASSEM_COMMAND
221 && cur_layout != DISASSEM_DATA_COMMAND)
c906108c 222 {
dd1abb8c 223 tui_clear_source_windows_detail ();
6ba8e26f
AC
224 if (cur_layout == SRC_DATA_COMMAND)
225 show_layout (DISASSEM_DATA_COMMAND);
c906108c 226 else
6ba8e26f 227 show_layout (DISASSEM_COMMAND);
c906108c
SS
228 }
229 break;
230 case DATA_WIN:
e5908723
MS
231 if (cur_layout != SRC_DATA_COMMAND
232 && cur_layout != DISASSEM_DATA_COMMAND)
c906108c 233 {
6ba8e26f
AC
234 if (cur_layout == DISASSEM_COMMAND)
235 show_layout (DISASSEM_DATA_COMMAND);
c906108c 236 else
6ba8e26f 237 show_layout (SRC_DATA_COMMAND);
c906108c
SS
238 }
239 break;
240 default:
241 break;
242 }
6ba8e26f 243}
c906108c
SS
244
245
6ba8e26f
AC
246/* Answer the height of a window. If it hasn't been created yet,
247 answer what the height of a window would be based upon its type and
248 the layout. */
16cb7910 249static int
08ef48c5
MS
250tui_default_win_height (enum tui_win_type type,
251 enum tui_layout_type layout)
c906108c
SS
252{
253 int h;
254
cafb3438 255 if (tui_win_list[type] != NULL)
cb2ce893 256 h = tui_win_list[type]->height;
c906108c
SS
257 else
258 {
259 switch (layout)
260 {
261 case SRC_COMMAND:
262 case DISASSEM_COMMAND:
6d012f14 263 if (TUI_CMD_WIN == NULL)
dd1abb8c 264 h = tui_term_height () / 2;
c906108c 265 else
cb2ce893 266 h = tui_term_height () - TUI_CMD_WIN->height;
c906108c
SS
267 break;
268 case SRC_DISASSEM_COMMAND:
269 case SRC_DATA_COMMAND:
270 case DISASSEM_DATA_COMMAND:
6d012f14 271 if (TUI_CMD_WIN == NULL)
dd1abb8c 272 h = tui_term_height () / 3;
c906108c 273 else
cb2ce893 274 h = (tui_term_height () - TUI_CMD_WIN->height) / 2;
c906108c
SS
275 break;
276 default:
277 h = 0;
278 break;
279 }
280 }
281
282 return h;
6ba8e26f 283}
c906108c
SS
284
285
080ce8c0
AC
286/* Answer the height of a window. If it hasn't been created yet,
287 answer what the height of a window would be based upon its type and
288 the layout. */
c906108c 289int
080ce8c0
AC
290tui_default_win_viewport_height (enum tui_win_type type,
291 enum tui_layout_type layout)
c906108c
SS
292{
293 int h;
294
6ba8e26f 295 h = tui_default_win_height (type, layout);
c906108c 296
f4ce562c 297 if (type == CMD_WIN)
c906108c
SS
298 h -= 1;
299 else
300 h -= 2;
301
302 return h;
6ba8e26f 303}
c906108c 304
a0145030
AB
305/* Complete possible layout names. TEXT is the complete text entered so
306 far, WORD is the word currently being completed. */
307
eb3ff9a5 308static void
a0145030 309layout_completer (struct cmd_list_element *ignore,
eb3ff9a5 310 completion_tracker &tracker,
a0145030
AB
311 const char *text, const char *word)
312{
313 static const char *layout_names [] =
314 { "src", "asm", "split", "regs", "next", "prev", NULL };
315
eb3ff9a5 316 complete_on_enum (tracker, layout_names, text, word);
a0145030
AB
317}
318
6ba8e26f
AC
319/* Function to initialize gdb commands, for tui window layout
320 manipulation. */
2c0b251b 321
c906108c 322void
6ba8e26f 323_initialize_tui_layout (void)
c906108c 324{
a0145030
AB
325 struct cmd_list_element *cmd;
326
327 cmd = add_com ("layout", class_tui, tui_layout_command, _("\
1bedd215 328Change the layout of windows.\n\
bf212be1 329Usage: layout prev | next | LAYOUT-NAME\n\
c906108c
SS
330Layout names are:\n\
331 src : Displays source and command windows.\n\
332 asm : Displays disassembly and command windows.\n\
333 split : Displays source, disassembly and command windows.\n\
334 regs : Displays register window. If existing layout\n\
335 is source/command or assembly/command, the \n\
336 register window is displayed. If the\n\
337 source/assembly/command (split) is displayed, \n\
338 the register window is displayed with \n\
89549d7f 339 the window that has current logical focus."));
a0145030 340 set_cmd_completer (cmd, layout_completer);
41783295 341}
c906108c
SS
342
343
344/*************************
345** STATIC LOCAL FUNCTIONS
346**************************/
347
348
7bd0be3a
AB
349/* Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, or
350 REGS. */
0379b883
TT
351static void
352tui_layout_command (const char *layout_name, int from_tty)
c906108c 353{
0379b883
TT
354 int i;
355 enum tui_layout_type new_layout = UNDEFINED_LAYOUT;
356 enum tui_layout_type cur_layout = tui_current_layout ();
c906108c 357
0379b883
TT
358 if (layout_name == NULL)
359 error (_("Usage: layout prev | next | LAYOUT-NAME"));
c906108c 360
0379b883
TT
361 std::string copy = layout_name;
362 for (i = 0; i < copy.size (); i++)
363 copy[i] = toupper (copy[i]);
364 const char *buf_ptr = copy.c_str ();
c906108c 365
0379b883
TT
366 /* First check for ambiguous input. */
367 if (strlen (buf_ptr) <= 1 && *buf_ptr == 'S')
368 error (_("Ambiguous command input."));
c906108c 369
0379b883
TT
370 if (subset_compare (buf_ptr, "SRC"))
371 new_layout = SRC_COMMAND;
372 else if (subset_compare (buf_ptr, "ASM"))
373 new_layout = DISASSEM_COMMAND;
374 else if (subset_compare (buf_ptr, "SPLIT"))
375 new_layout = SRC_DISASSEM_COMMAND;
376 else if (subset_compare (buf_ptr, "REGS"))
377 {
378 if (cur_layout == SRC_COMMAND
379 || cur_layout == SRC_DATA_COMMAND)
380 new_layout = SRC_DATA_COMMAND;
381 else
382 new_layout = DISASSEM_DATA_COMMAND;
c906108c 383 }
0379b883
TT
384 else if (subset_compare (buf_ptr, "NEXT"))
385 new_layout = next_layout ();
386 else if (subset_compare (buf_ptr, "PREV"))
387 new_layout = prev_layout ();
c906108c 388 else
0379b883 389 error (_("Unrecognized layout: %s"), layout_name);
c906108c 390
0379b883
TT
391 /* Make sure the curses mode is enabled. */
392 tui_enable ();
393 tui_set_layout (new_layout);
e8b915dc 394}
c906108c
SS
395
396
13274fc3
UW
397static void
398extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
c906108c 399{
6ba8e26f 400 enum tui_layout_type cur_layout = tui_current_layout ();
957b8b5a 401 struct gdbarch *gdbarch = get_current_arch ();
c774cec6 402 CORE_ADDR addr;
84b1e7c7 403 CORE_ADDR pc;
52575520 404 struct symtab_and_line cursal = get_current_source_symtab_and_line ();
c906108c 405
6ba8e26f 406 switch (cur_layout)
c906108c
SS
407 {
408 case SRC_COMMAND:
409 case SRC_DATA_COMMAND:
e6e41501 410 gdbarch = TUI_SRC_WIN->gdbarch;
52575520 411 find_line_pc (cursal.symtab,
e6e41501 412 TUI_SRC_WIN->start_line_or_addr.u.line_no,
84b1e7c7 413 &pc);
c774cec6 414 addr = pc;
c906108c
SS
415 break;
416 case DISASSEM_COMMAND:
417 case SRC_DISASSEM_COMMAND:
418 case DISASSEM_DATA_COMMAND:
e6e41501
TT
419 gdbarch = TUI_DISASM_WIN->gdbarch;
420 addr = TUI_DISASM_WIN->start_line_or_addr.u.addr;
c906108c
SS
421 break;
422 default:
c774cec6 423 addr = 0;
c906108c
SS
424 break;
425 }
426
13274fc3
UW
427 *gdbarch_p = gdbarch;
428 *addr_p = addr;
6ba8e26f 429}
c906108c
SS
430
431
6ba8e26f 432/* Answer the previous layout to cycle to. */
2a8854a7 433static enum tui_layout_type
6ba8e26f 434next_layout (void)
c906108c 435{
570dc176 436 int new_layout;
c906108c 437
6ba8e26f
AC
438 new_layout = tui_current_layout ();
439 if (new_layout == UNDEFINED_LAYOUT)
440 new_layout = SRC_COMMAND;
c906108c
SS
441 else
442 {
6ba8e26f
AC
443 new_layout++;
444 if (new_layout == UNDEFINED_LAYOUT)
445 new_layout = SRC_COMMAND;
c906108c
SS
446 }
447
570dc176 448 return (enum tui_layout_type) new_layout;
6ba8e26f 449}
c906108c
SS
450
451
6ba8e26f 452/* Answer the next layout to cycle to. */
2a8854a7 453static enum tui_layout_type
6ba8e26f 454prev_layout (void)
c906108c 455{
570dc176 456 int new_layout;
c906108c 457
6ba8e26f
AC
458 new_layout = tui_current_layout ();
459 if (new_layout == SRC_COMMAND)
460 new_layout = DISASSEM_DATA_COMMAND;
c906108c
SS
461 else
462 {
6ba8e26f
AC
463 new_layout--;
464 if (new_layout == UNDEFINED_LAYOUT)
465 new_layout = DISASSEM_DATA_COMMAND;
c906108c
SS
466 }
467
570dc176 468 return (enum tui_layout_type) new_layout;
6ba8e26f 469}
c906108c 470
6ba8e26f 471/* Show the Source/Command layout. */
c906108c 472static void
6ba8e26f 473show_source_command (void)
c906108c 474{
6ba8e26f
AC
475 show_source_or_disasm_and_command (SRC_COMMAND);
476}
c906108c
SS
477
478
6ba8e26f 479/* Show the Dissassem/Command layout. */
c906108c 480static void
6ba8e26f 481show_disasm_command (void)
c906108c 482{
6ba8e26f
AC
483 show_source_or_disasm_and_command (DISASSEM_COMMAND);
484}
c906108c
SS
485
486
6ba8e26f 487/* Show the Source/Disassem/Command layout. */
c906108c 488static void
6ba8e26f 489show_source_disasm_command (void)
c906108c 490{
cc0c3ffb 491 int cmd_height, src_height, asm_height;
c906108c 492
cc0c3ffb
TT
493 if (TUI_CMD_WIN != NULL)
494 cmd_height = TUI_CMD_WIN->height;
495 else
496 cmd_height = tui_term_height () / 3;
c906108c 497
cc0c3ffb
TT
498 src_height = (tui_term_height () - cmd_height) / 2;
499 asm_height = tui_term_height () - (src_height + cmd_height);
c906108c 500
cc0c3ffb
TT
501 if (TUI_SRC_WIN == NULL)
502 tui_win_list[SRC_WIN] = new tui_source_window ();
ee556432
TT
503 TUI_SRC_WIN->resize (src_height,
504 tui_term_width (),
505 0,
506 0);
cc0c3ffb
TT
507
508 struct tui_locator_window *locator = tui_locator_win_info_ptr ();
509 gdb_assert (locator != nullptr);
510
0bd27e07 511 TUI_SRC_WIN->show_source_content ();
cc0c3ffb
TT
512 if (TUI_DISASM_WIN == NULL)
513 tui_win_list[DISASSEM_WIN] = new tui_disasm_window ();
ee556432
TT
514 TUI_DISASM_WIN->resize (asm_height,
515 tui_term_width (),
516 0,
517 src_height - 1);
ee556432
TT
518 locator->resize (2 /* 1 */ ,
519 tui_term_width (),
520 0,
521 (src_height + asm_height) - 1);
0bd27e07 522 TUI_DISASM_WIN->show_source_content ();
cc0c3ffb
TT
523
524 if (TUI_CMD_WIN == NULL)
525 tui_win_list[CMD_WIN] = new tui_cmd_window ();
ee556432
TT
526 TUI_CMD_WIN->resize (cmd_height,
527 tui_term_width (),
528 0,
529 tui_term_height () - cmd_height);
cc0c3ffb 530 current_layout = SRC_DISASSEM_COMMAND;
6ba8e26f 531}
c906108c
SS
532
533
6ba8e26f
AC
534/* Show the Source/Data/Command or the Dissassembly/Data/Command
535 layout. */
c906108c 536static void
6ba8e26f 537show_data (enum tui_layout_type new_layout)
c906108c 538{
cb2ce893 539 int total_height = (tui_term_height () - TUI_CMD_WIN->height);
6ba8e26f
AC
540 int src_height, data_height;
541 enum tui_win_type win_type;
c906108c 542
3add462f
TT
543 struct tui_locator_window *locator = tui_locator_win_info_ptr ();
544 gdb_assert (locator != nullptr);
c906108c 545
6ba8e26f
AC
546 data_height = total_height / 2;
547 src_height = total_height - data_height;
098f9ed4 548 if (tui_win_list[DATA_WIN] == nullptr)
09129226 549 tui_win_list[DATA_WIN] = new tui_data_window ();
ee556432 550 tui_win_list[DATA_WIN]->resize (data_height, tui_term_width (), 0, 0);
098f9ed4 551
6ba8e26f
AC
552 if (new_layout == SRC_DATA_COMMAND)
553 win_type = SRC_WIN;
c906108c 554 else
6ba8e26f 555 win_type = DISASSEM_WIN;
e6e41501 556
6ba8e26f 557 if (tui_win_list[win_type] == NULL)
c906108c 558 {
6ba8e26f 559 if (win_type == SRC_WIN)
4a8a5e84 560 tui_win_list[win_type] = new tui_source_window ();
c906108c 561 else
4a8a5e84 562 tui_win_list[win_type] = new tui_disasm_window ();
c906108c 563 }
4a8a5e84 564
ee556432
TT
565 tui_win_list[win_type]->resize (src_height,
566 tui_term_width (),
567 0,
568 data_height - 1);
569 locator->resize (2 /* 1 */ ,
570 tui_term_width (),
571 0,
572 total_height - 1);
db502012
TT
573 TUI_CMD_WIN->resize (TUI_CMD_WIN->height, tui_term_width (),
574 0, total_height);
575
62cf57fe 576 current_layout = new_layout;
6ba8e26f 577}
c906108c 578
d6ba6a11 579void
ee556432
TT
580tui_gen_win_info::resize (int height_, int width_,
581 int origin_x_, int origin_y_)
c906108c 582{
d6ba6a11 583 width = width_;
db502012
TT
584 height = height_;
585 if (height > 1)
586 viewport_height = height - 2;
c906108c 587 else
d6ba6a11
TT
588 viewport_height = 1;
589 origin.x = origin_x_;
590 origin.y = origin_y_;
db502012
TT
591
592 if (handle != nullptr)
593 {
594#ifdef HAVE_WRESIZE
595 wresize (handle, height, width);
596 mvwin (handle, origin.y, origin.x);
597 wmove (handle, 0, 0);
598#else
599 tui_delete_win (handle);
600 handle = NULL;
601#endif
602 }
603
604 if (handle == nullptr)
605 tui_make_window (this);
3df505f6
TT
606
607 rerender ();
d6ba6a11 608}
c906108c 609
1cc6d956 610/* Show the Source/Command or the Disassem layout. */
c906108c 611static void
6ba8e26f 612show_source_or_disasm_and_command (enum tui_layout_type layout_type)
c906108c 613{
cc0c3ffb
TT
614 struct tui_source_window_base *win_info;
615 int src_height, cmd_height;
616 struct tui_locator_window *locator = tui_locator_win_info_ptr ();
617 gdb_assert (locator != nullptr);
618
619 if (TUI_CMD_WIN != NULL)
620 cmd_height = TUI_CMD_WIN->height;
621 else
622 cmd_height = tui_term_height () / 3;
623 src_height = tui_term_height () - cmd_height;
624
625 if (layout_type == SRC_COMMAND)
c906108c 626 {
cc0c3ffb
TT
627 if (tui_win_list[SRC_WIN] == nullptr)
628 tui_win_list[SRC_WIN] = new tui_source_window ();
629 win_info = TUI_SRC_WIN;
630 }
631 else
632 {
633 if (tui_win_list[DISASSEM_WIN] == nullptr)
634 tui_win_list[DISASSEM_WIN] = new tui_disasm_window ();
635 win_info = TUI_DISASM_WIN;
636 }
c906108c 637
ee556432 638 locator->resize (2 /* 1 */ ,
cc0c3ffb
TT
639 tui_term_width (),
640 0,
ee556432
TT
641 src_height - 1);
642 win_info->resize (src_height - 1,
643 tui_term_width (),
644 0,
645 0);
c906108c 646
0bd27e07 647 win_info->show_source_content ();
cc0c3ffb
TT
648
649 if (TUI_CMD_WIN == NULL)
650 tui_win_list[CMD_WIN] = new tui_cmd_window ();
ee556432
TT
651 TUI_CMD_WIN->resize (cmd_height,
652 tui_term_width (),
653 0,
654 src_height);
cc0c3ffb 655 current_layout = layout_type;
6ba8e26f 656}
This page took 2.055756 seconds and 4 git commands to generate.