rcomr@koel.co.rmit.oz (Mark Rawling) (08/17/90)
Here are two bugs (and fixes) in the Athena text widget that affect xdbx
rather drastically.
The first deals with the strange scrolling behaviour when you click
near the bottom of the source window.
The second is much more insidious in that it selectively prevents the
display window from updating the values of variables as you step
through a program.
(Note, there is a clumsy workaround to the first bug in xdbx(v2.1).)
Here are the relevant sections of the bug report:
SYNOPSIS:
(1) Text widget confuses left and bottom margin widths
(2) Text widget does not always update enough displayed text after an edit
REPEAT BY:
(1) Run any text widget (eg xdbx, xedit, etc) with a left margin
of say 50 (as in the xdbx source window)
and a zero bottom margin (eg xedit -xrm '*leftMargin: 50').
Now include enough text so that the window can scroll both up
and down, and centre the scroll bubble. Now try and put the carat
within leftmargin pixels of the bottom. Note that the window
incorrectly scrolls up to put the carat at a distance leftmargin
above the bottom.
(2) Much more difficult to repeat but try this:
Compile the following program (cc -g will do):
1 main(argc, argv)
2 int argc; char *argv[];
3 { int i = 0;
4 /*argv[i]*/
5 i = 1;
6 }
Run xdbx on a.out.
Set a break point at line 5 and issue a 'run .' command.
When at the break point, display (not print) argv[i] and
*argv[i] IN THAT ORDER (use the comment on line 4 for convenience).
Observe that the display window correctly shows
argv[i] = 0xf7fffbb4(etc) "a.out"
*argv[i] = 'a'
Now do a 'next' and observe the display window
argv[i] = "."
*argv[i] = 'a'
Note that *argv[i] is not updated. Now refresh the display and
verify that *argv[i] = '.' is correctly displayed.
***** This is not an xdbx bug
***** It is a bug in or around _XawTextReplace in Text.c
SAMPLE FIX:
(1) in Text.c (v 1.136 89/12/15 12:10:56) (and probably other versions)
in function _XawTextShowPosition(ctx) lines 2326,7 are as follows:
x = ctx->text.margin.left;
y = ctx->core.height - ctx->text.margin.left;
^^^^
clearly, this confuses the left margin with the bottom margin,
the second of these lines should be
y = ctx->core.height - ctx->text.margin.bottom;
^^^^^^
(2) in Text.c (v 1.136 89/12/15 12:10:56) (and probably other versions)
in function _XawTextReplace (ctx, pos1, pos2, text) lines 1688,9
are as follows:
updateTo = _BuildLineTable(ctx,
ctx->text.lt.info[line1].position, pos1, line1);
^^^^
Changing the second line to
ctx->text.lt.info[line1].position, pos2, line1);
^^^^
is a potential fix to this bug since this appears to force the
line table to be rebuilt up to at least pos2 (ie the end of the
replacement text, which _BuildLineTable then returns as its
result, see _BuildLineTable). However, it is not clear as to how the
return result from _BuildLineTable is supposed to be used and
therefore the bug may be in _BuildLineTable itself (at the point
where it does a conditional early return (lines 893-5)), or in
_XawTextReplace as shown in the fix above, or it may be
possible that _XawTextReplace should not be using the result of
_BuildLineTable as the value for 'updateTo'. _XawTextReplace even
does a lot of direct manipulation on the line table itself which
looks highly suspect and appears to disrupt the rebuilding of the
line table (lines 1674-9). I can't be bothered working out
which of these is the real problem here since there may easily
be more than one bug lurking in this lot.