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