* tuiRegs.c (tuiDisplayRegistersFrom): Set scrollok to FALSE in
each register window. (tuiCheckRegisterValues): Use REGISTER_RAW_SIZE to obtain the size of the register to check. (_tuiRegValueHasChanged): Likewise. (_tuiRegisterName): Use REGISTER_NAME. (tui_restore_gdbout): New function. (_tuiRegisterFormat): Use do_registers_info with gdb_stdout redirected to a string. (START_SPECIAL_REGS): Define. (_tuiGetRegisterRawValue): Use get_saved_register. (_tuiDisplayRegister): Fix clearing of register window.
This commit is contained in:
parent
e42acc6bba
commit
c46cc7dffe
2 changed files with 82 additions and 27 deletions
|
@ -1,3 +1,18 @@
|
||||||
|
2001-07-16 Stephane Carrez <Stephane.Carrez@worldnet.fr>
|
||||||
|
|
||||||
|
* tuiRegs.c (tuiDisplayRegistersFrom): Set scrollok to FALSE in
|
||||||
|
each register window.
|
||||||
|
(tuiCheckRegisterValues): Use REGISTER_RAW_SIZE to obtain the size
|
||||||
|
of the register to check.
|
||||||
|
(_tuiRegValueHasChanged): Likewise.
|
||||||
|
(_tuiRegisterName): Use REGISTER_NAME.
|
||||||
|
(tui_restore_gdbout): New function.
|
||||||
|
(_tuiRegisterFormat): Use do_registers_info with gdb_stdout redirected
|
||||||
|
to a string.
|
||||||
|
(START_SPECIAL_REGS): Define.
|
||||||
|
(_tuiGetRegisterRawValue): Use get_saved_register.
|
||||||
|
(_tuiDisplayRegister): Fix clearing of register window.
|
||||||
|
|
||||||
2001-07-17 Stephane Carrez <Stephane.Carrez@worldnet.fr>
|
2001-07-17 Stephane Carrez <Stephane.Carrez@worldnet.fr>
|
||||||
|
|
||||||
* tui-file.h (fputs_unfiltered_hook): Remove.
|
* tui-file.h (fputs_unfiltered_hook): Remove.
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include "tuiLayout.h"
|
#include "tuiLayout.h"
|
||||||
#include "tuiWin.h"
|
#include "tuiWin.h"
|
||||||
|
#include "tui-file.h"
|
||||||
|
|
||||||
/*****************************************
|
/*****************************************
|
||||||
** LOCAL DEFINITIONS **
|
** LOCAL DEFINITIONS **
|
||||||
|
@ -43,9 +43,9 @@
|
||||||
#define SINGLE_FLOAT_LABEL_FMT "%6.6s: "
|
#define SINGLE_FLOAT_LABEL_FMT "%6.6s: "
|
||||||
#define SINGLE_FLOAT_VALUE_WIDTH 25 /* min of 8 but may be in sci notation */
|
#define SINGLE_FLOAT_VALUE_WIDTH 25 /* min of 8 but may be in sci notation */
|
||||||
|
|
||||||
#define SINGLE_LABEL_WIDTH 10
|
#define SINGLE_LABEL_WIDTH 16
|
||||||
#define SINGLE_LABEL_FMT "%10.10s: "
|
#define SINGLE_LABEL_FMT "%10.10s: "
|
||||||
#define SINGLE_VALUE_WIDTH 14 /* minimum of 8 but may be in sci notation */
|
#define SINGLE_VALUE_WIDTH 20 /* minimum of 8 but may be in sci notation */
|
||||||
|
|
||||||
/* In the code HP gave Cygnus, this was actually a function call to a
|
/* In the code HP gave Cygnus, this was actually a function call to a
|
||||||
PA-specific function, which was supposed to determine whether the
|
PA-specific function, which was supposed to determine whether the
|
||||||
|
@ -344,6 +344,7 @@ tuiDisplayRegistersFrom (int startElementNo)
|
||||||
dataItemWin->origin.x = (itemWinWidth * j) + 1;
|
dataItemWin->origin.x = (itemWinWidth * j) + 1;
|
||||||
dataItemWin->origin.y = curY;
|
dataItemWin->origin.y = curY;
|
||||||
makeWindow (dataItemWin, DONT_BOX_WINDOW);
|
makeWindow (dataItemWin, DONT_BOX_WINDOW);
|
||||||
|
scrollok (dataItemWin->handle, FALSE);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** Get the printable representation of the register
|
** Get the printable representation of the register
|
||||||
|
@ -484,7 +485,10 @@ tuiCheckRegisterValues (struct frame_info *frame)
|
||||||
_tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]);
|
_tuiRegValueHasChanged (dataElementPtr, frame, &rawBuf[0]);
|
||||||
if (dataElementPtr->highlight)
|
if (dataElementPtr->highlight)
|
||||||
{
|
{
|
||||||
for (j = 0; j < MAX_REGISTER_RAW_SIZE; j++)
|
int size;
|
||||||
|
|
||||||
|
size = REGISTER_RAW_SIZE (dataElementPtr->itemNo);
|
||||||
|
for (j = 0; j < size; j++)
|
||||||
((char *) dataElementPtr->value)[j] = rawBuf[j];
|
((char *) dataElementPtr->value)[j] = rawBuf[j];
|
||||||
_tuiDisplayRegister (
|
_tuiDisplayRegister (
|
||||||
dataElementPtr->itemNo,
|
dataElementPtr->itemNo,
|
||||||
|
@ -573,12 +577,17 @@ registers.\n",
|
||||||
static char *
|
static char *
|
||||||
_tuiRegisterName (int regNum)
|
_tuiRegisterName (int regNum)
|
||||||
{
|
{
|
||||||
if (reg_names[regNum] != (char *) NULL && *(reg_names[regNum]) != (char) 0)
|
return REGISTER_NAME (regNum);
|
||||||
return reg_names[regNum];
|
}
|
||||||
else
|
extern int pagination_enabled;
|
||||||
return ((char *) NULL);
|
|
||||||
} /* tuiGetRegisterName */
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
tui_restore_gdbout (void *ui)
|
||||||
|
{
|
||||||
|
ui_file_delete (gdb_stdout);
|
||||||
|
gdb_stdout = (struct ui_file*) ui;
|
||||||
|
pagination_enabled = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** _tuiRegisterFormat
|
** _tuiRegisterFormat
|
||||||
|
@ -590,17 +599,36 @@ _tuiRegisterFormat (char *buf, int bufLen, int regNum,
|
||||||
TuiDataElementPtr dataElement,
|
TuiDataElementPtr dataElement,
|
||||||
enum precision_type precision)
|
enum precision_type precision)
|
||||||
{
|
{
|
||||||
char tmpBuf[15];
|
|
||||||
char *fmt;
|
|
||||||
struct ui_file *stream;
|
struct ui_file *stream;
|
||||||
|
struct ui_file *old_stdout;
|
||||||
|
char *name;
|
||||||
|
struct cleanup *cleanups;
|
||||||
|
char *p;
|
||||||
|
|
||||||
stream = tui_sfileopen (bufLen);
|
name = REGISTER_NAME (regNum);
|
||||||
pa_do_strcat_registers_info (regNum, 0, stream, precision);
|
if (name == 0)
|
||||||
strcpy (buf, tui_file_get_strbuf (stream));
|
{
|
||||||
ui_file_delete (stream);
|
strcpy (buf, "");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} /* _tuiRegisterFormat */
|
}
|
||||||
|
|
||||||
|
pagination_enabled = 0;
|
||||||
|
old_stdout = gdb_stdout;
|
||||||
|
stream = tui_sfileopen (bufLen);
|
||||||
|
gdb_stdout = stream;
|
||||||
|
cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
|
||||||
|
do_registers_info (regNum, 0);
|
||||||
|
|
||||||
|
/* Save formatted output in the buffer. */
|
||||||
|
strncpy (buf, tui_file_get_strbuf (stream), bufLen);
|
||||||
|
|
||||||
|
/* Remove the possible \n. */
|
||||||
|
p = strchr (buf, '\n');
|
||||||
|
if (p)
|
||||||
|
*p = 0;
|
||||||
|
|
||||||
|
do_cleanups (cleanups);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define NUM_GENERAL_REGS 32
|
#define NUM_GENERAL_REGS 32
|
||||||
|
@ -620,7 +648,12 @@ _tuiSetGeneralRegsContent (int refreshValuesOnly)
|
||||||
} /* _tuiSetGeneralRegsContent */
|
} /* _tuiSetGeneralRegsContent */
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef PCOQ_HEAD_REGNUM
|
||||||
|
#define START_SPECIAL_REGS 0
|
||||||
|
#else
|
||||||
#define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
|
#define START_SPECIAL_REGS PCOQ_HEAD_REGNUM
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** _tuiSetSpecialRegsContent().
|
** _tuiSetSpecialRegsContent().
|
||||||
** Set the content of the data window to consist of the special registers.
|
** Set the content of the data window to consist of the special registers.
|
||||||
|
@ -676,8 +709,7 @@ _tuiSetGeneralAndSpecialRegsContent (int refreshValuesOnly)
|
||||||
** Set the content of the data window to consist of the float registers.
|
** Set the content of the data window to consist of the float registers.
|
||||||
*/
|
*/
|
||||||
static TuiStatus
|
static TuiStatus
|
||||||
_tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType,
|
_tuiSetFloatRegsContent (TuiRegisterDisplayType dpyType, int refreshValuesOnly)
|
||||||
int refreshValuesOnly)
|
|
||||||
{
|
{
|
||||||
TuiStatus ret = TUI_FAILURE;
|
TuiStatus ret = TUI_FAILURE;
|
||||||
int i, startRegNum;
|
int i, startRegNum;
|
||||||
|
@ -720,11 +752,13 @@ _tuiRegValueHasChanged (TuiDataElementPtr dataElement,
|
||||||
if (_tuiGetRegisterRawValue (
|
if (_tuiGetRegisterRawValue (
|
||||||
dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS)
|
dataElement->itemNo, rawBuf, frame) == TUI_SUCCESS)
|
||||||
{
|
{
|
||||||
for (i = 0; (i < MAX_REGISTER_RAW_SIZE && !hasChanged); i++)
|
int size = REGISTER_RAW_SIZE (dataElement->itemNo);
|
||||||
|
|
||||||
|
for (i = 0; (i < size && !hasChanged); i++)
|
||||||
hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]);
|
hasChanged = (((char *) dataElement->value)[i] != rawBuf[i]);
|
||||||
if (hasChanged && newValue != (char *) NULL)
|
if (hasChanged && newValue != (char *) NULL)
|
||||||
{
|
{
|
||||||
for (i = 0; (i < MAX_REGISTER_RAW_SIZE); i++)
|
for (i = 0; i < size; i++)
|
||||||
newValue[i] = rawBuf[i];
|
newValue[i] = rawBuf[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -739,17 +773,19 @@ _tuiRegValueHasChanged (TuiDataElementPtr dataElement,
|
||||||
** Get the register raw value. The raw value is returned in regValue.
|
** Get the register raw value. The raw value is returned in regValue.
|
||||||
*/
|
*/
|
||||||
static TuiStatus
|
static TuiStatus
|
||||||
_tuiGetRegisterRawValue (int regNum, char *regValue,
|
_tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
|
||||||
struct frame_info *frame)
|
|
||||||
{
|
{
|
||||||
TuiStatus ret = TUI_FAILURE;
|
TuiStatus ret = TUI_FAILURE;
|
||||||
|
|
||||||
if (target_has_registers)
|
if (target_has_registers)
|
||||||
{
|
{
|
||||||
read_relative_register_raw_bytes_for_frame (regNum, regValue, frame);
|
int opt;
|
||||||
|
|
||||||
|
get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame,
|
||||||
|
regNum, (enum lval_type*) NULL);
|
||||||
|
if (register_cached (regNum) >= 0)
|
||||||
ret = TUI_SUCCESS;
|
ret = TUI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} /* _tuiGetRegisterRawValue */
|
} /* _tuiGetRegisterRawValue */
|
||||||
|
|
||||||
|
@ -873,7 +909,8 @@ _tuiDisplayRegister (int regNum,
|
||||||
{
|
{
|
||||||
if (winInfo->handle != (WINDOW *) NULL)
|
if (winInfo->handle != (WINDOW *) NULL)
|
||||||
{
|
{
|
||||||
char buf[100];
|
int i;
|
||||||
|
char buf[40];
|
||||||
int valueCharsWide, labelWidth;
|
int valueCharsWide, labelWidth;
|
||||||
TuiDataElementPtr dataElementPtr = &((TuiWinContent)
|
TuiDataElementPtr dataElementPtr = &((TuiWinContent)
|
||||||
winInfo->content)[0]->whichElement.data;
|
winInfo->content)[0]->whichElement.data;
|
||||||
|
@ -905,10 +942,13 @@ _tuiDisplayRegister (int regNum,
|
||||||
regNum,
|
regNum,
|
||||||
dataElementPtr,
|
dataElementPtr,
|
||||||
precision);
|
precision);
|
||||||
|
|
||||||
if (dataElementPtr->highlight)
|
if (dataElementPtr->highlight)
|
||||||
wstandout (winInfo->handle);
|
wstandout (winInfo->handle);
|
||||||
|
|
||||||
werase (winInfo->handle);
|
wmove (winInfo->handle, 0, 0);
|
||||||
|
for (i = 1; i < winInfo->width; i++)
|
||||||
|
waddch (winInfo->handle, ' ');
|
||||||
wmove (winInfo->handle, 0, 0);
|
wmove (winInfo->handle, 0, 0);
|
||||||
waddstr (winInfo->handle, buf);
|
waddstr (winInfo->handle, buf);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue