HP tui support files for gdb.

This commit is contained in:
David Taylor 1998-12-31 17:46:28 +00:00
parent 9f0dcc0f37
commit 03b93bdc82
27 changed files with 11165 additions and 0 deletions

64
gdb/tui/.Sanitize Normal file
View File

@ -0,0 +1,64 @@
# .Sanitize for devo/gdb/tui.
# Each directory to survive its way into a release will need a file
# like this one called "./.Sanitize". All keyword lines must exist,
# and must exist in the order specified by this file. Each directory
# in the tree will be processed, top down, in the following order.
# Hash started lines like this one are comments and will be deleted
# before anything else is done. Blank lines will also be squashed
# out.
# The lines between the "Do-first:" line and the "Things-to-keep:"
# line are executed as a /bin/sh shell script before anything else is
# done in this directory.
Do-first:
# All files listed between the "Things-to-keep:" line and the
# "Files-to-sed:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize
# called. Directories not listed will be removed in their entirety
# with rm -rf.
Things-to-keep:
Makefile.in
tui.c
tui.h
tuiCommand.c
tuiCommand.h
tuiData.c
tuiData.h
tuiDataWin.c
tuiDataWin.h
tuiDisassem.c
tuiDisassem.h
tuiGeneralWin.c
tuiGeneralWin.h
tuiIO.c
tuiIO.h
tuiLayout.c
tuiLayout.h
tuiRegs.c
tuiRegs.h
tuiSource.c
tuiSource.h
tuiSourceWin.c
tuiSourceWin.h
tuiStack.c
tuiStack.h
tuiWin.c
tuiWin.h
# Things which are explicitly *not* kept, for now.
Things-to-lose:
Do-last:
# Don't try to clean directories here, as the 'mv' command will fail.
# Also, grep fails on NFS mounted directories.
#
# End of file.

116
gdb/tui/ChangeLog Normal file
View File

@ -0,0 +1,116 @@
Thu Dec 31 12:08:32 1998 David Taylor <taylor@texas.cygnus.com>
The following changes were made by Jim Blandy <jimb@cygnus.com>,
Edith Epstein <eepstein@cygnus.com>, Elena Zannoni
<ezannoni@cygnus.com> Stan Shebs <shebs@cygnus.com>, and David
Taylor <taylor@cygnus.com>, as part of the project to merge in
changes originally made by HP; HP did not create ChangeLog
entries.
* Makefile.in: New file; we're merging HP's changes into GDB, and
we've moved the TUI files into a subdirectory, so we need a new
Makefile.
* tui.c:
#include <term.h>, if we have it, to get declarations for
the termcap functions on Solaris.
(tgoto): Add external K&R declaration for this; Solaris doesn't
bother to actually declare it in their header files.
(_tuiReset): Ignore the #definition of TIOCGETC if USG is defined;
we'd rather use the USG mechanisms than the Berkeley mechanisms
(TIOCGETC is one of the Berkeley terminal control ioctls).
Apologies if this causes trouble later; this should all be handled
by autoconf...
(strcat_to_buf, strcat_to_buf_with_fmt): New functions, moved here
from ../utils.h.
(tuiFree): replace safe_free with free.
(strcat_to_buf): new function, copied from utils.c.
(tuiInit): Add ignored `argv0' argument, to match the type that
init_ui_hook expects; updated declaration. Call the
initialize_tui_files function constructed above. Initialize
flush_hook to NULL.
(tuiInitWindows): Call tuiSetLocatorContent, to get the first
element of the locator window's content allocated. This seems
wrong, because it must have been initialized somehow in HP's
sources, and we should do it the same way now. But we do get
further before it segfaults. [Postscript: HP didn't bother to
initialize it; they compile
(va_catch_errors, vcatch_errors): Functions moved here from
../utils.c in HP's sources. They're not used anywhere else.
(xdb_style): Delete this variable, and remove all references to
it. It's always true.
(tuiInit, _tui_vDo): References removed.
* tui.h: Add prototypes.
Don't #include "gendefs.h"; it's only used in the TUI.
Integrate its contents into this file:
#include <ansidecl.h> here.
(Opaque, OpaqueFuncPtr): Typedefs moved to here.
* tuiCommand.c: #include "defs.h", so we get the appropriate
definition of GDB_FILE.
* tuiData.c
(freeWindow): replace safe_free with free.
(tui_version): don't define it here; it's defined in main.c now.
* tuiDisassem.c
(tuiSetDisassemContent): Call strcat_address_numeric instead of
strcat_address. Simplify the control structure. Use predefined
GDB function to print asm inst address. Use GDB_FILE to collect
output into buffers.
* tuiIO.c
(tgoto): Add external K&R declaration for this here too.
(tuiGetc, tuiTermSetup, tuiTermUnsetup): Same.
(tuiPuts_unfiltered): change FILE to GDB_FILE.
(tui_tputs): fix prototype for 3rd argument.
* tuiIO.h (tuiPuts_unfiltered): change declaration.
* tuiLayout.c
(_tuiSetLayoutTo): for displaying registers, hook up the HP code
that decides which registers to display (i.e. single precision
float, double precision float, general, special). Previously,
only handled TUI_GENERAL_REGS. Now that the code is hooked up,
compiling with -z poses a problem. When the first layout command
is 'layout regs', dataWin->detail is a NULL pointer, and gdb
core dumps.
* tuiLayout.c (_tuiSetLayoutTo): replace safe_free with free.
* tuiRegs.c #include "defs.h" earlier, to avoid problems in
<stdarg.h>. No idea exactly what's conflicting with what, but the
errors went away...
(_tuiRegisterFormat): Change so that function creates a GDB_FILE
object, calls pa_do_strcat_registers_info, copies the register
info into a buffer, and deallocates the GDB_FILE object. Remove
some code that is not executed. Also, call to
pa_do_strcat_registers_info has an additional parameter,
precision. This code requires some new per-target functions that
we don't want to merge. Dyke it out, with #ifdef
TUI_EXTENDED_FORMATTERS.
(_tuiSetSpecialRegsContent): this function was ifdefed out.
Hooked this up.
(_tuiSetGeneralAndSpecialRegsContent): this function was ifdefed
out. Hooked it up.
(IS_64BIT): Just define this to be zero; we're not merging in the
64-bit support.
(tuiShowRegisters): Comment out all references to the "special"
regs; we don't have a distinction between the "special" and
"non-special" regs in most of our machine descriptions. This code
is PA-specific in other ways as well, and needs to be redesigned
to be portable to other processors.
* tuiWin.c: #include <string.h>, to get a declaration for
strchr.
* tui.c, tuiCommand.c, tuiData.c, tuiDataWin.c, tuiDisassem.c,
tuiGeneralWin.c, tuiIO.c, tuiLayout.c, tuiRegs.c, tuiSource.c,
tuiSourceWin.c, tuiStack.c, tuiWin.c: New files (from HP). Changed
bool to int throughout. Re-indented, GNU style.
* tui.h, tuiCommand.h, tuiData.h, tuiDataWin.h, tuiDisassem.h,
tuiGeneralWin.h, tuiIO.h, tuiLayout.h, tuiRegs.h, tuiSource.h,
tuiSourceWin.h, tuiStack.h, tuiWin.h: new files (from HP).
Changed bool to int throughout.

168
gdb/tui/Makefile.in Normal file
View File

@ -0,0 +1,168 @@
# Copyright 1998 Free Software Foundation, Inc.
# 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.
all: libtui.a
srcdir=@srcdir@
VPATH = @srcdir@
SHELL = @SHELL@
CC=@CC@
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@
# Host and target-dependent makefile fragments come in here.
@host_makefile_frag@
@target_makefile_frag@
# End of host and target-dependent makefile fragments
# Where is our "include" directory? Typically $(srcdir)/../include.
# This is essentially the header file directory for the library
# routines in libiberty.
INCLUDE_DIR = $(srcdir)/../../include
INCLUDE_CFLAGS = -I$(INCLUDE_DIR)
# Configured by the --with-mmalloc option to configure.
MMALLOC = @MMALLOC@
MMALLOC_CFLAGS = @MMALLOC_CFLAGS@
# Where is the BFD library? Typically in ../bfd.
BFD_DIR = ../../bfd
BFD_SRC = $(srcdir)/$(BFD_DIR)
BFD_CFLAGS = -I$(BFD_DIR) -I$(BFD_SRC)
# Where is the READLINE library? Typically in ../readline.
READLINE_DIR = ../../readline
READLINE_SRC = $(srcdir)/$(READLINE_DIR)
READLINE_CFLAGS = -I$(READLINE_SRC)
# Where is the INTL library? Typically in ../intl.
INTL_DIR = ../../intl
INTL_SRC = $(srcdir)/$(INTL_DIR)
INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC)
# Where is the TCL library? Typically in ../tcl.
TCL_CFLAGS = @TCLHDIR@
# Where is the TK library? Typically in ../tk.
TK_CFLAGS = @TKHDIR@ @TK_BUILD_INCLUDES@
# Where is Itcl? Typically in ../itcl.
ITCL_CFLAGS = @ITCLHDIR@
# Where is Tix? Typically in ../tix.
TIX_CFLAGS = @TIXHDIR@
X11_CFLAGS = @TK_XINCLUDES@
ENABLE_IDE= @ENABLE_IDE@
GUI_CFLAGS_X = -I$(srcdir)/../../libgui/src
IDE_CFLAGS_X = -I$(srcdir)/../../libidetcl/src -I$(srcdir)/../../libide/src \
`if [ x"$(ENABLE_IDE)" != x ] ; then \
echo -DIDE -I$(srcdir)/../../ilu/runtime/mainloop;\
fi`
IDE_CFLAGS=$(GUI_CFLAGS_X) $(IDE_CFLAGS_X)
ENABLE_CFLAGS= @ENABLE_CFLAGS@
# -I. for config files.
# -I$(srcdir) for gdb internal headers and possibly for gnu-regex.h also.
# -I$(srcdir)/config for more generic config files.
# It is also possible that you will need to add -I/usr/include/sys if
# your system doesn't have fcntl.h in /usr/include (which is where it
# should be according to Posix).
DEFS = @DEFS@
GDB_CFLAGS = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config $(DEFS)
# M{H,T}_CFLAGS, if defined, have host- and target-dependent CFLAGS
# from the config directory.
GLOBAL_CFLAGS = $(MT_CFLAGS) $(MH_CFLAGS)
#PROFILE_CFLAGS = -pg
# INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
INTERNAL_CFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(PROFILE_CFLAGS) \
$(GDB_CFLAGS) $(READLINE_CFLAGS) $(BFD_CFLAGS) \
$(MMALLOC_CFLAGS) $(INCLUDE_CFLAGS) $(INTL_CFLAGS) \
$(ENABLE_CFLAGS)
HEADERS = tuiIO.h tuiData.h tuiGeneralWin.h tuiLayout.h tuiStack.h \
tuiSource.h tuiCommand.h tuiWin.h tuiDisassem.h \
tuiSourceWin.h tuiRegs.h tuiDataWin.h
SOURCES = tui.c tuiData.c tuiSource.c tuiStack.c tuiIO.c \
tuiGeneralWin.c tuiLayout.c tuiWin.c tuiCommand.c \
tuiDisassem.c tuiSourceWin.c tuiRegs.c tuiDataWin.c
OBJECTS = tui.o tuiData.o tuiSource.o tuiStack.o tuiIO.o \
tuiGeneralWin.o tuiLayout.o tuiWin.o tuiCommand.o \
tuiDisassem.o tuiSourceWin.o tuiRegs.o tuiDataWin.o \
tuiInit.o
# Prevent Sun make from putting in the machine type. Setting
# TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
.c.o:
$(CC) -c $(INTERNAL_CFLAGS) $<
.SUFFIXES: .cpp
.c.cpp:
$(CC) -E $(INTERNAL_CFLAGS) $< > $@
libtui.a: $(OBJECTS)
rm -f libtui.a
$(AR) rc libtui.a $(OBJECTS)
$(RANLIB) libtui.a
tui.o: tui.c tui.h tuiData.h tuiLayout.h tuiIO.h tuiRegs.h tuiWin.h
tuiCommand.o: tui.h tuiData.h tuiWin.h tuiIO.h
tuiData.o: tui.h tuiData.h
tuiDataWin.o: tui.h tuiData.h tuiRegs.h
tuiDisassem.o: tui.h tuiData.h tuiLayout.h tuiSourceWin.h tuiStack.h
tuiGeneralWin.o: tui.h tuiData.h tuiGeneralWin.h
tuiIO.o: tui.h tuiData.h tuiIO.h tuiCommand.h tuiWin.h
tuiLayout.o: tui.h tuiData.h tuiGeneralWin.h tuiStack.h tuiRegs.h \
tuiDisassem.h
tuiRegs.o: tui.h tuiData.h tuiLayout.h tuiWin.h
tuiSource.o: tui.h tuiData.h tuiStack.h tuiSourceWin.h tuiSource.h
tuiSourceWin.o: tui.h tuiData.h tuiStack.h tuiSourceWin.h tuiSource.h \
tuiDisassem.h
tuiStack.o: tui.h tuiData.h tuiStack.h tuiSourceWin.h
tuiWin.o: tui.h tuiData.h tuiGeneralWin.h tuiStack.h tuiSourceWin.h \
tuiDataWin.h
tuiInit.o: tuiInit.c
tuiInit.c: $(SOURCES)
@echo Making tuiInit.c
@rm -f init.c-tmp
@echo '/* Do not modify this file. */' >init.c-tmp
@echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
@echo '#include "ansidecl.h"' >>init.c-tmp
@echo 'extern void initialize_tui_files PARAMS ((void));' >>init.c-tmp
@echo 'void initialize_tui_files PARAMS ((void)) {' >>init.c-tmp
@-( cd $(srcdir) ; grep '^_initialize_[a-z_0-9A-Z]* *(' $(SOURCES) ) 2>/dev/null \
| sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 PARAMS ((void)); \1 ();}/' >>init.c-tmp
@echo '}' >>init.c-tmp
@mv init.c-tmp tuiInit.c
clean:
rm -f *.o *.a

215
gdb/tui/tuiCommand.c Normal file
View File

@ -0,0 +1,215 @@
/*
** tuiCommand.c
** This module contains functions specific to command window processing.
*/
#include "defs.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiWin.h"
#include "tuiIO.h"
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
/*****************************************
** PUBLIC FUNCTIONS **
******************************************/
/*
** tuiDispatchCtrlChar().
** Dispatch the correct tui function based upon the control character.
*/
unsigned int
#ifdef __STDC__
tuiDispatchCtrlChar (
unsigned int ch)
#else
tuiDispatchCtrlChar (ch)
unsigned int ch;
#endif
{
TuiWinInfoPtr winInfo = tuiWinWithFocus ();
/*
** If the command window has the logical focus, or no-one does
** assume it is the command window; in this case, pass the
** character on through and do nothing here.
*/
if (winInfo == (TuiWinInfoPtr) NULL || winInfo == cmdWin)
return ch;
else
{
unsigned int c = 0, chCopy = ch;
register int i;
char *term;
/* If this is an xterm, page next/prev keys aren't returned
** by keypad as a single char, so we must handle them here.
** Seems like a bug in the curses library?
*/
term = (char *) getenv ("TERM");
for (i = 0; (term && term[i]); i++)
term[i] = toupper (term[i]);
if ((strcmp (term, "XTERM") == 0) && m_isStartSequence (ch))
{
unsigned int pageCh = 0, tmpChar;
tmpChar = 0;
while (!m_isEndSequence (tmpChar))
{
tmpChar = (int) wgetch (cmdWin->generic.handle);
if (!tmpChar)
break;
if (tmpChar == 53)
pageCh = KEY_PPAGE;
else if (tmpChar == 54)
pageCh = KEY_NPAGE;
}
chCopy = pageCh;
}
switch (chCopy)
{
case KEY_NPAGE:
tuiScrollForward (winInfo, 0);
break;
case KEY_PPAGE:
tuiScrollBackward (winInfo, 0);
break;
case KEY_DOWN:
case KEY_SF:
tuiScrollForward (winInfo, 1);
break;
case KEY_UP:
case KEY_SR:
tuiScrollBackward (winInfo, 1);
break;
case KEY_RIGHT:
tuiScrollLeft (winInfo, 1);
break;
case KEY_LEFT:
tuiScrollRight (winInfo, 1);
break;
case '\f':
tuiRefreshAll ();
break;
default:
c = chCopy;
break;
}
return c;
}
} /* tuiDispatchCtrlChar */
/*
** tuiIncrCommandCharCountBy()
** Increment the current character count in the command window,
** checking for overflow. Returns the new value of the char count.
*/
int
#ifdef __STDC__
tuiIncrCommandCharCountBy (
int count)
#else
tuiIncrCommandCharCountBy (count)
int count;
#endif
{
if (tui_version)
{
if ((count + cmdWin->detail.commandInfo.curch) >= cmdWin->generic.width)
cmdWin->detail.commandInfo.curch =
(count + cmdWin->detail.commandInfo.curch) - cmdWin->generic.width;
else
cmdWin->detail.commandInfo.curch += count;
}
return cmdWin->detail.commandInfo.curch;
} /* tuiIncrCommandCharCountBy */
/*
** tuiDecrCommandCharCountBy()
** Decrement the current character count in the command window,
** checking for overflow. Returns the new value of the char count.
*/
int
#ifdef __STDC__
tuiDecrCommandCharCountBy (
int count)
#else
tuiDecrCommandCharCountBy (count)
int count;
#endif
{
if (tui_version)
{
if ((cmdWin->detail.commandInfo.curch - count) < 0)
cmdWin->detail.commandInfo.curch =
cmdWin->generic.width + (cmdWin->detail.commandInfo.curch - count);
else
cmdWin->detail.commandInfo.curch -= count;
}
return cmdWin->detail.commandInfo.curch;
} /* tuiDecrCommandCharCountBy */
/*
** tuiSetCommandCharCountTo()
** Set the character count to count.
*/
int
#ifdef __STDC__
tuiSetCommandCharCountTo (
int count)
#else
tuiSetCommandCharCountTo (count)
int count;
#endif
{
if (tui_version)
{
if (count > cmdWin->generic.width - 1)
{
cmdWin->detail.commandInfo.curch = 0;
tuiIncrCommandCharCountBy (count);
}
else
cmdWin->detail.commandInfo.curch -= count;
}
return cmdWin->detail.commandInfo.curch;
} /* tuiSetCommandCharCountTo */
/*
** tuiClearCommandCharCount()
** Clear the character count to count.
*/
int
#ifdef __STDC__
tuiClearCommandCharCount (void)
#else
tuiClearCommandCharCount ()
#endif
{
if (tui_version)
cmdWin->detail.commandInfo.curch = 0;
return cmdWin->detail.commandInfo.curch;
} /* tuiClearCommandCharCount */
/*****************************************
** STATIC LOCAL FUNCTIONS **
******************************************/

24
gdb/tui/tuiCommand.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef _TUI_COMMAND_H
#define _TUI_COMMAND_H
/*
** This header file supports
*/
/*****************************************
** TYPE DEFINITIONS **
******************************************/
/*****************************************
** PUBLIC FUNCTION EXTERNAL DECLS **
******************************************/
extern unsigned int tuiDispatchCtrlChar PARAMS ((unsigned int));
extern int tuiIncrCommandCharCountBy PARAMS ((int));
extern int tuiDecrCommandCharCountBy PARAMS ((int));
extern int tuiSetCommandCharCountTo PARAMS ((int));
extern int tuiClearCommandCharCount PARAMS ((void));
#endif /*_TUI_COMMAND_H*/

1624
gdb/tui/tuiData.c Normal file

File diff suppressed because it is too large Load Diff

302
gdb/tui/tuiData.h Normal file
View File

@ -0,0 +1,302 @@
#ifndef TUI_DATA_H
#define TUI_DATA_H
/* Constant definitions */
#define DEFAULT_TAB_LEN 8
#define NO_SRC_STRING "[ No Source Available ]"
#define NO_DISASSEM_STRING "[ No Assembly Available ]"
#define NO_REGS_STRING "[ Register Values Unavailable ]"
#define NO_DATA_STRING "[ No Data Values Displayed ]"
#define MAX_CONTENT_COUNT 100
#define SRC_NAME "SRC"
#define CMD_NAME "CMD"
#define DATA_NAME "REGS"
#define DISASSEM_NAME "ASM"
#define TUI_NULL_STR ""
#define DEFAULT_HISTORY_COUNT 25
#define BOX_WINDOW TRUE
#define DONT_BOX_WINDOW FALSE
#define HILITE TRUE
#define NO_HILITE FALSE
#define WITH_LOCATOR TRUE
#define NO_LOCATOR FALSE
#define EMPTY_SOURCE_PROMPT TRUE
#define NO_EMPTY_SOURCE_PROMPT FALSE
#define UNDEFINED_ITEM -1
#define MIN_WIN_HEIGHT 3
#define MIN_CMD_WIN_HEIGHT 3
#define FILE_PREFIX "File: "
#define PROC_PREFIX "Procedure: "
#define LINE_PREFIX "Line: "
#define PC_PREFIX "pc: "
#define TUI_FLOAT_REGS_NAME "$FREGS"
#define TUI_FLOAT_REGS_NAME_LOWER "$fregs"
#define TUI_GENERAL_REGS_NAME "$GREGS"
#define TUI_GENERAL_REGS_NAME_LOWER "$gregs"
#define TUI_SPECIAL_REGS_NAME "$SREGS"
#define TUI_SPECIAL_REGS_NAME_LOWER "$sregs"
#define TUI_GENERAL_SPECIAL_REGS_NAME "$REGS"
#define TUI_GENERAL_SPECIAL_REGS_NAME_LOWER "$regs"
/* Scroll direction enum */
typedef enum {
FORWARD_SCROLL,
BACKWARD_SCROLL,
LEFT_SCROLL,
RIGHT_SCROLL
} TuiScrollDirection, *TuiScrollDirectionPtr;
/* General list struct */
typedef struct _TuiList {
OpaqueList list;
int count;
} TuiList, *TuiListPtr;
/* The kinds of layouts available */
typedef enum {
SRC_COMMAND,
DISASSEM_COMMAND,
SRC_DISASSEM_COMMAND,
SRC_DATA_COMMAND,
DISASSEM_DATA_COMMAND,
UNDEFINED_LAYOUT
} TuiLayoutType, *TuiLayoutTypePtr;
/* Basic data types that can be displayed in the data window. */
typedef enum _TuiDataType {
TUI_REGISTER,
TUI_SCALAR,
TUI_COMPLEX,
TUI_STRUCT
} TuiDataType, TuiDataTypePtr;
/* Types of register displays */
typedef enum _TuiRegisterDisplayType {
TUI_UNDEFINED_REGS,
TUI_GENERAL_REGS,
TUI_SFLOAT_REGS,
TUI_DFLOAT_REGS,
TUI_SPECIAL_REGS,
TUI_GENERAL_AND_SPECIAL_REGS
} TuiRegisterDisplayType, *TuiRegisterDisplayTypePtr;
/* Structure describing source line or line address */
typedef union _TuiLineOrAddress {
int lineNo;
Opaque addr;
} TuiLineOrAddress, *TuiLineOrAddressPtr;
/* Current Layout definition */
typedef struct _TuiLayoutDef {
TuiWinType displayMode;
int split;
TuiRegisterDisplayType regsDisplayType;
TuiRegisterDisplayType floatRegsDisplayType;
} TuiLayoutDef, *TuiLayoutDefPtr;
/* Elements in the Source/Disassembly Window */
typedef struct _TuiSourceElement
{
char *line;
TuiLineOrAddress lineOrAddr;
int isExecPoint;
int hasBreak;
} TuiSourceElement, *TuiSourceElementPtr;
/* Elements in the data display window content */
typedef struct _TuiDataElement
{
char *name;
int itemNo; /* the register number, or data display number */
TuiDataType type;
Opaque value;
int highlight;
} TuiDataElement, *TuiDataElementPtr;
/* Elements in the command window content */
typedef struct _TuiCommandElement
{
char *line;
} TuiCommandElement, *TuiCommandElementPtr;
#define MAX_LOCATOR_ELEMENT_LEN 100
/* Elements in the locator window content */
typedef struct _TuiLocatorElement
{
char fileName[MAX_LOCATOR_ELEMENT_LEN];
char procName[MAX_LOCATOR_ELEMENT_LEN];
int lineNo;
Opaque addr;
} TuiLocatorElement, *TuiLocatorElementPtr;
/* An content element in a window */
typedef union
{
TuiSourceElement source; /* the source elements */
TuiGenWinInfo dataWindow; /* data display elements */
TuiDataElement data; /* elements of dataWindow */
TuiCommandElement command; /* command elements */
TuiLocatorElement locator; /* locator elements */
char *simpleString; /* simple char based elements */
} TuiWhichElement, *TuiWhichElementPtr;
typedef struct _TuiWinElement
{
int highlight;
TuiWhichElement whichElement;
} TuiWinElement, *TuiWinElementPtr;
/* This describes the content of the window. */
typedef TuiWinElementPtr *TuiWinContent;
/* This struct defines the specific information about a data display window */
typedef struct _TuiDataInfo {
TuiWinContent dataContent; /* start of data display content */
int dataContentCount;
TuiWinContent regsContent; /* start of regs display content */
int regsContentCount;
TuiRegisterDisplayType regsDisplayType;
int regsColumnCount;
int displayRegs; /* Should regs be displayed at all? */
} TuiDataInfo, *TuiDataInfoPtr;
typedef struct _TuiSourceInfo {
int hasLocator; /* Does locator belongs to this window? */
TuiGenWinInfoPtr executionInfo; /* execution information window */
int horizontalOffset; /* used for horizontal scroll */
TuiLineOrAddress startLineOrAddr;
} TuiSourceInfo, *TuiSourceInfoPtr;
typedef struct _TuiCommandInfo {
int curLine; /* The current line position */
int curch; /* The current cursor position */
} TuiCommandInfo, *TuiCommandInfoPtr;
/* This defines information about each logical window */
typedef struct _TuiWinInfo {
TuiGenWinInfo generic; /* general window information */
union {
TuiSourceInfo sourceInfo;
TuiDataInfo dataDisplayInfo;
TuiCommandInfo commandInfo;
Opaque opaque;
} detail;
int canHighlight; /* Can this window ever be highlighted? */
int isHighlighted; /* Is this window highlighted? */
} TuiWinInfo, *TuiWinInfoPtr;
/* MACROS (prefixed with m_) */
/* Testing macros */
#define m_genWinPtrIsNull(winInfo) \
((winInfo) == (TuiGenWinInfoPtr)NULL)
#define m_genWinPtrNotNull(winInfo) \
((winInfo) != (TuiGenWinInfoPtr)NULL)
#define m_winPtrIsNull(winInfo) \
((winInfo) == (TuiWinInfoPtr)NULL)
#define m_winPtrNotNull(winInfo) \
((winInfo) != (TuiWinInfoPtr)NULL)
#define m_winIsSourceType(type) \
(type == SRC_WIN || type == DISASSEM_WIN)
#define m_winIsAuxillary(winType) \
(winType > MAX_MAJOR_WINDOWS)
#define m_hasLocator(winInfo) \
( ((winInfo) != (TuiWinInfoPtr)NULL) ? \
(winInfo->detail.sourceInfo.hasLocator) : \
FALSE )
#define m_setWinHighlightOn(winInfo) \
if ((winInfo) != (TuiWinInfoPtr)NULL) \
(winInfo)->isHighlighted = TRUE
#define m_setWinHighlightOff(winInfo) \
if ((winInfo) != (TuiWinInfoPtr)NULL) \
(winInfo)->isHighlighted = FALSE
/* Global Data */
extern TuiWinInfoPtr winList[MAX_MAJOR_WINDOWS];
extern int tui_version;
/* Macros */
#define srcWin winList[SRC_WIN]
#define disassemWin winList[DISASSEM_WIN]
#define dataWin winList[DATA_WIN]
#define cmdWin winList[CMD_WIN]
/* Data Manipulation Functions */
extern void initializeStaticData PARAMS ((void));
extern TuiGenWinInfoPtr allocGenericWinInfo PARAMS ((void));
extern TuiWinInfoPtr allocWinInfo PARAMS ((TuiWinType));
extern void initGenericPart PARAMS ((TuiGenWinInfoPtr));
extern void initWinInfo PARAMS ((TuiWinInfoPtr));
extern TuiWinContent allocContent PARAMS ((int, TuiWinType));
extern int addContentElements
PARAMS ((TuiGenWinInfoPtr, int));
extern void initContentElement
PARAMS ((TuiWinElementPtr, TuiWinType));
extern void freeWindow PARAMS ((TuiWinInfoPtr));
extern void freeAllWindows PARAMS ((void));
extern void freeWinContent PARAMS ((TuiGenWinInfoPtr));
extern void freeDataContent PARAMS ((TuiWinContent, int));
extern void freeAllSourceWinsContent PARAMS ((void));
extern void tuiDelWindow PARAMS ((TuiWinInfoPtr));
extern void tuiDelDataWindows PARAMS ((TuiWinContent, int));
extern TuiWinInfoPtr winByName PARAMS ((char *));
extern TuiWinInfoPtr partialWinByName PARAMS ((char *));
extern char *winName PARAMS ((TuiGenWinInfoPtr));
extern char *displayableWinContentOf
PARAMS ((TuiGenWinInfoPtr, TuiWinElementPtr));
extern char *displayableWinContentAt
PARAMS ((TuiGenWinInfoPtr, int));
extern int winElementHeight
PARAMS ((TuiGenWinInfoPtr, TuiWinElementPtr));
extern TuiLayoutType currentLayout PARAMS ((void));
extern void setCurrentLayoutTo PARAMS ((TuiLayoutType));
extern int termHeight PARAMS ((void));
extern void setTermHeight PARAMS ((int));
extern int termWidth PARAMS ((void));
extern void setTermWidth PARAMS ((int));
extern int historyLimit PARAMS ((void));
extern void setHistoryLimit PARAMS ((int));
extern void setGenWinOrigin PARAMS ((TuiGenWinInfoPtr, int, int));
extern TuiGenWinInfoPtr locatorWinInfoPtr PARAMS ((void));
extern TuiGenWinInfoPtr sourceExecInfoWinPtr PARAMS ((void));
extern TuiGenWinInfoPtr disassemExecInfoWinPtr PARAMS ((void));
extern char *nullStr PARAMS ((void));
extern char *blankStr PARAMS ((void));
extern char *locationStr PARAMS ((void));
extern char *breakStr PARAMS ((void));
extern char *breakLocationStr PARAMS ((void));
extern TuiListPtr sourceWindows PARAMS ((void));
extern void clearSourceWindows PARAMS ((void));
extern void clearSourceWindowsDetail PARAMS ((void));
extern void clearWinDetail PARAMS ((TuiWinInfoPtr winInfo));
extern void tuiAddToSourceWindows PARAMS ((TuiWinInfoPtr));
extern int tuiDefaultTabLen PARAMS ((void));
extern void tuiSetDefaultTabLen PARAMS ((int));
extern TuiWinInfoPtr tuiWinWithFocus PARAMS ((void));
extern void tuiSetWinWithFocus PARAMS ((TuiWinInfoPtr));
extern TuiLayoutDefPtr tuiLayoutDef PARAMS ((void));
extern int tuiWinResized PARAMS ((void));
extern void tuiSetWinResizedTo PARAMS ((int));
extern TuiWinInfoPtr tuiNextWin PARAMS ((TuiWinInfoPtr));
extern TuiWinInfoPtr tuiPrevWin PARAMS ((TuiWinInfoPtr));
#endif /* TUI_DATA_H */

400
gdb/tui/tuiDataWin.c Normal file
View File

@ -0,0 +1,400 @@
/*
** tuiDataWin.c
** This module contains functions to support the data/register window display.
*/
#include "defs.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiRegs.h"
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
/*****************************************
** PUBLIC FUNCTIONS **
******************************************/
/*
** tuiFirstDataItemDisplayed()
** Answer the index first element displayed.
** If none are displayed, then return (-1).
*/
int
#ifdef __STDC__
tuiFirstDataItemDisplayed (void)
#else
tuiFirstDataItemDisplayed ()
#endif
{
int elementNo = (-1);
int i;
for (i = 0; (i < dataWin->generic.contentSize && elementNo < 0); i++)
{
TuiGenWinInfoPtr dataItemWin;
dataItemWin = &((TuiWinContent)
dataWin->generic.content)[i]->whichElement.dataWindow;
if (dataItemWin->handle != (WINDOW *) NULL && dataItemWin->isVisible)
elementNo = i;
}
return elementNo;
} /* tuiFirstDataItemDisplayed */
/*
** tuiFirstDataElementNoInLine()
** Answer the index of the first element in lineNo. If lineNo is
** past the data area (-1) is returned.
*/
int
#ifdef __STDC__
tuiFirstDataElementNoInLine (
int lineNo)
#else
tuiFirstDataElementNoInLine (lineNo)
int lineNo;
#endif
{
int firstElementNo = (-1);
/*
** First see if there is a register on lineNo, and if so, set the
** first element number
*/
if ((firstElementNo = tuiFirstRegElementNoInLine (lineNo)) == -1)
{ /*
** Looking at the general data, the 1st element on lineNo
*/
}
return firstElementNo;
} /* tuiFirstDataElementNoInLine */
/*
** tuiDeleteDataContentWindows()
** Function to delete all the item windows in the data window.
** This is usually done when the data window is scrolled.
*/
void
#ifdef __STDC__
tuiDeleteDataContentWindows (void)
#else
tuiDeleteDataContentWindows ()
#endif
{
int i;
TuiGenWinInfoPtr dataItemWinPtr;
for (i = 0; (i < dataWin->generic.contentSize); i++)
{
dataItemWinPtr = &((TuiWinContent)
dataWin->generic.content)[i]->whichElement.dataWindow;
tuiDelwin (dataItemWinPtr->handle);
dataItemWinPtr->handle = (WINDOW *) NULL;
dataItemWinPtr->isVisible = FALSE;
}
return;
} /* tuiDeleteDataContentWindows */
void
#ifdef __STDC__
tuiEraseDataContent (
char *prompt)
#else
tuiEraseDataContent (prompt)
char *prompt;
#endif
{
werase (dataWin->generic.handle);
checkAndDisplayHighlightIfNeeded (dataWin);
if (prompt != (char *) NULL)
{
int halfWidth = (dataWin->generic.width - 2) / 2;
int xPos;
if (strlen (prompt) >= halfWidth)
xPos = 1;
else
xPos = halfWidth - strlen (prompt);
mvwaddstr (dataWin->generic.handle,
(dataWin->generic.height / 2),
xPos,
prompt);
}
wrefresh (dataWin->generic.handle);
return;
} /* tuiEraseDataContent */
/*
** tuiDisplayAllData().
** This function displays the data that is in the data window's
** content. It does not set the content.
*/
void
#ifdef __STDC__
tuiDisplayAllData (void)
#else
tuiDisplayAllData ()
#endif
{
if (dataWin->generic.contentSize <= 0)
tuiEraseDataContent (NO_DATA_STRING);
else
{
tuiEraseDataContent ((char *) NULL);
tuiDeleteDataContentWindows ();
checkAndDisplayHighlightIfNeeded (dataWin);
tuiDisplayRegistersFrom (0);
/*
** Then display the other data
*/
if (dataWin->detail.dataDisplayInfo.dataContent !=
(TuiWinContent) NULL &&
dataWin->detail.dataDisplayInfo.dataContentCount > 0)
{
}
}
return;
} /* tuiDisplayAllData */
/*
** tuiDisplayDataFromLine()
** Function to display the data starting at line, lineNo, in the
** data window.
*/
void
#ifdef __STDC__
tuiDisplayDataFromLine (
int lineNo)
#else
tuiDisplayDataFromLine (lineNo)
int lineNo;
#endif
{
int _lineNo = lineNo;
if (lineNo < 0)
_lineNo = 0;
checkAndDisplayHighlightIfNeeded (dataWin);
/* there is no general data, force regs to display (if there are any) */
if (dataWin->detail.dataDisplayInfo.dataContentCount <= 0)
tuiDisplayRegistersFromLine (_lineNo, TRUE);
else
{
int elementNo, startLineNo;
int regsLastLine = tuiLastRegsLineNo ();
/* display regs if we can */
if (tuiDisplayRegistersFromLine (_lineNo, FALSE) < 0)
{ /*
** _lineNo is past the regs display, so calc where the
** start data element is
*/
if (regsLastLine < _lineNo)
{ /* figure out how many lines each element is to obtain
the start elementNo */
}
}
else
{ /*
** calculate the starting element of the data display, given
** regsLastLine and how many lines each element is, up to
** _lineNo
*/
}
/* Now display the data , starting at elementNo */
}
return;
} /* tuiDisplayDataFromLine */
/*
** tuiDisplayDataFrom()
** Display data starting at element elementNo
*/
void
#ifdef __STDC__
tuiDisplayDataFrom (
int elementNo,
int reuseWindows)
#else
tuiDisplayDataFrom (elementNo, reuseWindows)
int elementNo;
int reuseWindows;
#endif
{
int firstLine = (-1);
if (elementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
firstLine = tuiLineFromRegElementNo (elementNo);
else
{ /* calculate the firstLine from the element number */
}
if (firstLine >= 0)
{
tuiEraseDataContent ((char *) NULL);
if (!reuseWindows)
tuiDeleteDataContentWindows ();
tuiDisplayDataFromLine (firstLine);
}
return;
} /* tuiDisplayDataFrom */
/*
** tuiRefreshDataWin()
** Function to redisplay the contents of the data window.
*/
void
#ifdef __STDC__
tuiRefreshDataWin (void)
#else
tuiRefreshDataWin ()
#endif
{
tuiEraseDataContent ((char *) NULL);
if (dataWin->generic.contentSize > 0)
{
int firstElement = tuiFirstDataItemDisplayed ();
if (firstElement >= 0) /* re-use existing windows */
tuiDisplayDataFrom (firstElement, TRUE);
}
return;
} /* tuiRefreshDataWin */
/*
** tuiCheckDataValues().
** Function to check the data values and hilite any that have changed
*/
void
#ifdef __STDC__
tuiCheckDataValues (
struct frame_info *frame)
#else
tuiCheckDataValues (frame)
struct frame_info *frame;
#endif
{
tuiCheckRegisterValues (frame);
/* Now check any other data values that there are */
if (m_winPtrNotNull (dataWin) && dataWin->generic.isVisible)
{
int i;
for (i = 0; dataWin->detail.dataDisplayInfo.dataContentCount; i++)
{
#ifdef LATER
TuiDataElementPtr dataElementPtr;
TuiGenWinInfoPtr dataItemWinPtr;
Opaque newValue;
dataItemPtr = &dataWin->detail.dataDisplayInfo.
dataContent[i]->whichElement.dataWindow;
dataElementPtr = &((TuiWinContent)
dataItemWinPtr->content)[0]->whichElement.data;
if value
has changed (dataElementPtr, frame, &newValue)
{
dataElementPtr->value = newValue;
update the display with the new value, hiliting it.
}
#endif
}
}
} /* tuiCheckDataValues */
/*
** tui_vCheckDataValues().
** Function to check the data values and hilite any that have
** changed with args in a va_list
*/
void
#ifdef __STDC__
tui_vCheckDataValues (
va_list args)
#else
tui_vCheckDataValues (args)
va_list args;
#endif
{
struct frame_info *frame = va_arg (args, struct frame_info *);
tuiCheckDataValues (frame);
return;
} /* tui_vCheckDataValues */
/*
** tuiVerticalDataScroll()
** Scroll the data window vertically forward or backward.
*/
void
#ifdef __STDC__
tuiVerticalDataScroll (
TuiScrollDirection scrollDirection,
int numToScroll)
#else
tuiVerticalDataScroll (scrollDirection, numToScroll)
TuiScrollDirection scrollDirection;
int numToScroll;
#endif
{
int firstElementNo;
int firstLine = (-1);
firstElementNo = tuiFirstDataItemDisplayed ();
if (firstElementNo < dataWin->detail.dataDisplayInfo.regsContentCount)
firstLine = tuiLineFromRegElementNo (firstElementNo);
else
{ /* calculate the first line from the element number which is in
** the general data content
*/
}
if (firstLine >= 0)
{
int lastElementNo, lastLine;
if (scrollDirection == FORWARD_SCROLL)
firstLine += numToScroll;
else
firstLine -= numToScroll;
tuiEraseDataContent ((char *) NULL);
tuiDeleteDataContentWindows ();
tuiDisplayDataFromLine (firstLine);
}
return;
} /* tuiVerticalDataScroll */
/*****************************************
** STATIC LOCAL FUNCTIONS **
******************************************/

29
gdb/tui/tuiDataWin.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef _TUI_DATAWIN_H
#define _TUI_DATAWIN_H
/*
** This header file supports the display of registers/data in the data window.
*/
/*****************************************
** TYPE DEFINITIONS **
******************************************/
/*****************************************
** PUBLIC FUNCTION EXTERNAL DECLS **
******************************************/
extern void tuiEraseDataContent PARAMS ((char *));
extern void tuiDisplayAllData PARAMS ((void));
extern void tuiCheckDataValues PARAMS ((struct frame_info *));
extern void tui_vCheckDataValues PARAMS ((va_list));
extern void tuiDisplayDataFromLine PARAMS ((int));
extern int tuiFirstDataItemDisplayed PARAMS ((void));
extern int tuiFirstDataElementNoInLine PARAMS ((int));
extern void tuiDeleteDataContentWindows PARAMS ((void));
extern void tuiRefreshDataWin PARAMS ((void));
extern void tuiDisplayDataFrom PARAMS ((int, int));
extern void tuiVerticalDataScroll PARAMS ((TuiScrollDirection, int));
#endif /*_TUI_DATAWIN_H*/

343
gdb/tui/tuiDisassem.c Normal file
View File

@ -0,0 +1,343 @@
/*
** tuiDisassem.c
** This module contains functions for handling disassembly display.
*/
#include "defs.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiLayout.h"
#include "tuiSourceWin.h"
#include "tuiStack.h"
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
static struct breakpoint *_hasBreak PARAMS ((CORE_ADDR));
/*****************************************
** PUBLIC FUNCTIONS **
******************************************/
/*
** tuiSetDisassemContent().
** Function to set the disassembly window's content.
*/
TuiStatus
#ifdef __STDC__
tuiSetDisassemContent (
struct symtab *s,
Opaque startAddr)
#else
tuiSetDisassemContent (s, startAddr)
struct symtab *s;
Opaque startAddr;
#endif
{
TuiStatus ret = TUI_FAILURE;
GDB_FILE *gdb_dis_out;
if (startAddr != (Opaque) NULL)
{
register int i, desc;
if ((ret = tuiAllocSourceBuffer (disassemWin)) == TUI_SUCCESS)
{
register int offset = disassemWin->detail.sourceInfo.horizontalOffset;
register int threshold, curLine = 0, lineWidth, maxLines;
CORE_ADDR newpc, pc;
disassemble_info asmInfo;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
extern void strcat_address PARAMS ((CORE_ADDR, char *, int));
extern void strcat_address_numeric PARAMS ((CORE_ADDR, int, char *, int));
int curLen = 0;
int tab_len = tuiDefaultTabLen ();
maxLines = disassemWin->generic.height - 2; /* account for hilite */
lineWidth = disassemWin->generic.width - 1;
threshold = (lineWidth - 1) + offset;
/* now init the gdb_file structure */
gdb_dis_out = gdb_file_init_astring (threshold);
INIT_DISASSEMBLE_INFO_NO_ARCH (asmInfo, gdb_dis_out, (fprintf_ftype) fprintf_filtered);
asmInfo.read_memory_func = dis_asm_read_memory;
asmInfo.memory_error_func = dis_asm_memory_error;
disassemWin->detail.sourceInfo.startLineOrAddr.addr = startAddr;
/* Now construct each line */
for (curLine = 0, pc = (CORE_ADDR) startAddr; (curLine < maxLines);)
{
TuiWinElementPtr element = (TuiWinElementPtr)disassemWin->generic.content[curLine];
struct breakpoint *bp;
print_address (pc, gdb_dis_out);
curLen = strlen (gdb_file_get_strbuf (gdb_dis_out));
i = curLen - ((curLen / tab_len) * tab_len);
/* adjust buffer length if necessary */
gdb_file_adjust_strbuf ((tab_len - i > 0) ? (tab_len - i ) : 0, gdb_dis_out);
/* Add spaces to make the instructions start onthe same column */
while (i < tab_len)
{
gdb_file_get_strbuf (gdb_dis_out)[curLen] = ' ';
i++;
curLen++;
}
gdb_file_get_strbuf (gdb_dis_out)[curLen] = '\0';
newpc = pc + ((*tm_print_insn) (pc, &asmInfo));
/* Now copy the line taking the offset into account */
if (strlen (gdb_file_get_strbuf (gdb_dis_out)) > offset)
strcpy (element->whichElement.source.line,
&(gdb_file_get_strbuf (gdb_dis_out)[offset]));
else
element->whichElement.source.line[0] = '\0';
element->whichElement.source.lineOrAddr.addr = (Opaque) pc;
element->whichElement.source.isExecPoint =
(pc == (CORE_ADDR) ((TuiWinElementPtr)locator->content[0])->whichElement.locator.addr);
bp = _hasBreak (pc);
element->whichElement.source.hasBreak =
(bp != (struct breakpoint *) NULL &&
(!element->whichElement.source.isExecPoint ||
(bp->disposition != del || bp->hit_count <= 0)));
curLine++;
pc = newpc;
/* reset the buffer to empty */
gdb_file_get_strbuf (gdb_dis_out)[0] = '\0';
}
gdb_file_deallocate (&gdb_dis_out);
disassemWin->generic.contentSize = curLine;
ret = TUI_SUCCESS;
}
}
return ret;
} /* tuiSetDisassemContent */
/*
** tuiShowDisassem().
** Function to display the disassembly window with disassembled code.
*/
void
#ifdef __STDC__
tuiShowDisassem (
Opaque startAddr)
#else
tuiShowDisassem (startAddr)
Opaque startAddr;
#endif
{
struct symtab *s = find_pc_symtab ((CORE_ADDR) startAddr);
TuiWinInfoPtr winWithFocus = tuiWinWithFocus ();
tuiAddWinToLayout (DISASSEM_WIN);
tuiUpdateSourceWindow (disassemWin, s, startAddr, FALSE);
/*
** if the focus was in the src win, put it in the asm win, if the
** source view isn't split
*/
if (currentLayout () != SRC_DISASSEM_COMMAND && winWithFocus == srcWin)
tuiSetWinFocusTo (disassemWin);
return;
} /* tuiShowDisassem */
/*
** tuiShowDisassemAndUpdateSource().
** Function to display the disassembly window.
*/
void
#ifdef __STDC__
tuiShowDisassemAndUpdateSource (
Opaque startAddr)
#else
tuiShowDisassemAndUpdateSource (startAddr)
Opaque startAddr;
#endif
{
struct symtab_and_line sal;
tuiShowDisassem (startAddr);
if (currentLayout () == SRC_DISASSEM_COMMAND)
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
/*
** Update what is in the source window if it is displayed too,
** note that it follows what is in the disassembly window and visa-versa
*/
sal = find_pc_line ((CORE_ADDR) startAddr, 0);
current_source_symtab = sal.symtab;
tuiUpdateSourceWindow (srcWin, sal.symtab, (Opaque) sal.line, TRUE);
tuiUpdateLocatorFilename (sal.symtab->filename);
}
return;
} /* tuiShowDisassemAndUpdateSource */
/*
** tuiShowDisassemAsIs().
** Function to display the disassembly window. This function shows
** the disassembly as specified by the horizontal offset.
*/
void
#ifdef __STDC__
tuiShowDisassemAsIs (
Opaque addr)
#else
tuiShowDisassemAsIs (addr)
Opaque addr;
#endif
{
tuiAddWinToLayout (DISASSEM_WIN);
tuiUpdateSourceWindowAsIs (disassemWin, (struct symtab *) NULL, addr, FALSE);
/*
** Update what is in the source window if it is displayed too, not that it
** follows what is in the disassembly window and visa-versa
*/
if (currentLayout () == SRC_DISASSEM_COMMAND)
tuiShowSourceContent (srcWin); /*???? Need to do more? */
return;
} /* tuiShowDisassem */
/*
** tuiGetBeginAsmAddress().
*/
Opaque
#ifdef __STDC__
tuiGetBeginAsmAddress (void)
#else
tuiGetBeginAsmAddress ()
#endif
{
TuiGenWinInfoPtr locator;
TuiLocatorElementPtr element;
Opaque addr;
locator = locatorWinInfoPtr ();
element = &((TuiWinElementPtr) locator->content[0])->whichElement.locator;
if (element->addr == (Opaque) 0)
{
/*the target is not executing, because the pc is 0*/
addr = (Opaque) parse_and_eval_address ("main");
if (addr == (Opaque) 0)
addr = (Opaque) parse_and_eval_address ("MAIN");
}
else /* the target is executing */
addr = element->addr;
return addr;
} /* tuiGetBeginAsmAddress */
/*
** tuiVerticalDisassemScroll().
** Scroll the disassembly forward or backward vertically
*/
void
#ifdef __STDC__
tuiVerticalDisassemScroll (
TuiScrollDirection scrollDirection,
int numToScroll)
#else
tuiVerticalDisassemScroll (scrollDirection, numToScroll)
TuiScrollDirection scrollDirection;
int numToScroll;
#endif
{
if (disassemWin->generic.content != (OpaquePtr) NULL)
{
Opaque pc, lowAddr;
TuiWinContent content;
struct symtab *s;
content = (TuiWinContent) disassemWin->generic.content;
if (current_source_symtab == (struct symtab *) NULL)
s = find_pc_symtab (selected_frame->pc);
else
s = current_source_symtab;
pc = content[0]->whichElement.source.lineOrAddr.addr;
if (find_pc_partial_function ((CORE_ADDR) pc,
(char **) NULL,
(CORE_ADDR *) & lowAddr,
(CORE_ADDR) NULL) == 0)
error ("No function contains prgram counter for selected frame.\n");
else
{
register int line = 0;
register Opaque newLow;
bfd_byte buffer[4];
newLow = pc;
if (scrollDirection == FORWARD_SCROLL)
{
for (; line < numToScroll; line++)
newLow += sizeof (bfd_getb32 (buffer));
}
else
{
for (; newLow >= (Opaque) 0 && line < numToScroll; line++)
newLow -= sizeof (bfd_getb32 (buffer));
}
tuiUpdateSourceWindowAsIs (disassemWin, s, newLow, FALSE);
}
}
return;
} /* tuiVerticalDisassemScroll */
/*****************************************
** STATIC LOCAL FUNCTIONS **
******************************************/
/*
** _hasBreak().
** Answer whether there is a break point at the input line in the
** source file indicated
*/
static struct breakpoint *
#ifdef __STDC__
_hasBreak (
CORE_ADDR addr)
#else
_hasBreak (addr)
CORE_ADDR addr;
#endif
{
struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
for (bp = breakpoint_chain;
(bp != (struct breakpoint *) NULL &&
bpWithBreak == (struct breakpoint *) NULL);
bp = bp->next)
if (addr == bp->address)
bpWithBreak = bp;
return bpWithBreak;
} /* _hasBreak */

22
gdb/tui/tuiDisassem.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef _TUI_DISASSEM_H
#define _TUI_DISASSEM_H
/*
** This header file supports
*/
/*****************************************
** TYPE DEFINITIONS **
******************************************/
/*****************************************
** PUBLIC FUNCTION EXTERNAL DECLS **
******************************************/
extern TuiStatus tuiSetDisassemContent PARAMS ((struct symtab *, Opaque));
extern void tuiShowDisassem PARAMS ((Opaque));
extern void tuiShowDisassemAndUpdateSource PARAMS ((Opaque));
extern void tuiVerticalDisassemScroll PARAMS ((TuiScrollDirection, int));
extern Opaque tuiGetBeginAsmAddress PARAMS ((void));
#endif /*_TUI_DISASSEM_H*/

469
gdb/tui/tuiGeneralWin.c Normal file
View File

@ -0,0 +1,469 @@
/*
** TuiGeneralWin.c
** This module supports general window behavior
*/
#include <curses.h>
#include "defs.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiGeneralWin.h"
/*
** local support functions
*/
static void _winResize PARAMS ((void));
/***********************
** PUBLIC FUNCTIONS
***********************/
/*
** tuiRefreshWin()
** Refresh the window
*/
void
#ifdef __STDC__
tuiRefreshWin (
TuiGenWinInfoPtr winInfo)
#else
tuiRefreshWin (winInfo)
TuiGenWinInfoPtr winInfo;
#endif
{
if (winInfo->type == DATA_WIN && winInfo->contentSize > 0)
{
int i;
for (i = 0; (i < winInfo->contentSize); i++)
{
TuiGenWinInfoPtr dataItemWinPtr;
dataItemWinPtr = &((TuiWinContent)
winInfo->content)[i]->whichElement.dataWindow;
if (m_genWinPtrNotNull (dataItemWinPtr) &&
dataItemWinPtr->handle != (WINDOW *) NULL)
wrefresh (dataItemWinPtr->handle);
}
}
else if (winInfo->type == CMD_WIN)
{
/* Do nothing */
}
else
{
if (winInfo->handle != (WINDOW *) NULL)
wrefresh (winInfo->handle);
}
return;
} /* tuiRefreshWin */
/*
** tuiDelwin()
** Function to delete the curses window, checking for null
*/
void
#ifdef __STDC__
tuiDelwin (
WINDOW * window)
#else
tuiDelwin (window)
WINDOW *window;
#endif
{
if (window != (WINDOW *) NULL)
delwin (window);
return;
} /* tuiDelwin */
/*
** boxWin().
*/
void
#ifdef __STDC__
boxWin (
TuiGenWinInfoPtr winInfo,
int highlightFlag)
#else
boxWin (winInfo, highlightFlag)
TuiGenWinInfoPtr winInfo;
int highlightFlag;
#endif
{
if (m_genWinPtrNotNull (winInfo) && winInfo->handle != (WINDOW *) NULL)
{
if (highlightFlag == HILITE)
box (winInfo->handle, '|', '-');
else
{
/* wattron(winInfo->handle, A_DIM);*/
box (winInfo->handle, ':', '.');
/* wattroff(winInfo->handle, A_DIM);*/
}
}
return;
} /* boxWin */
/*
** unhighlightWin().
*/
void
#ifdef __STDC__
unhighlightWin (
TuiWinInfoPtr winInfo)
#else
unhighlightWin (winInfo)
TuiWinInfoPtr winInfo;
#endif
{
if (m_winPtrNotNull (winInfo) && winInfo->generic.handle != (WINDOW *) NULL)
{
boxWin ((TuiGenWinInfoPtr) winInfo, NO_HILITE);
wrefresh (winInfo->generic.handle);
m_setWinHighlightOff (winInfo);
}
} /* unhighlightWin */
/*
** highlightWin().
*/
void
#ifdef __STDC__
highlightWin (
TuiWinInfoPtr winInfo)
#else
highlightWin (winInfo)
TuiWinInfoPtr winInfo;
#endif
{
if (m_winPtrNotNull (winInfo) &&
winInfo->canHighlight && winInfo->generic.handle != (WINDOW *) NULL)
{
boxWin ((TuiGenWinInfoPtr) winInfo, HILITE);
wrefresh (winInfo->generic.handle);
m_setWinHighlightOn (winInfo);
}
} /* highlightWin */
/*
** checkAndDisplayHighlightIfNecessay
*/
void
#ifdef __STDC__
checkAndDisplayHighlightIfNeeded (
TuiWinInfoPtr winInfo)
#else
checkAndDisplayHighlightIfNeeded (winInfo)
TuiWinInfoPtr winInfo;
#endif
{
if (m_winPtrNotNull (winInfo) && winInfo->generic.type != CMD_WIN)
{
if (winInfo->isHighlighted)
highlightWin (winInfo);
else
unhighlightWin (winInfo);
}
return;
} /* checkAndDisplayHighlightIfNeeded */
/*
** makeWindow().
*/
void
#ifdef __STDC__
makeWindow (
TuiGenWinInfoPtr winInfo,
int boxIt)
#else
makeWindow (winInfo, boxIt)
TuiGenWinInfoPtr winInfo;
int boxIt;
#endif
{
WINDOW *handle;
handle = newwin (winInfo->height,
winInfo->width,
winInfo->origin.y,
winInfo->origin.x);
winInfo->handle = handle;
if (handle != (WINDOW *) NULL)
{
if (boxIt == BOX_WINDOW)
boxWin (winInfo, NO_HILITE);
winInfo->isVisible = TRUE;
scrollok (handle, TRUE);
tuiRefreshWin (winInfo);
#ifndef FOR_TEST
if ( /*!m_WinIsAuxillary(winInfo->type) && */
(winInfo->type != CMD_WIN) &&
(winInfo->content == (OpaquePtr) NULL))
{
mvwaddstr (handle, 1, 1, winName (winInfo));
tuiRefreshWin (winInfo);
}
#endif /*FOR_TEST*/
}
return;
} /* makeWindow */
/*
** tuiClearWin().
** Clear the window of all contents without calling wclear.
*/
void
#ifdef __STDC__
tuiClearWin (
TuiGenWinInfoPtr winInfo)
#else
tuiClearWin (winInfo)
TuiGenWinInfoPtr winInfo;
#endif
{
if (m_genWinPtrNotNull (winInfo) && winInfo->handle != (WINDOW *) NULL)
{
int curRow, curCol;
for (curRow = 0; (curRow < winInfo->height); curRow++)
for (curCol = 0; (curCol < winInfo->width); curCol++)
mvwaddch (winInfo->handle, curRow, curCol, ' ');
tuiRefreshWin (winInfo);
}
return;
} /* tuiClearWin */
/*
** makeVisible().
** We can't really make windows visible, or invisible. So we
** have to delete the entire window when making it visible,
** and create it again when making it visible.
*/
void
#ifdef __STDC__
makeVisible (
TuiGenWinInfoPtr winInfo,
int visible)
#else
makeVisible (winInfo, visible)
TuiGenWinInfoPtr winInfo;
int visible;
#endif
{
/* Don't tear down/recreate command window */
if (winInfo->type == CMD_WIN)
return;
if (visible)
{
if (!winInfo->isVisible)
{
makeWindow (
winInfo,
(winInfo->type != CMD_WIN && !m_winIsAuxillary (winInfo->type)));
winInfo->isVisible = TRUE;
}
tuiRefreshWin (winInfo);
}
else if (!visible &&
winInfo->isVisible && winInfo->handle != (WINDOW *) NULL)
{
winInfo->isVisible = FALSE;
tuiClearWin (winInfo);
tuiDelwin (winInfo->handle);
winInfo->handle = (WINDOW *) NULL;
}
return;
} /* makeVisible */
/*
** makeAllVisible().
** Makes all windows invisible (except the command and locator windows)
*/
void
#ifdef __STDC__
makeAllVisible (
int visible)
#else
makeAllVisible (visible)
int visible;
#endif
{
int i;
for (i = 0; i < MAX_MAJOR_WINDOWS; i++)
{
if (m_winPtrNotNull (winList[i]) &&
((winList[i])->generic.type) != CMD_WIN)
{
if (m_winIsSourceType ((winList[i])->generic.type))
makeVisible ((winList[i])->detail.sourceInfo.executionInfo,
visible);
makeVisible ((TuiGenWinInfoPtr) winList[i], visible);
}
}
return;
} /* makeAllVisible */
/*
** scrollWinForward
*/
void
#ifdef __STDC__
scrollWinForward (
TuiGenWinInfoPtr winInfo,
int numLines)
#else
scrollWinForward (winInfo, numLines)
TuiGenWinInfoPtr winInfo;
int numLines;
#endif
{
if (winInfo->content != (OpaquePtr) NULL &&
winInfo->lastVisibleLine < winInfo->contentSize - 1)
{
int i, firstLine, newLastLine;
firstLine = winInfo->lastVisibleLine - winInfo->viewportHeight + 1;
if (winInfo->lastVisibleLine + numLines > winInfo->contentSize)
newLastLine = winInfo->contentSize - 1;
else
newLastLine = winInfo->lastVisibleLine + numLines - 1;
for (i = (newLastLine - winInfo->viewportHeight);
(i <= newLastLine); i++)
{
TuiWinElementPtr line;
int lineHeight;
line = (TuiWinElementPtr) winInfo->content[i];
if (line->highlight)
wstandout (winInfo->handle);
mvwaddstr (winInfo->handle,
i - (newLastLine - winInfo->viewportHeight),
1,
displayableWinContentOf (winInfo, line));
if (line->highlight)
wstandend (winInfo->handle);
lineHeight = winElementHeight (winInfo, line);
newLastLine += (lineHeight - 1);
}
winInfo->lastVisibleLine = newLastLine;
}
return;
} /* scrollWinForward */
/*
** scrollWinBackward
*/
void
#ifdef __STDC__
scrollWinBackward (
TuiGenWinInfoPtr winInfo,
int numLines)
#else
scrollWinBackward (winInfo, numLines)
TuiGenWinInfoPtr winInfo;
int numLines;
#endif
{
if (winInfo->content != (OpaquePtr) NULL &&
(winInfo->lastVisibleLine - winInfo->viewportHeight) > 0)
{
int i, newLastLine, firstLine;
firstLine = winInfo->lastVisibleLine - winInfo->viewportHeight + 1;
if ((firstLine - numLines) < 0)
newLastLine = winInfo->viewportHeight - 1;
else
newLastLine = winInfo->lastVisibleLine - numLines + 1;
for (i = newLastLine - winInfo->viewportHeight; (i <= newLastLine); i++)
{
TuiWinElementPtr line;
int lineHeight;
line = (TuiWinElementPtr) winInfo->content[i];
if (line->highlight)
wstandout (winInfo->handle);
mvwaddstr (winInfo->handle,
i - (newLastLine - winInfo->viewportHeight),
1,
displayableWinContentOf (winInfo, line));
if (line->highlight)
wstandend (winInfo->handle);
lineHeight = winElementHeight (winInfo, line);
newLastLine += (lineHeight - 1);
}
winInfo->lastVisibleLine = newLastLine;
}
return;
} /* scrollWinBackward */
/*
** refreshAll().
** Function to refresh all the windows currently displayed
*/
void
#ifdef __STDC__
refreshAll (
TuiWinInfoPtr * list)
#else
refreshAll (list)
TuiWinInfoPtr *list;
#endif
{
TuiWinType type;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
{
if (list[type]->generic.isVisible)
{
if (type == SRC_WIN || type == DISASSEM_WIN)
{
touchwin (list[type]->detail.sourceInfo.executionInfo->handle);
tuiRefreshWin (list[type]->detail.sourceInfo.executionInfo);
}
touchwin (list[type]->generic.handle);
tuiRefreshWin (&list[type]->generic);
}
}
if (locator->isVisible)
{
touchwin (locator->handle);
tuiRefreshWin (locator);
}
return;
} /* refreshAll */
/*********************************
** Local Static Functions
*********************************/

31
gdb/tui/tuiGeneralWin.h Normal file
View File

@ -0,0 +1,31 @@
#ifndef TUI_GENERAL_WIN_H
#define TUI_GENERAL_WIN_H
/*
** Functions
*/
extern void tuiClearWin PARAMS ((TuiGenWinInfoPtr));
extern void unhighlightWin PARAMS ((TuiWinInfoPtr));
extern void makeVisible PARAMS ((TuiGenWinInfoPtr, int));
extern void makeAllVisible PARAMS ((int));
extern void scrollWinForward PARAMS ((TuiGenWinInfoPtr, int));
extern void scrollWinBackward PARAMS ((TuiGenWinInfoPtr, int));
extern void makeWindow PARAMS ((TuiGenWinInfoPtr, int));
extern TuiWinInfoPtr copyWin PARAMS ((TuiWinInfoPtr));
extern void boxWin PARAMS ((TuiGenWinInfoPtr, int));
extern void highlightWin PARAMS ((TuiWinInfoPtr));
extern void checkAndDisplayHighlightIfNeeded PARAMS ((TuiWinInfoPtr));
extern void refreshAll PARAMS ((TuiWinInfoPtr *));
extern void tuiDelwin PARAMS ((WINDOW *window));
extern void tuiRefreshWin PARAMS ((TuiGenWinInfoPtr));
/*
** Macros
*/
#define m_beVisible(winInfo) makeVisible((TuiGenWinInfoPtr)(winInfo), TRUE)
#define m_beInvisible(winInfo) \
makeVisible((TuiGenWinInfoPtr)(winInfo), FALSE)
#define m_allBeVisible() makeAllVisible(TRUE)
#define m_allBeInvisible() makeAllVisible(FALSE)
#endif /*TUI_GENERAL_WIN_H*/

734
gdb/tui/tuiIO.c Normal file
View File

@ -0,0 +1,734 @@
/*
** This module contains functions to support i/o in the TUI
*/
#include <stdio.h>
#include "defs.h"
#include "terminal.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiIO.h"
#include "tuiCommand.h"
#include "tuiWin.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
/* The Solaris header files seem to provide no declaration for this at
all when __STDC__ is defined. This shouldn't conflict with
anything. */
extern char *tgoto ();
int insert_mode = 0;
/********************************************
** LOCAL STATIC FORWARD DECLS **
********************************************/
static void _updateCommandInfo PARAMS ((int));
static unsigned int _tuiHandleResizeDuringIO PARAMS ((unsigned int));
/*********************************************************************************
** PUBLIC FUNCTIONS **
*********************************************************************************/
/*
** tuiPuts_unfiltered().
** Function to put a string to the command window
** When running in TUI mode, this is the "hook"
** for fputs_unfiltered(). That is, all debugger
** output eventually makes it's way to the bottom-level
** routine fputs_unfiltered (main.c), which (in TUI
** mode), calls tuiPuts_unfiltered().
*/
void
#ifdef __STDC__
tuiPuts_unfiltered (
const char *string,
GDB_FILE * stream)
#else
tuiPuts_unfiltered (string, stream)
char *string;
GDB_FILE *stream;
#endif
{
int len = strlen (string);
int i, linech;
for (i = 0; i < len; i++)
{
if (string[i] == '\n' || string[i] == '\r')
m_tuiStartNewLine;
else
{
if ((cmdWin->detail.commandInfo.curch + 1) > cmdWin->generic.width)
m_tuiStartNewLine;
if (insert_mode)
{
mvwinsch (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
cmdWin->detail.commandInfo.curch++,
string[i]);
wmove (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
cmdWin->detail.commandInfo.curch);
}
else
mvwaddch (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
cmdWin->detail.commandInfo.curch++,
string[i]);
}
}
tuiRefreshWin (&cmdWin->generic);
return;
} /* tuiPuts_unfiltered */
/* A cover routine for tputs().
* tputs() is called from the readline package to put
* out strings representing cursor positioning.
* In TUI mode (non-XDB-style), tui_tputs() is called instead.
*
* The reason we need to hook tputs() is:
* Since the output is going to curses and not to
* a raw terminal, we need to intercept these special
* sequences, and handle them them here.
*
* This function seems to be correctly handling all sequences
* aimed at hpterm's, but there is additional work to do
* for xterm's and dtterm's. I abandoned further work on this
* in favor of "XDB style". In "XDB style", the command region
* looks like terminal, not a curses window, and this routine
* is not called. - RT
*/
void
tui_tputs (str, affcnt, putfunc)
char *str;
int affcnt;
int (*putfunc) PARAMS ((int));
{
extern char *rl_prompt; /* the prompt string */
/* This set of globals are defined and initialized
* by the readline package.
*
* Note we're assuming tui_tputs() is being called
* by the readline package. That's because we're recognizing
* that a given string is being passed by
* matching the string address against readline's
* term_<whatever> global. To make this more general,
* we'd have to actually recognize the termcap sequence
* inside the string (more work than I want to do). - RT
*
* We don't see or need to handle every one of these here;
* this is just the full list defined in readline/readline.c
*/
extern char *term_backspace;
extern char *term_clreol;
extern char *term_clrpag;
extern char *term_cr;
extern char *term_dc;
extern char *term_ei;
extern char *term_goto;
extern char *term_ic;
extern char *term_im;
extern char *term_mm;
extern char *term_mo;
extern char *term_up;
extern char *term_scroll_region;
extern char *term_memory_lock;
extern char *term_memory_unlock;
extern char *term_cursor_move;
extern char *visible_bell;
/* Sanity check - if not TUI, just call tputs() */
if (!tui_version)
tputs (str, affcnt, putfunc);
/* The strings we special-case are handled first */
if (str == term_backspace)
{
/* Backspace. */
/* We see this on an emacs control-B.
* I.e., it's like the left-arrow key (not like the backspace key).
* The effect that readline wants when it transmits this
* character to us is simply to back up one character
* (but not to write a space over the old character).
*/
_updateCommandInfo (-1);
wmove (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
cmdWin->detail.commandInfo.curch);
wrefresh (cmdWin->generic.handle);
}
else if (str == term_clreol)
{
/* Clear to end of line. */
wclrtoeol (cmdWin->generic.handle);
wrefresh (cmdWin->generic.handle);
}
else if (str == term_cr)
{
/* Carriage return */
_updateCommandInfo (-cmdWin->detail.commandInfo.curch);
wmove (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
0 /* readline will rewrite the prompt from 0 */ );
wrefresh (cmdWin->generic.handle);
}
else if (str == term_goto)
{
/* This is actually a tgoto() specifying a character position,
* followed by either a term_IC/term_DC which [I think] means
* insert/delete one character at that position.
* There are complications with this one - need to either
* extract the position from the string, or have a backdoor
* means of communicating it from ../readline/display.c.
* So this one is not yet implemented.
* Not doing it seems to have no ill effects on command-line-editing
* that I've noticed so far. - RT
*/
}
else if (str == term_dc)
{
/* Delete character at current cursor position */
wdelch (cmdWin->generic.handle);
wrefresh (cmdWin->generic.handle);
}
else if (str == term_im)
{
/* Turn on insert mode. */
insert_mode = 1;
}
else if (str == term_ei)
{
/* Turn off insert mode. */
insert_mode = 0;
/* Strings we know about but don't handle
* specially here are just passed along to tputs().
*
* These are not handled because (as far as I can tell)
* they are not actually emitted by the readline package
* in the course of doing command-line editing. Some of them
* theoretically could be used in the future, in which case we'd
* need to handle them.
*/
}
else if (str == term_ic || /* insert character */
str == term_cursor_move || /* cursor move */
str == term_clrpag ||/* clear page */
str == term_mm || /* turn on meta key */
str == term_mo || /* turn off meta key */
str == term_up || /* up one line (not expected) */
str == term_scroll_region || /* set scroll region */
str == term_memory_lock || /* lock screen above cursor */
str == term_memory_unlock || /* unlock screen above cursor */
str == visible_bell)
{ /* flash screen */
tputs (str, affcnt, putfunc);
}
else
{ /* something else */
tputs (str, affcnt, putfunc);
}
} /* tui_tputs */
/*
** tui_vwgetch()
** Wrapper around wgetch with the window in a va_list
*/
unsigned int
#ifdef __STDC__
tui_vwgetch (va_list args)
#else
tui_vwgetch (args)
va_list args;
#endif
{
unsigned int ch;
WINDOW *window;
window = va_arg (args, WINDOW *);
return ((unsigned int) wgetch (window));
} /* tui_vwgetch */
/*
** tui_vread()
** Wrapper around read() with paramets in a va_list
*/
unsigned int
#ifdef __STDC__
tui_vread (va_list args)
#else
tui_vread (args)
va_list args;
#endif
{
int result = 0;
int filedes = va_arg (args, int);
char *buf = va_arg (args, char *);
int nbytes = va_arg (args, int);
result = read (filedes, buf, nbytes);
return result;
} /* tui_vread() */
/*
** tuiRead()
** Function to perform a read() catching resize events
*/
int
#ifdef __STDC__
tuiRead (
int filedes,
char *buf,
int nbytes)
#else
tuiRead (filedes, buf, nbytes)
int filedes;
char *buf;
int nbytes;
#endif
{
int result = 0;
result = (int) vcatch_errors ((OpaqueFuncPtr) tui_vread, filedes, buf, nbytes);
*buf = _tuiHandleResizeDuringIO (*buf);
return result;
} /* tuiRead */
/*
** tuiGetc().
** Get a character from the command window.
** This is called from the readline package,
** that is, we have:
** tuiGetc() [here], called from
** readline code [in ../readline/], called from
** command_line_input() in top.c
*/
unsigned int
#ifdef __STDC__
tuiGetc (void)
#else
tuiGetc ()
#endif
{
unsigned int ch;
extern char *rl_prompt;
extern char *rl_line_buffer;
extern int rl_point;
/* Call the curses routine that reads one character */
#ifndef COMMENT
ch = (unsigned int) vcatch_errors ((OpaqueFuncPtr) tui_vwgetch,
cmdWin->generic.handle);
#else
ch = wgetch (cmdWin->generic.handle);
#endif
ch = _tuiHandleResizeDuringIO (ch);
if (m_isCommandChar (ch))
{ /* Handle prev/next/up/down here */
tuiTermSetup (0);
ch = tuiDispatchCtrlChar (ch);
cmdWin->detail.commandInfo.curch = strlen (rl_prompt) + rl_point;
tuiTermUnsetup (0, cmdWin->detail.commandInfo.curch);
}
if (ch == '\n' || ch == '\r' || ch == '\f')
cmdWin->detail.commandInfo.curch = 0;
else
tuiIncrCommandCharCountBy (1);
return ch;
} /* tuiGetc */
/*
** tuiBufferGetc().
*/
/*elz: this function reads a line of input from the user and
puts it in a static buffer. Subsequent calls to this same function
obtain one char at the time, providing the caller with a behavior
similar to fgetc. When the input is buffered, the backspaces have
the needed effect, i.e. ignore the last char active in the buffer*/
/* so far this function is called only from the query function in
utils.c*/
unsigned int
#ifdef __STDC__
tuiBufferGetc (void)
#else
tuiBufferGetc ()
#endif
{
unsigned int ch;
static unsigned char _ibuffer[512];
static int index_read = -1;
static int length_of_answer = -1;
int pos = 0;
if (length_of_answer == -1)
{
/* this is the first time through, need to read the answer*/
do
{
/* Call the curses routine that reads one character */
ch = (unsigned int) wgetch (cmdWin->generic.handle);
if (ch != '\b')
{
_ibuffer[pos] = ch;
pos++;
}
else
pos--;
}
while (ch != '\r' && ch != '\n');
length_of_answer = pos;
index_read = 0;
}
ch = _ibuffer[index_read];
index_read++;
if (index_read == length_of_answer)
{
/*this is the last time through, reset for next query*/
index_read = -1;
length_of_answer = -1;
}
wrefresh (cmdWin->generic.handle);
return (ch);
} /* tuiBufferGetc */
/*
** tuiStartNewLines().
*/
void
#ifdef __STDC__
tuiStartNewLines (
int numLines)
#else
tuiStartNewLines (numLines)
int numLines;
#endif
{
if (numLines > 0)
{
if (cmdWin->generic.viewportHeight > 1 &&
cmdWin->detail.commandInfo.curLine < cmdWin->generic.viewportHeight)
cmdWin->detail.commandInfo.curLine += numLines;
else
scroll (cmdWin->generic.handle);
cmdWin->detail.commandInfo.curch = 0;
wmove (cmdWin->generic.handle,
cmdWin->detail.commandInfo.curLine,
cmdWin->detail.commandInfo.curch);
tuiRefreshWin (&cmdWin->generic);
}
return;
} /* tuiStartNewLines */
/*
** tui_vStartNewLines().
** With numLines in a va_list
*/
void
#ifdef __STDC__
tui_vStartNewLines (
va_list args)
#else
tui_vStartNewLines (args)
va_list args;
#endif
{
int numLines = va_arg (args, int);
tuiStartNewLines (numLines);
return;
} /* tui_vStartNewLines */
/****************************************************************************
** LOCAL STATIC FUNCTIONS **
*****************************************************************************/
/*
** _tuiHandleResizeDuringIO
** This function manages the cleanup when a resize has occured
** From within a call to getch() or read. Returns the character
** to return from getc or read.
*/
static unsigned int
#ifdef __STDC__
_tuiHandleResizeDuringIO (
unsigned int originalCh) /* the char just read */
#else
_tuiHandleResizeDuringIO (originalCh)
unsigned int originalCh;
#endif
{
if (tuiWinResized ())
{
tuiDo ((TuiOpaqueFuncPtr) tuiRefreshAll);
dont_repeat ();
tuiSetWinResizedTo (FALSE);
rl_reset ();
return '\n';
}
else
return originalCh;
} /* _tuiHandleResizeDuringIO */
/*
** _updateCommandInfo().
** Function to update the command window information.
*/
static void
#ifdef __STDC__
_updateCommandInfo (
int sizeOfString)
#else
_updateCommandInfo (sizeOfString)
int sizeOfString;
#endif
{
if ((sizeOfString +
cmdWin->detail.commandInfo.curch) > cmdWin->generic.width)
{
int newCurch = sizeOfString + cmdWin->detail.commandInfo.curch;
tuiStartNewLines (1);
cmdWin->detail.commandInfo.curch = newCurch - cmdWin->generic.width;
}
else
cmdWin->detail.commandInfo.curch += sizeOfString;
return;
} /* _updateCommandInfo */
/* Looked at in main.c, fputs_unfiltered(), to decide
* if it's safe to do standard output to the command window.
*/
int tui_owns_terminal = 0;
/* Called to set up the terminal for TUI (curses) I/O.
* We do this either on our way "in" to GDB after target
* program execution, or else within tuiDo just before
* going off to TUI routines.
*/
void
#ifdef __STDC__
tuiTermSetup (
int turn_off_echo)
#else
tuiTermSetup (turn_off_echo)
int turn_off_echo;
#endif
{
char *buffer;
int start;
int end;
int endcol;
extern char *term_scroll_region;
extern char *term_cursor_move;
extern char *term_memory_lock;
extern char *term_memory_unlock;
/* Turn off echoing, since the TUI does not
* expect echoing. Below I only put in the TERMIOS
* case, since that is what applies on HP-UX. turn_off_echo
* is 1 except for the case where we're being called
* on a "quit", in which case we want to leave echo on.
*/
if (turn_off_echo)
{
#ifdef HAVE_TERMIOS
struct termios tio;
tcgetattr (0, &tio);
tio.c_lflag &= ~(ECHO);
tcsetattr (0, TCSANOW, &tio);
#endif
}
/* Compute the start and end lines of the command
* region. (Actually we only use end here)
*/
start = winList[CMD_WIN]->generic.origin.y;
end = start + winList[CMD_WIN]->generic.height - 1;
endcol = winList[CMD_WIN]->generic.width - 1;
if (term_memory_unlock)
{
/* Un-do the effect of the memory lock in terminal_inferior() */
tputs (term_memory_unlock, 1, (int (*)PARAMS ((int))) putchar);
fflush (stdout);
}
else if (term_scroll_region)
{
/* Un-do the effect of setting scroll region in terminal_inferior() */
/* I'm actually not sure how to do this (we don't know for
* sure what the scroll region was *before* we changed it),
* but I'll guess that setting it to the whole screen is
* the right thing. So, ...
*/
/* Set scroll region to be 0..end */
buffer = (char *) tgoto (term_scroll_region, end, 0);
tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
} /* else we're out of luck */
/* This is an attempt to keep the logical & physical
* cursor in synch, going into curses. Without this,
* curses seems to be confused by the fact that
* GDB has physically moved the curser on it. One
* visible effect of removing this code is that the
* locator window fails to get updated and the line
* of text that *should* go into the locator window
* often goes to the wrong place.
*/
/* What's done here is to tell curses to write a ' '
* at the bottom right corner of the screen.
* The idea is to wind up with the cursor in a known
* place.
* Note I'm relying on refresh()
* only writing what changed (the space),
* not the whole screen.
*/
standend ();
move (end, endcol - 1);
addch (' ');
refresh ();
tui_owns_terminal = 1;
} /* tuiTermSetup */
/* Called to set up the terminal for target program I/O, meaning I/O
* is confined to the command-window area. We also call this on our
* way out of tuiDo, thus setting up the terminal this way for
* debugger command I/O. */
void
#ifdef __STDC__
tuiTermUnsetup (
int turn_on_echo,
int to_column)
#else
tuiTermUnsetup (turn_on_echo, to_column)
int turn_on_echo;
int to_column;
#endif
{
int start;
int end;
int curline;
char *buffer;
/* The next bunch of things are from readline */
extern char *term_scroll_region;
extern char *term_cursor_move;
extern char *term_memory_lock;
extern char *term_memory_unlock;
extern char *term_se;
/* We need to turn on echoing, since the TUI turns it off */
/* Below I only put in the TERMIOS case, since that
* is what applies on HP-UX.
*/
if (turn_on_echo)
{
#ifdef HAVE_TERMIOS
struct termios tio;
tcgetattr (0, &tio);
tio.c_lflag |= (ECHO);
tcsetattr (0, TCSANOW, &tio);
#endif
}
/* Compute the start and end lines of the command
* region, as well as the last "real" line of
* the region (normally same as end, except when
* we're first populating the region)
*/
start = winList[CMD_WIN]->generic.origin.y;
end = start + winList[CMD_WIN]->generic.height - 1;
curline = start + winList[CMD_WIN]->detail.commandInfo.curLine;
/* We want to confine target I/O to the command region.
* In order to do so, we must either have "memory lock"
* (hpterm's) or "scroll regions" (xterm's).
*/
if (term_cursor_move && term_memory_lock)
{
/* Memory lock means lock region above cursor.
* So first position the cursor, then call memory lock.
*/
buffer = tgoto (term_cursor_move, 0, start);
tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
tputs (term_memory_lock, 1, (int (*)PARAMS ((int))) putchar);
}
else if (term_scroll_region)
{
/* Set the scroll region to the command window */
buffer = tgoto (term_scroll_region, end, start);
tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
} /* else we can't do anything about target I/O */
/* Also turn off standout mode, in case it is on */
if (term_se != NULL)
tputs (term_se, 1, (int (*)PARAMS ((int))) putchar);
/* Now go to the appropriate spot on the end line */
buffer = tgoto (term_cursor_move, to_column, end);
tputs (buffer, 1, (int (*)PARAMS ((int))) putchar);
fflush (stdout);
tui_owns_terminal = 0;
} /* tuiTermUnsetup */

43
gdb/tui/tuiIO.h Normal file
View File

@ -0,0 +1,43 @@
#ifndef _TUI_IO_H
#define _TUI_IO_H
/*
** This header contains defitions to support tuiIO.c
*/
#include <stdio.h>
extern void tuiPuts_unfiltered PARAMS ((const char *, GDB_FILE *));
extern unsigned int tuiGetc PARAMS ((void));
extern unsigned int tuiBufferGetc PARAMS ((void));
extern int tuiRead PARAMS ((int, char *, int));
extern void tuiStartNewLines PARAMS ((int));
extern void tui_vStartNewLines PARAMS ((va_list));
extern unsigned int tui_vwgetch PARAMS ((va_list));
extern void tuiTermSetup PARAMS ((int));
extern void tuiTermUnsetup PARAMS ((int, int));
#define m_tuiStartNewLine tuiStartNewLines(1)
#define m_isStartSequence(ch) (ch == 27)
#define m_isEndSequence(ch) (ch == 126)
#define m_isBackspace(ch) (ch == 8)
#define m_isDeleteChar(ch) (ch == KEY_DC)
#define m_isDeleteLine(ch) (ch == KEY_DL)
#define m_isDeleteToEol(ch) (ch == KEY_EOL)
#define m_isNextPage(ch) (ch == KEY_NPAGE)
#define m_isPrevPage(ch) (ch == KEY_PPAGE)
#define m_isLeftArrow(ch) (ch == KEY_LEFT)
#define m_isRightArrow(ch) (ch == KEY_RIGHT)
#define m_isCommandChar(ch) (m_isNextPage(ch) || m_isPrevPage(ch) || \
m_isLeftArrow(ch) || m_isRightArrow(ch) || \
(ch == KEY_UP) || (ch == KEY_DOWN) || \
(ch == KEY_SF) || (ch == KEY_SR) || \
(ch == (int)'\f') || m_isStartSequence(ch))
#define m_isXdbStyleCommandChar(ch) (m_isNextPage(ch) || m_isPrevPage(ch))
#endif /*_TUI_IO_H*/

1410
gdb/tui/tuiLayout.c Normal file

File diff suppressed because it is too large Load Diff

15
gdb/tui/tuiLayout.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef TUI_LAYOUT_H
#define TUI_LAYOUT_H
extern void showLayout PARAMS ((TuiLayoutType));
extern void tuiAddWinToLayout PARAMS ((TuiWinType));
extern void tui_vAddWinToLayout PARAMS ((va_list));
extern int tuiDefaultWinHeight
PARAMS ((TuiWinType, TuiLayoutType));
extern int tuiDefaultWinViewportHeight
PARAMS ((TuiWinType, TuiLayoutType));
extern TuiStatus tuiSetLayout
PARAMS ((TuiLayoutType, TuiRegisterDisplayType));
extern TuiStatus tui_vSetLayoutTo PARAMS ((va_list));
#endif /*TUI_LAYOUT_H*/

1210
gdb/tui/tuiRegs.c Normal file

File diff suppressed because it is too large Load Diff

28
gdb/tui/tuiRegs.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef _TUI_REGS_H
#define _TUI_REGS_H
/*
** This header file supports the display of registers in the data window.
*/
/*****************************************
** TYPE DEFINITIONS **
******************************************/
/*****************************************
** PUBLIC FUNCTION EXTERNAL DECLS **
******************************************/
extern void tuiCheckRegisterValues PARAMS ((struct frame_info *));
extern void tuiShowRegisters PARAMS ((TuiRegisterDisplayType));
extern void tuiDisplayRegistersFrom PARAMS ((int));
extern int tuiDisplayRegistersFromLine PARAMS ((int, int));
extern int tuiLastRegsLineNo PARAMS ((void));
extern int tuiFirstRegElementInLine PARAMS ((int));
extern int tuiLastRegElementInLine PARAMS ((int));
extern int tuiLineFromRegElementNo PARAMS ((int));
extern void tuiToggleFloatRegs PARAMS ((void));
extern int tuiCalculateRegsColumnCount PARAMS ((TuiRegisterDisplayType));
#endif /*_TUI_REGS_H*/

465
gdb/tui/tuiSource.c Normal file
View File

@ -0,0 +1,465 @@
/*
** tuiSource.c
** This module contains functions for displaying source in the source window
*/
#include "defs.h"
#include <ctype.h>
#include "symtab.h"
#include "frame.h"
#include "breakpoint.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiStack.h"
#include "tuiSourceWin.h"
#include "tuiSource.h"
/*****************************************
** EXTERNAL FUNCTION DECLS **
******************************************/
extern int open_source_file PARAMS ((struct symtab *));
extern void find_source_lines PARAMS ((struct symtab *, int));
/*****************************************
** EXTERNAL DATA DECLS **
******************************************/
extern int current_source_line;
extern struct symtab *current_source_symtab;
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
static struct breakpoint *_hasBreak PARAMS ((char *, int));
/*****************************************
** STATIC LOCAL DATA **
******************************************/
/*****************************************
** PUBLIC FUNCTIONS **
******************************************/
/*********************************
** SOURCE/DISASSEM FUNCTIONS **
*********************************/
/*
** tuiSetSourceContent().
** Function to display source in the source window.
*/
TuiStatus
#ifdef __STDC__
tuiSetSourceContent (
struct symtab *s,
int lineNo,
int noerror)
#else
tuiSetSourceContent (s, lineNo, noerror)
struct symtab *s;
int lineNo;
int noerror;
#endif
{
TuiStatus ret = TUI_FAILURE;
if (s != (struct symtab *) NULL && s->filename != (char *) NULL)
{
register FILE *stream;
register int i, desc, c, lineWidth, nlines;
register char *srcLine;
if ((ret = tuiAllocSourceBuffer (srcWin)) == TUI_SUCCESS)
{
lineWidth = srcWin->generic.width - 1;
/*
** Take hilite (window border) into account, when calculating
** the number of lines
*/
nlines = (lineNo + (srcWin->generic.height - 2)) - lineNo;
desc = open_source_file (s);
if (desc < 0)
{
if (!noerror)
{
char *name = alloca (strlen (s->filename) + 100);
sprintf (name, "%s:%d", s->filename, lineNo);
print_sys_errmsg (name, errno);
}
ret = TUI_FAILURE;
}
else
{
if (s->line_charpos == 0)
find_source_lines (s, desc);
if (lineNo < 1 || lineNo > s->nlines)
{
close (desc);
printf_unfiltered (
"Line number %d out of range; %s has %d lines.\n",
lineNo, s->filename, s->nlines);
}
else if (lseek (desc, s->line_charpos[lineNo - 1], 0) < 0)
{
close (desc);
perror_with_name (s->filename);
}
else
{
register int offset, curLineNo, curLine, curLen, threshold;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
/*
** Determine the threshold for the length of the line
** and the offset to start the display
*/
offset = srcWin->detail.sourceInfo.horizontalOffset;
threshold = (lineWidth - 1) + offset;
stream = fdopen (desc, FOPEN_RT);
clearerr (stream);
curLine = 0;
curLineNo =
srcWin->detail.sourceInfo.startLineOrAddr.lineNo = lineNo;
if (offset > 0)
srcLine = (char *) xmalloc (
(threshold + 1) * sizeof (char));
while (curLine < nlines)
{
TuiWinElementPtr element = (TuiWinElementPtr)
srcWin->generic.content[curLine];
struct breakpoint *bp;
/* get the first character in the line */
c = fgetc (stream);
if (offset == 0)
srcLine = ((TuiWinElementPtr)
srcWin->generic.content[
curLine])->whichElement.source.line;
/* Init the line with the line number */
sprintf (srcLine, "%-6d", curLineNo);
curLen = strlen (srcLine);
i = curLen -
((curLen / tuiDefaultTabLen ()) * tuiDefaultTabLen ());
while (i < tuiDefaultTabLen ())
{
srcLine[curLen] = ' ';
i++;
curLen++;
}
srcLine[curLen] = (char) 0;
/*
** Set whether element is the execution point and
** whether there is a break point on it.
*/
element->whichElement.source.lineOrAddr.lineNo =
curLineNo;
element->whichElement.source.isExecPoint =
(strcmp (((TuiWinElementPtr)
locator->content[0])->whichElement.locator.fileName,
s->filename) == 0
&& curLineNo == ((TuiWinElementPtr)
locator->content[0])->whichElement.locator.lineNo);
bp = _hasBreak (s->filename, curLineNo);
element->whichElement.source.hasBreak =
(bp != (struct breakpoint *) NULL &&
(!element->whichElement.source.isExecPoint ||
(bp->disposition != del || bp->hit_count <= 0)));
if (c != EOF)
{
i = strlen (srcLine) - 1;
do
{
if ((c != '\n') &&
(c != '\r') && (++i < threshold))
{
if (c < 040 && c != '\t')
{
srcLine[i++] = '^';
srcLine[i] = c + 0100;
}
else if (c == 0177)
{
srcLine[i++] = '^';
srcLine[i] = '?';
}
else
{ /*
** Store the charcter in the line
** buffer. If it is a tab, then
** translate to the correct number of
** chars so we don't overwrite our
** buffer.
*/
if (c == '\t')
{
int j, maxTabLen = tuiDefaultTabLen ();
for (j = i - (
(i / maxTabLen) * maxTabLen);
((j < maxTabLen) &&
i < threshold);
i++, j++)
srcLine[i] = ' ';
i--;
}
else
srcLine[i] = c;
}
srcLine[i + 1] = 0;
}
else
{ /*
** if we have not reached EOL, then eat
** chars until we do
*/
while (c != EOF && c != '\n' && c != '\r')
c = fgetc (stream);
}
}
while (c != EOF && c != '\n' && c != '\r' &&
i < threshold && (c = fgetc (stream)));
}
/* Now copy the line taking the offset into account */
if (strlen (srcLine) > offset)
strcpy (((TuiWinElementPtr) srcWin->generic.content[
curLine])->whichElement.source.line,
&srcLine[offset]);
else
((TuiWinElementPtr)
srcWin->generic.content[
curLine])->whichElement.source.line[0] = (char) 0;
curLine++;
curLineNo++;
}
if (offset > 0)
tuiFree (srcLine);
fclose (stream);
srcWin->generic.contentSize = nlines;
ret = TUI_SUCCESS;
}
}
}
}
return ret;
} /* tuiSetSourceContent */
/* elz: this function sets the contents of the source window to empty
except for a line in the middle with a warning message about the
source not being available. This function is called by
tuiEraseSourceContents, which in turn is invoked when the source files
cannot be accessed*/
void
#ifdef __STDC__
tuiSetSourceContentNil (
TuiWinInfoPtr winInfo,
char *warning_string)
#else
tuiSetSourceContentNil (winInfo, warning_string)
TuiWinInfoPtr winInfo;
char *warning_string;
#endif
{
int lineWidth;
int nLines;
int curr_line = 0;
lineWidth = winInfo->generic.width - 1;
nLines = winInfo->generic.height - 2;
/* set to empty each line in the window, except for the one
which contains the message*/
while (curr_line < winInfo->generic.contentSize)
{
/* set the information related to each displayed line
to null: i.e. the line number is 0, there is no bp,
it is not where the program is stopped */
TuiWinElementPtr element =
(TuiWinElementPtr) winInfo->generic.content[curr_line];
element->whichElement.source.lineOrAddr.lineNo = 0;
element->whichElement.source.isExecPoint = FALSE;
element->whichElement.source.hasBreak = FALSE;
/* set the contents of the line to blank*/
element->whichElement.source.line[0] = (char) 0;
/* if the current line is in the middle of the screen, then we want to
display the 'no source available' message in it.
Note: the 'weird' arithmetic with the line width and height comes from
the function tuiEraseSourceContent. We need to keep the screen and the
window's actual contents in synch */
if (curr_line == (nLines / 2 + 1))
{
int i;
int xpos;
int warning_length = strlen (warning_string);
char *srcLine;
srcLine = element->whichElement.source.line;
if (warning_length >= ((lineWidth - 1) / 2))
xpos = 1;
else
xpos = (lineWidth - 1) / 2 - warning_length;
for (i = 0; i < xpos; i++)
srcLine[i] = ' ';
sprintf (srcLine + i, "%s", warning_string);
for (i = xpos + warning_length; i < lineWidth; i++)
srcLine[i] = ' ';
srcLine[i] = '\n';
} /* end if */
curr_line++;
} /* end while*/
} /*tuiSetSourceContentNil*/
/*
** tuiShowSource().
** Function to display source in the source window. This function
** initializes the horizontal scroll to 0.
*/
void
#ifdef __STDC__
tuiShowSource (
struct symtab *s,
Opaque line,
int noerror)
#else
tuiShowSource (s, line, noerror)
struct symtab *s;
Opaque line;
int noerror;
#endif
{
srcWin->detail.sourceInfo.horizontalOffset = 0;
m_tuiShowSourceAsIs (s, line, noerror);
return;
} /* tuiShowSource */
/*
** tuiSourceIsDisplayed().
** Answer whether the source is currently displayed in the source window.
*/
int
#ifdef __STDC__
tuiSourceIsDisplayed (
char *fname)
#else
tuiSourceIsDisplayed (fname)
char *fname;
#endif
{
return (srcWin->generic.contentInUse &&
(strcmp (((TuiWinElementPtr) (locatorWinInfoPtr ())->
content[0])->whichElement.locator.fileName, fname) == 0));
} /* tuiSourceIsDisplayed */
/*
** tuiVerticalSourceScroll().
** Scroll the source forward or backward vertically
*/
void
#ifdef __STDC__
tuiVerticalSourceScroll (
TuiScrollDirection scrollDirection,
int numToScroll)
#else
tuiVerticalSourceScroll (scrollDirection, numToScroll)
TuiScrollDirection scrollDirection;
int numToScroll;
#endif
{
if (srcWin->generic.content != (OpaquePtr) NULL)
{
int line;
Opaque addr;
struct symtab *s;
TuiWinContent content = (TuiWinContent) srcWin->generic.content;
if (current_source_symtab == (struct symtab *) NULL)
s = find_pc_symtab (selected_frame->pc);
else
s = current_source_symtab;
if (scrollDirection == FORWARD_SCROLL)
{
line = content[0]->whichElement.source.lineOrAddr.lineNo +
numToScroll;
if (line > s->nlines)
/*line = s->nlines - winInfo->generic.contentSize + 1;*/
/*elz: fix for dts 23398*/
line = content[0]->whichElement.source.lineOrAddr.lineNo;
}
else
{
line = content[0]->whichElement.source.lineOrAddr.lineNo -
numToScroll;
if (line <= 0)
line = 1;
}
tuiUpdateSourceWindowAsIs (srcWin, s, (Opaque) line, FALSE);
}
return;
} /* tuiVerticalSourceScroll */
/*****************************************
** STATIC LOCAL FUNCTIONS **
******************************************/
/*
** _hasBreak().
** Answer whether there is a break point at the input line in
** the source file indicated
*/
static struct breakpoint *
#ifdef __STDC__
_hasBreak (
char *sourceFileName,
int lineNo)
#else
_hasBreak (sourceFileName, lineNo)
char *sourceFileName;
int lineNo;
#endif
{
struct breakpoint *bpWithBreak = (struct breakpoint *) NULL;
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
for (bp = breakpoint_chain;
(bp != (struct breakpoint *) NULL &&
bpWithBreak == (struct breakpoint *) NULL);
bp = bp->next)
if ((strcmp (sourceFileName, bp->source_file) == 0) &&
(lineNo == bp->line_number))
bpWithBreak = bp;
return bpWithBreak;
} /* _hasBreak */

27
gdb/tui/tuiSource.h Normal file
View File

@ -0,0 +1,27 @@
#ifndef _TUI_SOURCE_H
#define _TUI_SOURCE_H
/*
** This header file supports
*/
#include "defs.h"
#if 0
#include "symtab.h"
#include "breakpoint.h"
#endif
extern TuiStatus tuiSetSourceContent PARAMS ((struct symtab *, int, int));
extern void tuiShowSource PARAMS ((struct symtab *, Opaque, int));
extern void tuiShowSourceAsIs PARAMS ((struct symtab *, Opaque, int));
extern int tuiSourceIsDisplayed PARAMS ((char *));
extern void tuiVerticalSourceScroll PARAMS ((TuiScrollDirection, int));
/*******************
** MACROS **
*******************/
#define m_tuiShowSourceAsIs(s, line, noerror) tuiUpdateSourceWindowAsIs(srcWin, s, line, noerror)
#endif /*_TUI_SOURCE_H*/

1098
gdb/tui/tuiSourceWin.c Normal file

File diff suppressed because it is too large Load Diff

74
gdb/tui/tuiSourceWin.h Normal file
View File

@ -0,0 +1,74 @@
#ifndef _TUI_SOURCEWIN_H
#define _TUI_SOURCEWIN_H
/*
** This header file supports
*/
extern void tuiDisplayMainFunction PARAMS ((void));
extern void tuiUpdateSourceWindow PARAMS
((TuiWinInfoPtr, struct symtab *, Opaque, int));
extern void tuiUpdateSourceWindowAsIs PARAMS
((TuiWinInfoPtr, struct symtab *, Opaque, int));
extern void tuiUpdateSourceWindowsWithAddr PARAMS ((Opaque));
extern void tui_vUpdateSourceWindowsWithAddr PARAMS ((va_list));
extern void tuiUpdateSourceWindowsWithLine PARAMS ((struct symtab *, int));
extern void tui_vUpdateSourceWindowsWithLine PARAMS ((va_list));
extern void tuiUpdateSourceWindowsFromLocator PARAMS ((void));
extern void tuiClearSourceContent PARAMS ((TuiWinInfoPtr, int));
extern void tuiClearAllSourceWinsContent PARAMS ((int));
extern void tuiEraseSourceContent PARAMS ((TuiWinInfoPtr, int));
extern void tuiEraseAllSourceWinsContent PARAMS ((int));
extern void tuiSetSourceContentNil PARAMS ((TuiWinInfoPtr, char *));
extern void tuiShowSourceContent PARAMS ((TuiWinInfoPtr));
extern void tuiShowAllSourceWinsContent PARAMS ((void));
extern void tuiHorizontalSourceScroll PARAMS ((TuiWinInfoPtr, TuiScrollDirection, int));
extern void tuiUpdateOnEnd PARAMS ((void));
extern TuiStatus tuiSetExecInfoContent PARAMS ((TuiWinInfoPtr));
extern void tuiShowExecInfoContent PARAMS ((TuiWinInfoPtr));
extern void tuiShowAllExecInfosContent PARAMS ((void));
extern void tuiEraseExecInfoContent PARAMS ((TuiWinInfoPtr));
extern void tuiEraseAllExecInfosContent PARAMS ((void));
extern void tuiClearExecInfoContent PARAMS ((TuiWinInfoPtr));
extern void tuiClearAllExecInfosContent PARAMS ((void));
extern void tuiUpdateExecInfo PARAMS ((TuiWinInfoPtr));
extern void tuiUpdateAllExecInfos PARAMS ((void));
extern void tuiSetIsExecPointAt PARAMS ((Opaque, TuiWinInfoPtr));
extern void tuiSetHasBreakAt PARAMS ((struct breakpoint *, TuiWinInfoPtr, int));
extern void tuiAllSetHasBreakAt PARAMS ((struct breakpoint *, int));
extern void tui_vAllSetHasBreakAt PARAMS ((va_list));
extern TuiStatus tuiAllocSourceBuffer PARAMS ((TuiWinInfoPtr));
extern int tuiLineIsDisplayed PARAMS ((Opaque, TuiWinInfoPtr, int));
/*
** Constant definitions
*/
#define SCROLL_THRESHOLD 2 /* threshold for lazy scroll */
/*
** Macros
*/
#define m_tuiSetBreakAt(bp, winInfo) tuiSetHasBreakAt((bp, winInfo, TRUE)
#define m_tuiClearBreakAt(bp, winInfo) tuiSetHasBreakAt(bp, winInfo, FALSE)
#define m_tuiAllSetBreakAt(bp) tuiAllSetHasBreakAt(bp, TRUE)
#define m_tuiAllClearBreakAt(bp) tuiAllSetHasBreakAt(bp, FALSE)
#define m_tuiSrcLineDisplayed(lineNo) tuiLineIsDisplayed((Opaque)(lineNo), srcWin, FALSE)
#define m_tuiSrcAddrDisplayed(addr) tuiLineIsDisplayed((Opaque)(addr), disassemWin, FALSE)
#define m_tuiSrcLineDisplayedWithinThreshold(lineNo) \
tuiLineIsDisplayed((Opaque)(lineNo), srcWin, TRUE)
#define m_tuiSrcAddrDisplayedWithinThreshold(addr) \
tuiLineIsDisplayed((Opaque)(addr), disassemWin, TRUE)
#define m_tuiLineDisplayedWithinThreshold(winInfo, lineOrAddr) \
( (winInfo == srcWin) ? \
m_tuiSrcLineDisplayedWithinThreshold(lineOrAddr) : \
m_tuiSrcAddrDisplayedWithinThreshold(lineOrAddr) )
#endif /*_TUI_SOURCEWIN_H */

554
gdb/tui/tuiStack.c Normal file
View File

@ -0,0 +1,554 @@
/*
** This module contains functions for displaying the locator information in the locator window.
*/
#include "defs.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
#include "tui.h"
#include "tuiData.h"
#include "tuiStack.h"
#include "tuiSourceWin.h"
/*****************************************
** STATIC LOCAL FUNCTIONS FORWARD DECLS **
******************************************/
static char *_getFuncNameFromFrame PARAMS ((struct frame_info *));
static void _tuiUpdateLocation_command PARAMS ((char *, int));
/*****************************************
** PUBLIC FUNCTION **
******************************************/
/*
** tuiClearLocatorDisplay()
*/
void
#ifdef __STDC__
tuiClearLocatorDisplay (void)
#else
tuiClearLocatorDisplay ()
#endif
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
int i;
if (locator->handle != (WINDOW *) NULL)
{
/* No need to werase, since writing a line of
* blanks which we do below, is equivalent.
*/
/* werase(locator->handle); */
wmove (locator->handle, 0, 0);
wstandout (locator->handle);
for (i = 0; i < locator->width; i++)
waddch (locator->handle, ' ');
wstandend (locator->handle);
tuiRefreshWin (locator);
wmove (locator->handle, 0, 0);
locator->contentInUse = FALSE;
}
return;
} /* tuiClearLocatorDisplay */
/*
** tuiShowLocatorContent()
*/
void
#ifdef __STDC__
tuiShowLocatorContent (void)
#else
tuiShowLocatorContent ()
#endif
{
char *string;
TuiGenWinInfoPtr locator;
locator = locatorWinInfoPtr ();
if (m_genWinPtrNotNull (locator) && locator->handle != (WINDOW *) NULL)
{
string = displayableWinContentAt (locator, 0);
if (string != (char *) NULL)
{
wmove (locator->handle, 0, 0);
wstandout (locator->handle);
waddstr (locator->handle, string);
wstandend (locator->handle);
tuiRefreshWin (locator);
wmove (locator->handle, 0, 0);
if (string != nullStr ())
tuiFree (string);
locator->contentInUse = TRUE;
}
}
return;
} /* tuiShowLocatorContent */
/*
** tuiSetLocatorInfo().
** Function to update the locator, with the provided arguments.
*/
void
#ifdef __STDC__
tuiSetLocatorInfo (
char *fname,
char *procname,
int lineNo,
Opaque addr,
TuiLocatorElementPtr element)
#else
tuiSetLocatorInfo (fname, procname, lineNo, addr, element)
char *fname;
char *procname;
int lineNo;
Opaque addr;
TuiLocatorElementPtr element;
#endif
{
#ifdef COMMENT
/* first free the old info */
if (element->fileName)
tuiFree (element->fileName);
if (element->procName)
tuiFree (element->procName);
if (fname == (char *) NULL)
element->fileName = fname;
else
element->fileName = tuiStrDup (fname);
if (procname == (char *) NULL)
element->procName = procname;
else
element->procName = tuiStrDup (procname);
#else
element->fileName[0] = (char) 0;
element->procName[0] = (char) 0;
strcat_to_buf (element->fileName, MAX_LOCATOR_ELEMENT_LEN, fname);
strcat_to_buf (element->procName, MAX_LOCATOR_ELEMENT_LEN, procname);
#endif
element->lineNo = lineNo;
element->addr = (Opaque) addr;
return;
} /* tuiSetLocatorInfo */
/*
** tuiUpdateLocatorFilename().
** Update only the filename portion of the locator.
*/
void
#ifdef __STDC__
tuiUpdateLocatorFilename (
char *fileName)
#else
tuiUpdateLocatorFilename (fileName)
char *fileName;
#endif
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
if (locator->content[0] == (Opaque) NULL)
tuiSetLocatorContent ((struct frame_info *) NULL);
((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName[0] = (char) 0;
strcat_to_buf (((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName,
MAX_LOCATOR_ELEMENT_LEN,
fileName);
tuiShowLocatorContent ();
return;
} /* tuiUpdateLocatorFilename */
/*
** tui_vUpdateLocatorFilename().
** Update only the filename portion of the locator with args in a va_list.
*/
void
#ifdef __STDC__
tui_vUpdateLocatorFilename (
va_list args)
#else
tui_vUpdateLocatorFilename (args)
va_list args;
#endif
{
char *fileName;
fileName = va_arg (args, char *);
tuiUpdateLocatorFilename (fileName);
return;
} /* tui_vUpdateLocatorFilename */
/*
** tuiSwitchFilename().
** Update the filename portion of the locator. Clear the other info in locator.
** (elz)
*/
void
#ifdef __STDC__
tuiSwitchFilename (
char *fileName)
#else
tuiSwitchFilename (fileName)
char *fileName;
#endif
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
if (locator->content[0] == (Opaque) NULL)
tuiSetLocatorContent ((struct frame_info *) NULL);
((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName[0] = (char) 0;
tuiSetLocatorInfo (fileName,
(char *) NULL,
0,
(Opaque) NULL,
&((TuiWinElementPtr) locator->content[0])->whichElement.locator);
tuiShowLocatorContent ();
return;
} /* tuiSwitchFilename */
/*
** tuiGetLocatorFilename().
** Get the filename portion of the locator.
** (elz)
*/
void
#ifdef __STDC__
tuiGetLocatorFilename (
TuiGenWinInfoPtr locator,
char **filename)
#else
tuiGetLocatorFilename (locator, filename)
TuiGenWinInfoPtr locator;
char **filename;
#endif
{
/* the current filename could be non known, in which case the xmalloc would
allocate no memory, because the length would be 0 */
if (((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName)
{
int name_length =
strlen (((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName);
(*filename) = (char *) xmalloc (name_length + 1);
strcpy ((*filename),
((TuiWinElementPtr) locator->content[0])->whichElement.locator.fileName);
}
return;
} /* tuiGetLocatorFilename */
/*
** tuiUpdateLocatorInfoFromFrame().
** Function to update the locator, with the information extracted from frameInfo
*/
void
#ifdef __STDC__
tuiUpdateLocatorInfoFromFrame (
struct frame_info *frameInfo,
TuiLocatorElementPtr element)
#else
tuiUpdateLocatorInfoFromFrame (frameInfo, element)
struct frame_info *frameInfo;
TuiLocatorElementPtr element;
#endif
{
struct symtab_and_line symtabAndLine;
/* now get the new info */
symtabAndLine = find_pc_line (frameInfo->pc,
(frameInfo->next != (struct frame_info *) NULL &&
!frameInfo->next->signal_handler_caller &&
!frame_in_dummy (frameInfo->next)));
if (symtabAndLine.symtab && symtabAndLine.symtab->filename)
tuiSetLocatorInfo (symtabAndLine.symtab->filename,
_getFuncNameFromFrame (frameInfo),
symtabAndLine.line,
(Opaque) frameInfo->pc,
element);
else
tuiSetLocatorInfo ((char *) NULL,
_getFuncNameFromFrame (frameInfo),
0,
(Opaque) frameInfo->pc,
element);
return;
} /* tuiUpdateLocatorInfoFromFrame */
/*
** tuiSetLocatorContent().
** Function to set the content of the locator
*/
void
#ifdef __STDC__
tuiSetLocatorContent (
struct frame_info *frameInfo)
#else
tuiSetLocatorContent (frameInfo)
struct frame_info *frameInfo;
#endif
{
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
TuiWinElementPtr element;
struct symtab_and_line symtabAndLine;
/* Allocate the element if necessary */
if (locator->contentSize <= 0)
{
TuiWinContent contentPtr;
if ((locator->content = (OpaquePtr) allocContent (1, locator->type)) == (OpaquePtr) NULL)
error ("Unable to Allocate Memory to Display Location.");
locator->contentSize = 1;
}
if (frameInfo != (struct frame_info *) NULL)
tuiUpdateLocatorInfoFromFrame (frameInfo,
&((TuiWinElementPtr) locator->content[0])->whichElement.locator);
else
tuiSetLocatorInfo ((char *) NULL,
(char *) NULL,
0,
(Opaque) NULL,
&((TuiWinElementPtr) locator->content[0])->whichElement.locator);
return;
} /* tuiSetLocatorContent */
/*
** tuiUpdateLocatorDisplay().
** Function to update the locator display
*/
void
#ifdef __STDC__
tuiUpdateLocatorDisplay (
struct frame_info *frameInfo)
#else
tuiUpdateLocatorDisplay (frameInfo)
struct frame_info *frameInfo;
#endif
{
tuiClearLocatorDisplay ();
tuiSetLocatorContent (frameInfo);
tuiShowLocatorContent ();
return;
} /* tuiUpdateLocatorDisplay */
/*
** tuiShowFrameInfo().
** Function to print the frame inforrmation for the TUI.
*/
void
#ifdef __STDC__
tuiShowFrameInfo (
struct frame_info *fi)
#else
tuiShowFrameInfo (fi)
struct frame_info *fi;
#endif
{
TuiWinInfoPtr winInfo;
register int i;
if (fi)
{
register int startLine, i;
register struct symtab *s;
CORE_ADDR low;
TuiGenWinInfoPtr locator = locatorWinInfoPtr ();
int sourceAlreadyDisplayed;
s = find_pc_symtab (fi->pc);
sourceAlreadyDisplayed = tuiSourceIsDisplayed (s->filename);
tuiUpdateLocatorDisplay (fi);
for (i = 0; i < (sourceWindows ())->count; i++)
{
winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
if (winInfo == srcWin)
{
startLine =
(((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo -
(winInfo->generic.viewportHeight / 2)) + 1;
if (startLine <= 0)
startLine = 1;
}
else
{
if (find_pc_partial_function (fi->pc, (char **) NULL, &low, (CORE_ADDR) NULL) == 0)
error ("No function contains program counter for selected frame.\n");
else
low = (CORE_ADDR) tuiGetLowDisassemblyAddress ((Opaque) low, (Opaque) fi->pc);
}
if (winInfo == srcWin)
{
if (!(sourceAlreadyDisplayed && m_tuiLineDisplayedWithinThreshold (
winInfo,
((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo)))
tuiUpdateSourceWindow (winInfo, s, (Opaque) startLine, TRUE);
else
tuiSetIsExecPointAt ((Opaque)
((TuiWinElementPtr) locator->content[0])->whichElement.locator.lineNo,
winInfo);
}
else
{
if (winInfo == disassemWin)
{
if (!m_tuiLineDisplayedWithinThreshold (winInfo,
((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr))
tuiUpdateSourceWindow (winInfo, s, (Opaque) low, TRUE);
else
tuiSetIsExecPointAt ((Opaque)
((TuiWinElementPtr) locator->content[0])->whichElement.locator.addr,
winInfo);
}
}
tuiUpdateExecInfo (winInfo);
}
}
else
{
tuiUpdateLocatorDisplay (fi);
for (i = 0; i < (sourceWindows ())->count; i++)
{
winInfo = (TuiWinInfoPtr) (sourceWindows ())->list[i];
tuiClearSourceContent (winInfo, EMPTY_SOURCE_PROMPT);
tuiUpdateExecInfo (winInfo);
}
}
return;
} /* tuiShowFrameInfo */
/*
** tui_vShowFrameInfo().
** Function to print the frame inforrmation for the TUI with args in a va_list.
*/
void
#ifdef __STDC__
tui_vShowFrameInfo (
va_list args)
#else
tui_vShowFrameInfo (args)
va_list args;
#endif
{
struct frame_info *fi;
fi = va_arg (args, struct frame_info *);
tuiShowFrameInfo (fi);
return;
} /* tui_vShowFrameInfo */
/*
** _initialize_tuiStack().
** Function to initialize gdb commands, for tui window stack manipulation.
*/
void
_initialize_tuiStack ()
{
if (tui_version)
{
add_com ("update", class_tui, _tuiUpdateLocation_command,
"Update the source window and locator to display the current execution point.\n");
}
return;
} /* _initialize_tuiStack */
/*****************************************
** STATIC LOCAL FUNCTIONS **
******************************************/
/*
** _getFuncNameFromFrame().
*/
static char *
#ifdef __STDC__
_getFuncNameFromFrame (
struct frame_info *frameInfo)
#else
_getFuncNameFromFrame (frameInfo)
struct frame_info *frameInfo;
#endif
{
char *funcName = (char *) NULL;
find_pc_partial_function (frameInfo->pc,
&funcName,
(CORE_ADDR *) NULL,
(CORE_ADDR *) NULL);
return funcName;
} /* _getFuncNameFromFrame */
/*
** _tuiUpdateLocation_command().
** Command to update the display with the current execution point
*/
static void
#ifdef __STDC__
_tuiUpdateLocation_command (
char *arg,
int fromTTY)
#else
_tuiUpdateLocation_command (arg, fromTTY)
char *arg;
int fromTTY;
#endif
{
#ifndef TRY
extern void frame_command PARAMS ((char *, int));
frame_command ("0", FALSE);
#else
struct frame_info *curFrame;
/* Obtain the current execution point */
if ((curFrame = get_current_frame ()) != (struct frame_info *) NULL)
{
struct frame_info *frame;
int curLevel = 0;
for (frame = get_prev_frame (curLevel);
(frame != (struct frame_info *) NULL && (frame != curFrame));
frame = get_prev_frame (frame))
curLevel++;
if (curFrame != (struct frame_info *) NULL)
print_frame_info (frame, curLevel, 0, 1);
}
#endif
return;
} /* _tuiUpdateLocation_command */

22
gdb/tui/tuiStack.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef _TUI_STACK_H
#define _TUI_STACK_H
/*
** This header file supports
*/
extern void tuiSetLocatorInfo PARAMS ((char *, char *, int, Opaque, TuiLocatorElementPtr));
extern void tuiUpdateLocatorFilename PARAMS ((char *));
extern void tui_vUpdateLocatorFilename PARAMS ((va_list));
extern void tuiUpdateLocatorInfoFromFrame
PARAMS ((struct frame_info *, TuiLocatorElementPtr));
extern void tuiUpdateLocatorDisplay PARAMS ((struct frame_info *));
extern void tuiSetLocatorContent PARAMS ((struct frame_info *));
extern void tuiShowLocatorContent PARAMS ((void));
extern void tuiClearLocatorContent PARAMS ((void));
extern void tuiSwitchFilename PARAMS ((char *));
extern void tuiShowFrameInfo PARAMS ((struct frame_info *));
extern void tui_vShowFrameInfo PARAMS ((va_list));
extern void tuiGetLocatorFilename PARAMS ((TuiGenWinInfoPtr, char **));
#endif /*_TUI_STACK_H*/

1650
gdb/tui/tuiWin.c Normal file

File diff suppressed because it is too large Load Diff

28
gdb/tui/tuiWin.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef _TUI_WIN_H
#define _TUI_WIN_H
/*
** This header file supports
*/
/*****************************************
** TYPE DEFINITIONS **
******************************************/
/*****************************************
** PUBLIC FUNCTION EXTERNAL DECLS **
******************************************/
extern void tuiScrollForward PARAMS ((TuiWinInfoPtr, int));
extern void tuiScrollBackward PARAMS ((TuiWinInfoPtr, int));
extern void tuiScrollLeft PARAMS ((TuiWinInfoPtr, int));
extern void tuiScrollRight PARAMS ((TuiWinInfoPtr, int));
extern void tui_vScroll PARAMS ((va_list));
extern void tuiSetWinFocusTo PARAMS ((TuiWinInfoPtr));
extern void tuiClearWinFocusFrom PARAMS ((TuiWinInfoPtr));
extern void tuiClearWinFocus PARAMS ((void));
extern void tuiResizeAll PARAMS ((void));
extern void tuiRefreshAll PARAMS ((void));
extern void tuiSigwinchHandler PARAMS ((int));
#endif /*_TUI_WIN_H*/