* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
/* TUI layout window management.
|
2002-03-01 06:19:28 +00:00
|
|
|
|
2004-01-19 16:06:04 +00:00
|
|
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
|
|
|
|
Foundation, Inc.
|
2002-03-01 06:19:28 +00:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
Contributed by Hewlett-Packard Company.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 19:01:25 +00:00
|
|
|
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 2 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, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "command.h"
|
|
|
|
#include "symtab.h"
|
|
|
|
#include "frame.h"
|
2002-09-30 00:52:27 +00:00
|
|
|
#include "source.h"
|
2001-07-17 22:22:40 +00:00
|
|
|
#include <ctype.h>
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-19 04:31:53 +00:00
|
|
|
#include "tui/tui.h"
|
|
|
|
#include "tui/tui-data.h"
|
|
|
|
#include "tui/tui-windata.h"
|
|
|
|
#include "tui/tui-wingeneral.h"
|
|
|
|
#include "tui/tui-stack.h"
|
|
|
|
#include "tui/tui-regs.h"
|
|
|
|
#include "tui/tui-win.h"
|
|
|
|
#include "tui/tui-winsource.h"
|
|
|
|
#include "tui/tui-disasm.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2003-06-22 15:21:39 +00:00
|
|
|
#ifdef HAVE_NCURSES_H
|
|
|
|
#include <ncurses.h>
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_CURSES_H
|
|
|
|
#include <curses.h>
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
1999-04-16 01:35:26 +00:00
|
|
|
/*******************************
|
|
|
|
** Static Local Decls
|
|
|
|
********************************/
|
2002-08-24 15:25:25 +00:00
|
|
|
static void showLayout (TuiLayoutType);
|
2000-06-20 07:13:39 +00:00
|
|
|
static void _initGenWinInfo (TuiGenWinInfoPtr, TuiWinType, int, int, int, int);
|
|
|
|
static void _initAndMakeWin (Opaque *, TuiWinType, int, int, int, int, int);
|
|
|
|
static void _showSourceOrDisassemAndCommand (TuiLayoutType);
|
|
|
|
static void _makeSourceOrDisassemWindow (TuiWinInfoPtr *, TuiWinType, int, int);
|
2000-05-28 01:12:42 +00:00
|
|
|
static void _makeCommandWindow (TuiWinInfoPtr *, int, int);
|
|
|
|
static void _makeSourceWindow (TuiWinInfoPtr *, int, int);
|
2000-06-20 07:13:39 +00:00
|
|
|
static void _makeDisassemWindow (TuiWinInfoPtr *, int, int);
|
2000-05-28 01:12:42 +00:00
|
|
|
static void _makeDataWindow (TuiWinInfoPtr *, int, int);
|
|
|
|
static void _showSourceCommand (void);
|
|
|
|
static void _showDisassemCommand (void);
|
|
|
|
static void _showSourceDisassemCommand (void);
|
|
|
|
static void _showData (TuiLayoutType);
|
|
|
|
static TuiLayoutType _nextLayout (void);
|
|
|
|
static TuiLayoutType _prevLayout (void);
|
|
|
|
static void _tuiLayout_command (char *, int);
|
|
|
|
static void _tuiToggleLayout_command (char *, int);
|
|
|
|
static void _tuiToggleSplitLayout_command (char *, int);
|
2001-07-18 20:59:00 +00:00
|
|
|
static CORE_ADDR _extractDisplayStartAddr (void);
|
2000-05-28 01:12:42 +00:00
|
|
|
static void _tuiHandleXDBLayout (TuiLayoutDefPtr);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***************************************
|
|
|
|
** DEFINITIONS
|
|
|
|
***************************************/
|
|
|
|
|
|
|
|
#define LAYOUT_USAGE "Usage: layout prev | next | <layout_name> \n"
|
|
|
|
|
2002-08-24 15:25:25 +00:00
|
|
|
/* Show the screen layout defined. */
|
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
showLayout (TuiLayoutType layout)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiLayoutType curLayout = currentLayout ();
|
|
|
|
|
|
|
|
if (layout != curLayout)
|
|
|
|
{
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Since the new layout may cause changes in window size, we
|
|
|
|
** should free the content and reallocate on next display of
|
|
|
|
** source/asm
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
freeAllSourceWinsContent ();
|
|
|
|
clearSourceWindows ();
|
|
|
|
if (layout == SRC_DATA_COMMAND || layout == DISASSEM_DATA_COMMAND)
|
|
|
|
{
|
|
|
|
_showData (layout);
|
|
|
|
refreshAll (winList);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* First make the current layout be invisible */
|
|
|
|
m_allBeInvisible ();
|
|
|
|
m_beInvisible (locatorWinInfoPtr ());
|
|
|
|
|
|
|
|
switch (layout)
|
|
|
|
{
|
|
|
|
/* Now show the new layout */
|
|
|
|
case SRC_COMMAND:
|
|
|
|
_showSourceCommand ();
|
|
|
|
addToSourceWindows (srcWin);
|
|
|
|
break;
|
|
|
|
case DISASSEM_COMMAND:
|
|
|
|
_showDisassemCommand ();
|
|
|
|
addToSourceWindows (disassemWin);
|
|
|
|
break;
|
|
|
|
case SRC_DISASSEM_COMMAND:
|
|
|
|
_showSourceDisassemCommand ();
|
|
|
|
addToSourceWindows (srcWin);
|
|
|
|
addToSourceWindows (disassemWin);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-08-24 12:28:33 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
2004-01-23 23:25:17 +00:00
|
|
|
/* Function to set the layout to SRC_COMMAND, DISASSEM_COMMAND,
|
|
|
|
SRC_DISASSEM_COMMAND, SRC_DATA_COMMAND, or DISASSEM_DATA_COMMAND.
|
|
|
|
If the layout is SRC_DATA_COMMAND, DISASSEM_DATA_COMMAND, or
|
|
|
|
UNDEFINED_LAYOUT, then the data window is populated according to
|
|
|
|
regsDisplayType. */
|
|
|
|
enum tui_status
|
|
|
|
tui_set_layout (enum tui_layout_type layoutType,
|
|
|
|
enum tui_register_display_type regsDisplayType)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiStatus status = TUI_SUCCESS;
|
|
|
|
|
|
|
|
if (layoutType != UNDEFINED_LAYOUT || regsDisplayType != TUI_UNDEFINED_REGS)
|
|
|
|
{
|
|
|
|
TuiLayoutType curLayout = currentLayout (), newLayout = UNDEFINED_LAYOUT;
|
|
|
|
int regsPopulate = FALSE;
|
2001-07-18 20:59:00 +00:00
|
|
|
CORE_ADDR addr = _extractDisplayStartAddr ();
|
1999-04-16 01:35:26 +00:00
|
|
|
TuiWinInfoPtr newWinWithFocus = (TuiWinInfoPtr) NULL, winWithFocus = tuiWinWithFocus ();
|
|
|
|
TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
|
|
|
|
|
|
|
|
|
|
|
|
if (layoutType == UNDEFINED_LAYOUT &&
|
|
|
|
regsDisplayType != TUI_UNDEFINED_REGS)
|
|
|
|
{
|
|
|
|
if (curLayout == SRC_DISASSEM_COMMAND)
|
|
|
|
newLayout = DISASSEM_DATA_COMMAND;
|
|
|
|
else if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
|
|
|
|
newLayout = SRC_DATA_COMMAND;
|
|
|
|
else if (curLayout == DISASSEM_COMMAND ||
|
|
|
|
curLayout == DISASSEM_DATA_COMMAND)
|
|
|
|
newLayout = DISASSEM_DATA_COMMAND;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
newLayout = layoutType;
|
|
|
|
|
|
|
|
regsPopulate = (newLayout == SRC_DATA_COMMAND ||
|
|
|
|
newLayout == DISASSEM_DATA_COMMAND ||
|
|
|
|
regsDisplayType != TUI_UNDEFINED_REGS);
|
|
|
|
if (newLayout != curLayout || regsDisplayType != TUI_UNDEFINED_REGS)
|
|
|
|
{
|
|
|
|
if (newLayout != curLayout)
|
|
|
|
{
|
|
|
|
showLayout (newLayout);
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Now determine where focus should be
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
if (winWithFocus != cmdWin)
|
|
|
|
{
|
|
|
|
switch (newLayout)
|
|
|
|
{
|
|
|
|
case SRC_COMMAND:
|
|
|
|
tuiSetWinFocusTo (srcWin);
|
|
|
|
layoutDef->displayMode = SRC_WIN;
|
|
|
|
layoutDef->split = FALSE;
|
|
|
|
break;
|
|
|
|
case DISASSEM_COMMAND:
|
|
|
|
/* the previous layout was not showing
|
1999-07-07 20:19:36 +00:00
|
|
|
** code. this can happen if there is no
|
|
|
|
** source available:
|
|
|
|
** 1. if the source file is in another dir OR
|
|
|
|
** 2. if target was compiled without -g
|
|
|
|
** We still want to show the assembly though!
|
|
|
|
*/
|
2004-01-20 21:56:22 +00:00
|
|
|
addr = tui_get_begin_asm_address ();
|
1999-04-16 01:35:26 +00:00
|
|
|
tuiSetWinFocusTo (disassemWin);
|
|
|
|
layoutDef->displayMode = DISASSEM_WIN;
|
|
|
|
layoutDef->split = FALSE;
|
|
|
|
break;
|
|
|
|
case SRC_DISASSEM_COMMAND:
|
|
|
|
/* the previous layout was not showing
|
1999-07-07 20:19:36 +00:00
|
|
|
** code. this can happen if there is no
|
|
|
|
** source available:
|
|
|
|
** 1. if the source file is in another dir OR
|
|
|
|
** 2. if target was compiled without -g
|
|
|
|
** We still want to show the assembly though!
|
|
|
|
*/
|
2004-01-20 21:56:22 +00:00
|
|
|
addr = tui_get_begin_asm_address ();
|
1999-04-16 01:35:26 +00:00
|
|
|
if (winWithFocus == srcWin)
|
|
|
|
tuiSetWinFocusTo (srcWin);
|
|
|
|
else
|
|
|
|
tuiSetWinFocusTo (disassemWin);
|
|
|
|
layoutDef->split = TRUE;
|
|
|
|
break;
|
|
|
|
case SRC_DATA_COMMAND:
|
|
|
|
if (winWithFocus != dataWin)
|
|
|
|
tuiSetWinFocusTo (srcWin);
|
|
|
|
else
|
|
|
|
tuiSetWinFocusTo (dataWin);
|
|
|
|
layoutDef->displayMode = SRC_WIN;
|
|
|
|
layoutDef->split = FALSE;
|
|
|
|
break;
|
|
|
|
case DISASSEM_DATA_COMMAND:
|
|
|
|
/* the previous layout was not showing
|
1999-07-07 20:19:36 +00:00
|
|
|
** code. this can happen if there is no
|
|
|
|
** source available:
|
|
|
|
** 1. if the source file is in another dir OR
|
|
|
|
** 2. if target was compiled without -g
|
|
|
|
** We still want to show the assembly though!
|
|
|
|
*/
|
2004-01-20 21:56:22 +00:00
|
|
|
addr = tui_get_begin_asm_address ();
|
1999-04-16 01:35:26 +00:00
|
|
|
if (winWithFocus != dataWin)
|
|
|
|
tuiSetWinFocusTo (disassemWin);
|
|
|
|
else
|
|
|
|
tuiSetWinFocusTo (dataWin);
|
|
|
|
layoutDef->displayMode = DISASSEM_WIN;
|
|
|
|
layoutDef->split = FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (newWinWithFocus != (TuiWinInfoPtr) NULL)
|
|
|
|
tuiSetWinFocusTo (newWinWithFocus);
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Now update the window content
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
if (!regsPopulate &&
|
|
|
|
(newLayout == SRC_DATA_COMMAND ||
|
|
|
|
newLayout == DISASSEM_DATA_COMMAND))
|
|
|
|
tuiDisplayAllData ();
|
|
|
|
|
|
|
|
tuiUpdateSourceWindowsWithAddr (addr);
|
|
|
|
}
|
|
|
|
if (regsPopulate)
|
|
|
|
{
|
|
|
|
layoutDef->regsDisplayType =
|
|
|
|
(regsDisplayType == TUI_UNDEFINED_REGS ?
|
|
|
|
TUI_GENERAL_REGS : regsDisplayType);
|
2004-01-19 16:06:04 +00:00
|
|
|
tui_show_registers (layoutDef->regsDisplayType);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status = TUI_FAILURE;
|
|
|
|
|
|
|
|
return status;
|
2002-08-24 12:28:33 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-23 23:25:17 +00:00
|
|
|
/* Add the specified window to the layout in a logical way. This
|
|
|
|
means setting up the most logical layout given the window to be
|
|
|
|
added. */
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_add_win_to_layout (enum tui_win_type type)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiLayoutType curLayout = currentLayout ();
|
|
|
|
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case SRC_WIN:
|
|
|
|
if (curLayout != SRC_COMMAND &&
|
|
|
|
curLayout != SRC_DISASSEM_COMMAND &&
|
|
|
|
curLayout != SRC_DATA_COMMAND)
|
|
|
|
{
|
|
|
|
clearSourceWindowsDetail ();
|
|
|
|
if (curLayout == DISASSEM_DATA_COMMAND)
|
|
|
|
showLayout (SRC_DATA_COMMAND);
|
|
|
|
else
|
|
|
|
showLayout (SRC_COMMAND);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DISASSEM_WIN:
|
|
|
|
if (curLayout != DISASSEM_COMMAND &&
|
|
|
|
curLayout != SRC_DISASSEM_COMMAND &&
|
|
|
|
curLayout != DISASSEM_DATA_COMMAND)
|
|
|
|
{
|
|
|
|
clearSourceWindowsDetail ();
|
|
|
|
if (curLayout == SRC_DATA_COMMAND)
|
|
|
|
showLayout (DISASSEM_DATA_COMMAND);
|
|
|
|
else
|
|
|
|
showLayout (DISASSEM_COMMAND);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DATA_WIN:
|
|
|
|
if (curLayout != SRC_DATA_COMMAND &&
|
|
|
|
curLayout != DISASSEM_DATA_COMMAND)
|
|
|
|
{
|
|
|
|
if (curLayout == DISASSEM_COMMAND)
|
|
|
|
showLayout (DISASSEM_DATA_COMMAND);
|
|
|
|
else
|
|
|
|
showLayout (SRC_DATA_COMMAND);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* tuiAddWinToLayout */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** tuiDefaultWinHeight().
|
|
|
|
** Answer the height of a window. If it hasn't been created yet,
|
|
|
|
** answer what the height of a window would be based upon its
|
|
|
|
** type and the layout.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
2001-07-14 19:31:09 +00:00
|
|
|
tuiDefaultWinHeight (TuiWinType type, TuiLayoutType layout)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int h;
|
|
|
|
|
|
|
|
if (winList[type] != (TuiWinInfoPtr) NULL)
|
|
|
|
h = winList[type]->generic.height;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (layout)
|
|
|
|
{
|
|
|
|
case SRC_COMMAND:
|
|
|
|
case DISASSEM_COMMAND:
|
|
|
|
if (m_winPtrIsNull (cmdWin))
|
|
|
|
h = termHeight () / 2;
|
|
|
|
else
|
|
|
|
h = termHeight () - cmdWin->generic.height;
|
|
|
|
break;
|
|
|
|
case SRC_DISASSEM_COMMAND:
|
|
|
|
case SRC_DATA_COMMAND:
|
|
|
|
case DISASSEM_DATA_COMMAND:
|
|
|
|
if (m_winPtrIsNull (cmdWin))
|
|
|
|
h = termHeight () / 3;
|
|
|
|
else
|
|
|
|
h = (termHeight () - cmdWin->generic.height) / 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
h = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return h;
|
|
|
|
} /* tuiDefaultWinHeight */
|
|
|
|
|
|
|
|
|
2004-01-23 23:25:17 +00:00
|
|
|
/* Answer the height of a window. If it hasn't been created yet,
|
|
|
|
answer what the height of a window would be based upon its type and
|
|
|
|
the layout. */
|
1999-04-16 01:35:26 +00:00
|
|
|
int
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_default_win_viewport_height (enum tui_win_type type,
|
|
|
|
enum tui_layout_type layout)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int h;
|
|
|
|
|
|
|
|
h = tuiDefaultWinHeight (type, layout);
|
|
|
|
|
|
|
|
if (winList[type] == cmdWin)
|
|
|
|
h -= 1;
|
|
|
|
else
|
|
|
|
h -= 2;
|
|
|
|
|
|
|
|
return h;
|
|
|
|
} /* tuiDefaultWinViewportHeight */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _initialize_tuiLayout().
|
|
|
|
** Function to initialize gdb commands, for tui window layout
|
|
|
|
** manipulation.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
void
|
2000-07-30 01:48:28 +00:00
|
|
|
_initialize_tuiLayout (void)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-19 22:47:46 +00:00
|
|
|
add_com ("layout", class_tui, _tuiLayout_command,
|
|
|
|
"Change the layout of windows.\n\
|
1999-04-16 01:35:26 +00:00
|
|
|
Usage: layout prev | next | <layout_name> \n\
|
|
|
|
Layout names are:\n\
|
|
|
|
src : Displays source and command windows.\n\
|
|
|
|
asm : Displays disassembly and command windows.\n\
|
|
|
|
split : Displays source, disassembly and command windows.\n\
|
|
|
|
regs : Displays register window. If existing layout\n\
|
|
|
|
is source/command or assembly/command, the \n\
|
|
|
|
register window is displayed. If the\n\
|
|
|
|
source/assembly/command (split) is displayed, \n\
|
|
|
|
the register window is displayed with \n\
|
|
|
|
the window that has current logical focus.\n");
|
2001-07-19 22:47:46 +00:00
|
|
|
if (xdb_commands)
|
|
|
|
{
|
|
|
|
add_com ("td", class_tui, _tuiToggleLayout_command,
|
|
|
|
"Toggle between Source/Command and Disassembly/Command layouts.\n");
|
|
|
|
add_com ("ts", class_tui, _tuiToggleSplitLayout_command,
|
|
|
|
"Toggle between Source/Command or Disassembly/Command and \n\
|
1999-04-16 01:35:26 +00:00
|
|
|
Source/Disassembly/Command layouts.\n");
|
|
|
|
}
|
2001-07-19 22:47:46 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************************
|
|
|
|
** STATIC LOCAL FUNCTIONS
|
|
|
|
**************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _tuiSetLayoutTo()
|
|
|
|
** Function to set the layout to SRC, ASM, SPLIT, NEXT, PREV, DATA, REGS,
|
|
|
|
** $REGS, $GREGS, $FREGS, $SREGS.
|
|
|
|
*/
|
2001-07-18 22:03:22 +00:00
|
|
|
TuiStatus
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_set_layout_for_display_command (const char *layoutName)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiStatus status = TUI_SUCCESS;
|
|
|
|
|
|
|
|
if (layoutName != (char *) NULL)
|
|
|
|
{
|
|
|
|
register int i;
|
|
|
|
register char *bufPtr;
|
|
|
|
TuiLayoutType newLayout = UNDEFINED_LAYOUT;
|
|
|
|
TuiRegisterDisplayType dpyType = TUI_UNDEFINED_REGS;
|
|
|
|
TuiLayoutType curLayout = currentLayout ();
|
|
|
|
|
2001-07-20 22:26:54 +00:00
|
|
|
bufPtr = (char *) xstrdup (layoutName);
|
1999-04-16 01:35:26 +00:00
|
|
|
for (i = 0; (i < strlen (layoutName)); i++)
|
|
|
|
bufPtr[i] = toupper (bufPtr[i]);
|
|
|
|
|
|
|
|
/* First check for ambiguous input */
|
|
|
|
if (strlen (bufPtr) <= 1 && (*bufPtr == 'S' || *bufPtr == '$'))
|
|
|
|
{
|
|
|
|
warning ("Ambiguous command input.\n");
|
|
|
|
status = TUI_FAILURE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-17 21:37:18 +00:00
|
|
|
if (subset_compare (bufPtr, "SRC"))
|
1999-04-16 01:35:26 +00:00
|
|
|
newLayout = SRC_COMMAND;
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, "ASM"))
|
1999-04-16 01:35:26 +00:00
|
|
|
newLayout = DISASSEM_COMMAND;
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, "SPLIT"))
|
1999-04-16 01:35:26 +00:00
|
|
|
newLayout = SRC_DISASSEM_COMMAND;
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, "REGS") ||
|
|
|
|
subset_compare (bufPtr, TUI_GENERAL_SPECIAL_REGS_NAME) ||
|
|
|
|
subset_compare (bufPtr, TUI_GENERAL_REGS_NAME) ||
|
|
|
|
subset_compare (bufPtr, TUI_FLOAT_REGS_NAME) ||
|
|
|
|
subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (curLayout == SRC_COMMAND || curLayout == SRC_DATA_COMMAND)
|
|
|
|
newLayout = SRC_DATA_COMMAND;
|
|
|
|
else
|
|
|
|
newLayout = DISASSEM_DATA_COMMAND;
|
|
|
|
|
|
|
|
/* could ifdef out the following code. when compile with -z, there are null
|
|
|
|
pointer references that cause a core dump if 'layout regs' is the first
|
|
|
|
layout command issued by the user. HP has asked us to hook up this code
|
|
|
|
- edie epstein
|
|
|
|
*/
|
2001-07-17 21:37:18 +00:00
|
|
|
if (subset_compare (bufPtr, TUI_FLOAT_REGS_NAME))
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
|
|
|
|
TUI_SFLOAT_REGS &&
|
|
|
|
dataWin->detail.dataDisplayInfo.regsDisplayType !=
|
|
|
|
TUI_DFLOAT_REGS)
|
|
|
|
dpyType = TUI_SFLOAT_REGS;
|
|
|
|
else
|
|
|
|
dpyType =
|
|
|
|
dataWin->detail.dataDisplayInfo.regsDisplayType;
|
|
|
|
}
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr,
|
1999-04-16 01:35:26 +00:00
|
|
|
TUI_GENERAL_SPECIAL_REGS_NAME))
|
|
|
|
dpyType = TUI_GENERAL_AND_SPECIAL_REGS;
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, TUI_GENERAL_REGS_NAME))
|
1999-04-16 01:35:26 +00:00
|
|
|
dpyType = TUI_GENERAL_REGS;
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, TUI_SPECIAL_REGS_NAME))
|
1999-04-16 01:35:26 +00:00
|
|
|
dpyType = TUI_SPECIAL_REGS;
|
2001-07-17 22:22:40 +00:00
|
|
|
else if (dataWin)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (dataWin->detail.dataDisplayInfo.regsDisplayType !=
|
|
|
|
TUI_UNDEFINED_REGS)
|
|
|
|
dpyType =
|
|
|
|
dataWin->detail.dataDisplayInfo.regsDisplayType;
|
|
|
|
else
|
|
|
|
dpyType = TUI_GENERAL_REGS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* end of potential ifdef
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* if ifdefed out code above, then assume that the user wishes to display the
|
|
|
|
general purpose registers
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* dpyType = TUI_GENERAL_REGS;
|
|
|
|
*/
|
|
|
|
}
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, "NEXT"))
|
1999-04-16 01:35:26 +00:00
|
|
|
newLayout = _nextLayout ();
|
2001-07-17 21:37:18 +00:00
|
|
|
else if (subset_compare (bufPtr, "PREV"))
|
1999-04-16 01:35:26 +00:00
|
|
|
newLayout = _prevLayout ();
|
|
|
|
else
|
|
|
|
status = TUI_FAILURE;
|
2000-12-15 01:01:51 +00:00
|
|
|
xfree (bufPtr);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_set_layout (newLayout, dpyType);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
status = TUI_FAILURE;
|
|
|
|
|
|
|
|
return status;
|
2001-07-18 22:03:22 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
2001-07-18 20:59:00 +00:00
|
|
|
static CORE_ADDR
|
1999-04-16 01:35:26 +00:00
|
|
|
_extractDisplayStartAddr (void)
|
|
|
|
{
|
|
|
|
TuiLayoutType curLayout = currentLayout ();
|
2001-07-18 20:59:00 +00:00
|
|
|
CORE_ADDR addr;
|
2001-07-17 22:22:40 +00:00
|
|
|
CORE_ADDR pc;
|
2002-09-30 00:52:27 +00:00
|
|
|
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
switch (curLayout)
|
|
|
|
{
|
|
|
|
case SRC_COMMAND:
|
|
|
|
case SRC_DATA_COMMAND:
|
2002-09-30 00:52:27 +00:00
|
|
|
find_line_pc (cursal.symtab,
|
2001-07-17 22:22:40 +00:00
|
|
|
srcWin->detail.sourceInfo.startLineOrAddr.lineNo,
|
|
|
|
&pc);
|
2001-07-18 20:59:00 +00:00
|
|
|
addr = pc;
|
1999-04-16 01:35:26 +00:00
|
|
|
break;
|
|
|
|
case DISASSEM_COMMAND:
|
|
|
|
case SRC_DISASSEM_COMMAND:
|
|
|
|
case DISASSEM_DATA_COMMAND:
|
|
|
|
addr = disassemWin->detail.sourceInfo.startLineOrAddr.addr;
|
|
|
|
break;
|
|
|
|
default:
|
2001-07-18 20:59:00 +00:00
|
|
|
addr = 0;
|
1999-04-16 01:35:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
} /* _extractDisplayStartAddr */
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_tuiHandleXDBLayout (TuiLayoutDefPtr layoutDef)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (layoutDef->split)
|
|
|
|
{
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_set_layout (SRC_DISASSEM_COMMAND, TUI_UNDEFINED_REGS);
|
1999-04-16 01:35:26 +00:00
|
|
|
tuiSetWinFocusTo (winList[layoutDef->displayMode]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (layoutDef->displayMode == SRC_WIN)
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_set_layout (SRC_COMMAND, TUI_UNDEFINED_REGS);
|
1999-04-16 01:35:26 +00:00
|
|
|
else
|
2004-01-23 23:25:17 +00:00
|
|
|
tui_set_layout (DISASSEM_DATA_COMMAND, layoutDef->regsDisplayType);
|
1999-04-16 01:35:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _tuiHandleXDBLayout */
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_tuiToggleLayout_command (char *arg, int fromTTY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
|
|
|
|
|
2001-07-20 22:26:54 +00:00
|
|
|
/* Make sure the curses mode is enabled. */
|
|
|
|
tui_enable ();
|
1999-04-16 01:35:26 +00:00
|
|
|
if (layoutDef->displayMode == SRC_WIN)
|
|
|
|
layoutDef->displayMode = DISASSEM_WIN;
|
|
|
|
else
|
|
|
|
layoutDef->displayMode = SRC_WIN;
|
|
|
|
|
|
|
|
if (!layoutDef->split)
|
|
|
|
_tuiHandleXDBLayout (layoutDef);
|
|
|
|
|
2001-07-18 22:03:22 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_tuiToggleSplitLayout_command (char *arg, int fromTTY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiLayoutDefPtr layoutDef = tuiLayoutDef ();
|
|
|
|
|
2001-07-20 22:26:54 +00:00
|
|
|
/* Make sure the curses mode is enabled. */
|
|
|
|
tui_enable ();
|
1999-04-16 01:35:26 +00:00
|
|
|
layoutDef->split = (!layoutDef->split);
|
|
|
|
_tuiHandleXDBLayout (layoutDef);
|
|
|
|
|
2001-07-18 22:03:22 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_tuiLayout_command (char *arg, int fromTTY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
2001-07-20 22:26:54 +00:00
|
|
|
/* Make sure the curses mode is enabled. */
|
|
|
|
tui_enable ();
|
|
|
|
|
|
|
|
/* Switch to the selected layout. */
|
2004-01-23 23:25:17 +00:00
|
|
|
if (tui_set_layout_for_display_command (arg) != TUI_SUCCESS)
|
2001-07-17 22:22:40 +00:00
|
|
|
warning ("Invalid layout specified.\n%s", LAYOUT_USAGE);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
2001-07-18 22:03:22 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _nextLayout().
|
|
|
|
** Answer the previous layout to cycle to.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static TuiLayoutType
|
|
|
|
_nextLayout (void)
|
|
|
|
{
|
|
|
|
TuiLayoutType newLayout;
|
|
|
|
|
|
|
|
newLayout = currentLayout ();
|
|
|
|
if (newLayout == UNDEFINED_LAYOUT)
|
|
|
|
newLayout = SRC_COMMAND;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newLayout++;
|
|
|
|
if (newLayout == UNDEFINED_LAYOUT)
|
|
|
|
newLayout = SRC_COMMAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
return newLayout;
|
|
|
|
} /* _nextLayout */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _prevLayout().
|
|
|
|
** Answer the next layout to cycle to.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static TuiLayoutType
|
|
|
|
_prevLayout (void)
|
|
|
|
{
|
|
|
|
TuiLayoutType newLayout;
|
|
|
|
|
|
|
|
newLayout = currentLayout ();
|
|
|
|
if (newLayout == SRC_COMMAND)
|
|
|
|
newLayout = DISASSEM_DATA_COMMAND;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
newLayout--;
|
|
|
|
if (newLayout == UNDEFINED_LAYOUT)
|
|
|
|
newLayout = DISASSEM_DATA_COMMAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
return newLayout;
|
|
|
|
} /* _prevLayout */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _makeCommandWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_makeCommandWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_initAndMakeWin ((Opaque *) winInfoPtr,
|
|
|
|
CMD_WIN,
|
|
|
|
height,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
originY,
|
|
|
|
DONT_BOX_WINDOW);
|
|
|
|
|
|
|
|
(*winInfoPtr)->canHighlight = FALSE;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _makeCommandWindow */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _makeSourceWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_makeSourceWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_makeSourceOrDisassemWindow (winInfoPtr, SRC_WIN, height, originY);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _makeSourceWindow */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _makeDisassemWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_makeDisassemWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_makeSourceOrDisassemWindow (winInfoPtr, DISASSEM_WIN, height, originY);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _makeDisassemWindow */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _makeDataWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_makeDataWindow (TuiWinInfoPtr * winInfoPtr, int height, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
_initAndMakeWin ((Opaque *) winInfoPtr,
|
|
|
|
DATA_WIN,
|
|
|
|
height,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
originY,
|
|
|
|
BOX_WINDOW);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _makeDataWindow */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _showSourceCommand().
|
|
|
|
** Show the Source/Command layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
|
|
|
_showSourceCommand (void)
|
|
|
|
{
|
|
|
|
_showSourceOrDisassemAndCommand (SRC_COMMAND);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _showSourceCommand */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _showDisassemCommand().
|
|
|
|
** Show the Dissassem/Command layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
|
|
|
_showDisassemCommand (void)
|
|
|
|
{
|
|
|
|
_showSourceOrDisassemAndCommand (DISASSEM_COMMAND);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _showDisassemCommand */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _showSourceDisassemCommand().
|
|
|
|
** Show the Source/Disassem/Command layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
|
|
|
_showSourceDisassemCommand (void)
|
|
|
|
{
|
|
|
|
if (currentLayout () != SRC_DISASSEM_COMMAND)
|
|
|
|
{
|
|
|
|
int cmdHeight, srcHeight, asmHeight;
|
|
|
|
|
|
|
|
if (m_winPtrNotNull (cmdWin))
|
|
|
|
cmdHeight = cmdWin->generic.height;
|
|
|
|
else
|
|
|
|
cmdHeight = termHeight () / 3;
|
|
|
|
|
|
|
|
srcHeight = (termHeight () - cmdHeight) / 2;
|
|
|
|
asmHeight = termHeight () - (srcHeight + cmdHeight);
|
|
|
|
|
|
|
|
if (m_winPtrIsNull (srcWin))
|
|
|
|
_makeSourceWindow (&srcWin, srcHeight, 0);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (&srcWin->generic,
|
|
|
|
srcWin->generic.type,
|
|
|
|
srcHeight,
|
|
|
|
srcWin->generic.width,
|
|
|
|
srcWin->detail.sourceInfo.executionInfo->width,
|
|
|
|
0);
|
|
|
|
srcWin->canHighlight = TRUE;
|
|
|
|
_initGenWinInfo (srcWin->detail.sourceInfo.executionInfo,
|
|
|
|
EXEC_INFO_WIN,
|
|
|
|
srcHeight,
|
|
|
|
3,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
m_beVisible (srcWin);
|
|
|
|
m_beVisible (srcWin->detail.sourceInfo.executionInfo);
|
|
|
|
srcWin->detail.sourceInfo.hasLocator = FALSE;;
|
|
|
|
}
|
|
|
|
if (m_winPtrNotNull (srcWin))
|
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
|
|
|
|
|
|
|
|
tuiShowSourceContent (srcWin);
|
|
|
|
if (m_winPtrIsNull (disassemWin))
|
|
|
|
{
|
|
|
|
_makeDisassemWindow (&disassemWin, asmHeight, srcHeight - 1);
|
|
|
|
_initAndMakeWin ((Opaque *) & locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
(srcHeight + asmHeight) - 1,
|
|
|
|
DONT_BOX_WINDOW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
(srcHeight + asmHeight) - 1);
|
|
|
|
disassemWin->detail.sourceInfo.hasLocator = TRUE;
|
|
|
|
_initGenWinInfo (
|
|
|
|
&disassemWin->generic,
|
|
|
|
disassemWin->generic.type,
|
|
|
|
asmHeight,
|
|
|
|
disassemWin->generic.width,
|
|
|
|
disassemWin->detail.sourceInfo.executionInfo->width,
|
|
|
|
srcHeight - 1);
|
|
|
|
_initGenWinInfo (disassemWin->detail.sourceInfo.executionInfo,
|
|
|
|
EXEC_INFO_WIN,
|
|
|
|
asmHeight,
|
|
|
|
3,
|
|
|
|
0,
|
|
|
|
srcHeight - 1);
|
|
|
|
disassemWin->canHighlight = TRUE;
|
|
|
|
m_beVisible (disassemWin);
|
|
|
|
m_beVisible (disassemWin->detail.sourceInfo.executionInfo);
|
|
|
|
}
|
|
|
|
if (m_winPtrNotNull (disassemWin))
|
|
|
|
{
|
|
|
|
srcWin->detail.sourceInfo.hasLocator = FALSE;
|
|
|
|
disassemWin->detail.sourceInfo.hasLocator = TRUE;
|
|
|
|
m_beVisible (locator);
|
2004-01-28 23:16:50 +00:00
|
|
|
tui_show_locator_content ();
|
1999-04-16 01:35:26 +00:00
|
|
|
tuiShowSourceContent (disassemWin);
|
|
|
|
|
|
|
|
if (m_winPtrIsNull (cmdWin))
|
|
|
|
_makeCommandWindow (&cmdWin,
|
|
|
|
cmdHeight,
|
|
|
|
termHeight () - cmdHeight);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (&cmdWin->generic,
|
|
|
|
cmdWin->generic.type,
|
|
|
|
cmdWin->generic.height,
|
|
|
|
cmdWin->generic.width,
|
|
|
|
0,
|
|
|
|
cmdWin->generic.origin.y);
|
|
|
|
cmdWin->canHighlight = FALSE;
|
|
|
|
m_beVisible (cmdWin);
|
|
|
|
}
|
|
|
|
if (m_winPtrNotNull (cmdWin))
|
|
|
|
tuiRefreshWin (&cmdWin->generic);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setCurrentLayoutTo (SRC_DISASSEM_COMMAND);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _showSourceDisassemCommand */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _showData().
|
|
|
|
** Show the Source/Data/Command or the Dissassembly/Data/Command layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_showData (TuiLayoutType newLayout)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int totalHeight = (termHeight () - cmdWin->generic.height);
|
|
|
|
int srcHeight, dataHeight;
|
|
|
|
TuiWinType winType;
|
|
|
|
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
|
|
|
|
|
|
|
|
|
|
|
|
dataHeight = totalHeight / 2;
|
|
|
|
srcHeight = totalHeight - dataHeight;
|
|
|
|
m_allBeInvisible ();
|
|
|
|
m_beInvisible (locator);
|
|
|
|
_makeDataWindow (&dataWin, dataHeight, 0);
|
|
|
|
dataWin->canHighlight = TRUE;
|
|
|
|
if (newLayout == SRC_DATA_COMMAND)
|
|
|
|
winType = SRC_WIN;
|
|
|
|
else
|
|
|
|
winType = DISASSEM_WIN;
|
|
|
|
if (m_winPtrIsNull (winList[winType]))
|
|
|
|
{
|
|
|
|
if (winType == SRC_WIN)
|
|
|
|
_makeSourceWindow (&winList[winType], srcHeight, dataHeight - 1);
|
|
|
|
else
|
|
|
|
_makeDisassemWindow (&winList[winType], srcHeight, dataHeight - 1);
|
|
|
|
_initAndMakeWin ((Opaque *) & locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
totalHeight - 1,
|
|
|
|
DONT_BOX_WINDOW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (&winList[winType]->generic,
|
|
|
|
winList[winType]->generic.type,
|
|
|
|
srcHeight,
|
|
|
|
winList[winType]->generic.width,
|
|
|
|
winList[winType]->detail.sourceInfo.executionInfo->width,
|
|
|
|
dataHeight - 1);
|
|
|
|
_initGenWinInfo (winList[winType]->detail.sourceInfo.executionInfo,
|
|
|
|
EXEC_INFO_WIN,
|
|
|
|
srcHeight,
|
|
|
|
3,
|
|
|
|
0,
|
|
|
|
dataHeight - 1);
|
|
|
|
m_beVisible (winList[winType]);
|
|
|
|
m_beVisible (winList[winType]->detail.sourceInfo.executionInfo);
|
|
|
|
_initGenWinInfo (locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
totalHeight - 1);
|
|
|
|
}
|
|
|
|
winList[winType]->detail.sourceInfo.hasLocator = TRUE;
|
|
|
|
m_beVisible (locator);
|
2004-01-28 23:16:50 +00:00
|
|
|
tui_show_locator_content ();
|
1999-04-16 01:35:26 +00:00
|
|
|
addToSourceWindows (winList[winType]);
|
|
|
|
setCurrentLayoutTo (newLayout);
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _showData */
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _initGenWinInfo().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_initGenWinInfo (TuiGenWinInfoPtr winInfo, TuiWinType type,
|
|
|
|
int height, int width, int originX, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
int h = height;
|
|
|
|
|
|
|
|
winInfo->type = type;
|
|
|
|
winInfo->width = width;
|
|
|
|
winInfo->height = h;
|
|
|
|
if (h > 1)
|
|
|
|
{
|
|
|
|
winInfo->viewportHeight = h - 1;
|
|
|
|
if (winInfo->type != CMD_WIN)
|
|
|
|
winInfo->viewportHeight--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
winInfo->viewportHeight = 1;
|
|
|
|
winInfo->origin.x = originX;
|
|
|
|
winInfo->origin.y = originY;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _initGenWinInfo */
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _initAndMakeWin().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_initAndMakeWin (Opaque * winInfoPtr, TuiWinType winType,
|
|
|
|
int height, int width, int originX, int originY, int boxIt)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
Opaque opaqueWinInfo = *winInfoPtr;
|
|
|
|
TuiGenWinInfoPtr generic;
|
|
|
|
|
|
|
|
if (opaqueWinInfo == (Opaque) NULL)
|
|
|
|
{
|
|
|
|
if (m_winIsAuxillary (winType))
|
|
|
|
opaqueWinInfo = (Opaque) allocGenericWinInfo ();
|
|
|
|
else
|
|
|
|
opaqueWinInfo = (Opaque) allocWinInfo (winType);
|
|
|
|
}
|
|
|
|
if (m_winIsAuxillary (winType))
|
|
|
|
generic = (TuiGenWinInfoPtr) opaqueWinInfo;
|
|
|
|
else
|
|
|
|
generic = &((TuiWinInfoPtr) opaqueWinInfo)->generic;
|
|
|
|
|
|
|
|
if (opaqueWinInfo != (Opaque) NULL)
|
|
|
|
{
|
|
|
|
_initGenWinInfo (generic, winType, height, width, originX, originY);
|
|
|
|
if (!m_winIsAuxillary (winType))
|
|
|
|
{
|
|
|
|
if (generic->type == CMD_WIN)
|
|
|
|
((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = FALSE;
|
|
|
|
else
|
|
|
|
((TuiWinInfoPtr) opaqueWinInfo)->canHighlight = TRUE;
|
|
|
|
}
|
|
|
|
makeWindow (generic, boxIt);
|
|
|
|
}
|
|
|
|
*winInfoPtr = opaqueWinInfo;
|
2002-08-24 12:28:33 +00:00
|
|
|
}
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _makeSourceOrDisassemWindow().
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_makeSourceOrDisassemWindow (TuiWinInfoPtr * winInfoPtr, TuiWinType type,
|
|
|
|
int height, int originY)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
TuiGenWinInfoPtr executionInfo = (TuiGenWinInfoPtr) NULL;
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Create the exeuction info window.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
if (type == SRC_WIN)
|
|
|
|
executionInfo = sourceExecInfoWinPtr ();
|
|
|
|
else
|
|
|
|
executionInfo = disassemExecInfoWinPtr ();
|
|
|
|
_initAndMakeWin ((Opaque *) & executionInfo,
|
|
|
|
EXEC_INFO_WIN,
|
|
|
|
height,
|
|
|
|
3,
|
|
|
|
0,
|
|
|
|
originY,
|
|
|
|
DONT_BOX_WINDOW);
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** Now create the source window.
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
_initAndMakeWin ((Opaque *) winInfoPtr,
|
|
|
|
type,
|
|
|
|
height,
|
|
|
|
termWidth () - executionInfo->width,
|
|
|
|
executionInfo->width,
|
|
|
|
originY,
|
|
|
|
BOX_WINDOW);
|
|
|
|
|
|
|
|
(*winInfoPtr)->detail.sourceInfo.executionInfo = executionInfo;
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _makeSourceOrDisassemWindow */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
1999-07-07 20:19:36 +00:00
|
|
|
** _showSourceOrDisassemAndCommand().
|
|
|
|
** Show the Source/Command or the Disassem layout
|
|
|
|
*/
|
1999-04-16 01:35:26 +00:00
|
|
|
static void
|
2001-07-14 19:31:09 +00:00
|
|
|
_showSourceOrDisassemAndCommand (TuiLayoutType layoutType)
|
1999-04-16 01:35:26 +00:00
|
|
|
{
|
|
|
|
if (currentLayout () != layoutType)
|
|
|
|
{
|
|
|
|
TuiWinInfoPtr *winInfoPtr;
|
|
|
|
int srcHeight, cmdHeight;
|
|
|
|
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
|
|
|
|
|
|
|
|
if (m_winPtrNotNull (cmdWin))
|
|
|
|
cmdHeight = cmdWin->generic.height;
|
|
|
|
else
|
|
|
|
cmdHeight = termHeight () / 3;
|
|
|
|
srcHeight = termHeight () - cmdHeight;
|
|
|
|
|
|
|
|
|
|
|
|
if (layoutType == SRC_COMMAND)
|
|
|
|
winInfoPtr = &srcWin;
|
|
|
|
else
|
|
|
|
winInfoPtr = &disassemWin;
|
|
|
|
|
|
|
|
if (m_winPtrIsNull (*winInfoPtr))
|
|
|
|
{
|
|
|
|
if (layoutType == SRC_COMMAND)
|
|
|
|
_makeSourceWindow (winInfoPtr, srcHeight - 1, 0);
|
|
|
|
else
|
|
|
|
_makeDisassemWindow (winInfoPtr, srcHeight - 1, 0);
|
|
|
|
_initAndMakeWin ((Opaque *) & locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
srcHeight - 1,
|
|
|
|
DONT_BOX_WINDOW);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (locator,
|
|
|
|
LOCATOR_WIN,
|
|
|
|
2 /* 1 */ ,
|
|
|
|
termWidth (),
|
|
|
|
0,
|
|
|
|
srcHeight - 1);
|
|
|
|
(*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
|
|
|
|
_initGenWinInfo (
|
|
|
|
&(*winInfoPtr)->generic,
|
|
|
|
(*winInfoPtr)->generic.type,
|
|
|
|
srcHeight - 1,
|
|
|
|
(*winInfoPtr)->generic.width,
|
|
|
|
(*winInfoPtr)->detail.sourceInfo.executionInfo->width,
|
|
|
|
0);
|
|
|
|
_initGenWinInfo ((*winInfoPtr)->detail.sourceInfo.executionInfo,
|
|
|
|
EXEC_INFO_WIN,
|
|
|
|
srcHeight - 1,
|
|
|
|
3,
|
|
|
|
0,
|
|
|
|
0);
|
|
|
|
(*winInfoPtr)->canHighlight = TRUE;
|
|
|
|
m_beVisible (*winInfoPtr);
|
|
|
|
m_beVisible ((*winInfoPtr)->detail.sourceInfo.executionInfo);
|
|
|
|
}
|
|
|
|
if (m_winPtrNotNull (*winInfoPtr))
|
|
|
|
{
|
|
|
|
(*winInfoPtr)->detail.sourceInfo.hasLocator = TRUE;
|
|
|
|
m_beVisible (locator);
|
2004-01-28 23:16:50 +00:00
|
|
|
tui_show_locator_content ();
|
1999-04-16 01:35:26 +00:00
|
|
|
tuiShowSourceContent (*winInfoPtr);
|
|
|
|
|
|
|
|
if (m_winPtrIsNull (cmdWin))
|
|
|
|
{
|
|
|
|
_makeCommandWindow (&cmdWin, cmdHeight, srcHeight);
|
|
|
|
tuiRefreshWin (&cmdWin->generic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_initGenWinInfo (&cmdWin->generic,
|
|
|
|
cmdWin->generic.type,
|
|
|
|
cmdWin->generic.height,
|
|
|
|
cmdWin->generic.width,
|
|
|
|
cmdWin->generic.origin.x,
|
|
|
|
cmdWin->generic.origin.y);
|
|
|
|
cmdWin->canHighlight = FALSE;
|
|
|
|
m_beVisible (cmdWin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setCurrentLayoutTo (layoutType);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
} /* _showSourceOrDisassemAndCommand */
|