2002-09-29 Elena Zannoni <ezannoni@redhat.com>

* tui.c (tui_show_source): Don't access current_source_symtab, use
	accessor function instead.  Include source.h and symtab.h
	* tuiDisassem.c (tuiShowDisassemAndUpdateSource,
	tuiVerticalDisassemScroll): Use accessor functions for current
	source line and symtab.  Include source.h.
	* tuiLayout.c (_extractDisplayStartAddr): Use accessor functions
	for current source line and symtab.  Include source.h.
	* tuiWin.c (_makeVisibleWithNewHeight): Ditto.
	* tuiSourceWin.c (tuiUpdateSourceWindowAsIs,
	tuiHorizontalSourceScroll): Ditto.
	* tuiSource.c (tuiVerticalSourceScroll): Ditto.
This commit is contained in:
Elena Zannoni 2002-09-30 00:52:27 +00:00
parent b62460894d
commit 52575520c3
7 changed files with 46 additions and 15 deletions

View File

@ -1,3 +1,17 @@
2002-09-29 Elena Zannoni <ezannoni@redhat.com>
* tui.c (tui_show_source): Don't access current_source_symtab, use
accessor function instead. Include source.h and symtab.h
* tuiDisassem.c (tuiShowDisassemAndUpdateSource,
tuiVerticalDisassemScroll): Use accessor functions for current
source line and symtab. Include source.h.
* tuiLayout.c (_extractDisplayStartAddr): Use accessor functions
for current source line and symtab. Include source.h.
* tuiWin.c (_makeVisibleWithNewHeight): Ditto.
* tuiSourceWin.c (tuiUpdateSourceWindowAsIs,
tuiHorizontalSourceScroll): Ditto.
* tuiSource.c (tuiVerticalSourceScroll): Ditto.
2002-09-13 Stephane Carrez <stcarrez@nerim.fr>
* tui.c (tui_rl_switch_mode): Remove unecessary TUI switch printfs.

View File

@ -67,6 +67,8 @@
#include "frame.h"
#include "breakpoint.h"
#include "inferior.h"
#include "symtab.h"
#include "source.h"
/* Tells whether the TUI is active or not. */
int tui_active = 0;
@ -543,10 +545,11 @@ _tuiReset (void)
void
tui_show_source (const char *file, int line)
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
/* make sure that the source window is displayed */
tuiAddWinToLayout (SRC_WIN);
tuiUpdateSourceWindowsWithLine (current_source_symtab, line);
tuiUpdateSourceWindowsWithLine (cursal.symtab, line);
tuiUpdateLocatorFilename (file);
}

View File

@ -44,6 +44,7 @@
#include "breakpoint.h"
#include "frame.h"
#include "value.h"
#include "source.h"
#include "tui.h"
#include "tuiData.h"
@ -337,7 +338,7 @@ tuiShowDisassemAndUpdateSource (CORE_ADDR startAddr)
tuiUpdateSourceWindow (srcWin, sal.symtab, val, TRUE);
if (sal.symtab)
{
current_source_symtab = sal.symtab;
set_current_source_symtab_and_line (&sal);
tuiUpdateLocatorFilename (sal.symtab->filename);
}
else
@ -415,12 +416,13 @@ tuiVerticalDisassemScroll (TuiScrollDirection scrollDirection,
struct symtab *s;
TuiLineOrAddress val;
int maxLines, dir;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
content = (TuiWinContent) disassemWin->generic.content;
if (current_source_symtab == (struct symtab *) NULL)
if (cursal.symtab == (struct symtab *) NULL)
s = find_pc_symtab (selected_frame->pc);
else
s = current_source_symtab;
s = cursal.symtab;
/* account for hilite */
maxLines = disassemWin->generic.height - 2;

View File

@ -43,6 +43,7 @@
#include "command.h"
#include "symtab.h"
#include "frame.h"
#include "source.h"
#include <ctype.h>
#include "tui.h"
@ -546,12 +547,13 @@ _extractDisplayStartAddr (void)
TuiLayoutType curLayout = currentLayout ();
CORE_ADDR addr;
CORE_ADDR pc;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
switch (curLayout)
{
case SRC_COMMAND:
case SRC_DATA_COMMAND:
find_line_pc (current_source_symtab,
find_line_pc (cursal.symtab,
srcWin->detail.sourceInfo.startLineOrAddr.lineNo,
&pc);
addr = pc;

View File

@ -337,11 +337,12 @@ tuiVerticalSourceScroll (TuiScrollDirection scrollDirection,
TuiLineOrAddress l;
struct symtab *s;
TuiWinContent content = (TuiWinContent) srcWin->generic.content;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (current_source_symtab == (struct symtab *) NULL)
if (cursal.symtab == (struct symtab *) NULL)
s = find_pc_symtab (selected_frame->pc);
else
s = current_source_symtab;
s = cursal.symtab;
if (scrollDirection == FORWARD_SCROLL)
{

View File

@ -45,6 +45,7 @@
#include "frame.h"
#include "breakpoint.h"
#include "value.h"
#include "source.h"
#include "tui.h"
#include "tuiData.h"
@ -125,9 +126,12 @@ tuiUpdateSourceWindowAsIs (TuiWinInfoPtr winInfo, struct symtab *s,
tuiUpdateExecInfo (winInfo);
if (winInfo->generic.type == SRC_WIN)
{
current_source_line = lineOrAddr.lineNo +
struct symtab_and_line sal;
sal.line = lineOrAddr.lineNo +
(winInfo->generic.contentSize - 2);
current_source_symtab = s;
sal.symtab = s;
set_current_source_symtab_and_line (&sal);
/*
** If the focus was in the asm win, put it in the src
** win if we don't have a split layout
@ -348,11 +352,12 @@ tuiHorizontalSourceScroll (TuiWinInfoPtr winInfo,
{
int offset;
struct symtab *s;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
if (current_source_symtab == (struct symtab *) NULL)
if (cursal.symtab == (struct symtab *) NULL)
s = find_pc_symtab (selected_frame->pc);
else
s = current_source_symtab;
s = cursal.symtab;
if (direction == LEFT_SCROLL)
offset = winInfo->detail.sourceInfo.horizontalOffset + numToScroll;

View File

@ -53,6 +53,7 @@
#include "frame.h"
#include "cli/cli-cmds.h"
#include "top.h"
#include "source.h"
#include "tui.h"
#include "tuiData.h"
@ -1364,6 +1365,8 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo)
if (winInfo->generic.content != (OpaquePtr) NULL)
{
TuiLineOrAddress lineOrAddr;
struct symtab_and_line cursal
= get_current_source_symtab_and_line ();
if (winInfo->generic.type == SRC_WIN)
lineOrAddr.lineNo =
@ -1373,19 +1376,20 @@ _makeVisibleWithNewHeight (TuiWinInfoPtr winInfo)
winInfo->detail.sourceInfo.startLineOrAddr.addr;
freeWinContent (&winInfo->generic);
tuiUpdateSourceWindow (winInfo,
current_source_symtab, lineOrAddr, TRUE);
cursal.symtab, lineOrAddr, TRUE);
}
else if (selected_frame != (struct frame_info *) NULL)
{
TuiLineOrAddress line;
extern int current_source_line;
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
s = find_pc_symtab (selected_frame->pc);
if (winInfo->generic.type == SRC_WIN)
line.lineNo = current_source_line;
line.lineNo = cursal.line;
else
{
find_line_pc (s, current_source_line, &line.addr);
find_line_pc (s, cursal.line, &line.addr);
}
tuiUpdateSourceWindow (winInfo, s, line, TRUE);
}