Thomas Dickey <
address@hidden> ezt írta (időpont: 2020. ápr. 14., K, 0:42):
The automatically-printed values look reasonable,
but the problem happens with line->text.
Printing
print *line
(gdb) print *line
$1 = {text = 0x0, firstchar = 0, lastchar = 27, oldindex = 0}
(gdb) print line->text
$2 = (chtype *) 0x0
might show something, e.g., a value for line->text
If
print line->text[2]
(gdb) print line->text[1]
Cannot access memory at address 0x4
(gdb) print line->text[2]
Cannot access memory at address 0x8
gives an error, that's confirming valgrind's warning.
If you get an error, then there's still the problem of finding
why the pointer's bad. (If you aren't able to get an error,
valgrind's probably misleading you on the cause)
Also,
print *win
(gdb) print *win
$3 = {_cury = 2, _curx = 1, _maxy = 18, _maxx = 27, _begy = 1, _begx = 0, _flags = 33, _attrs = 2097152, _bkgd = 32, _notimeout = false, _clear = false, _leaveok = false, _scroll = false, _idlok = false, _idcok = true, _immed = false, _sync = true, _use_keypad = false, _delay = -1, _line = 0x153378, _regtop = 0, _regbottom = 18, _parx = 0, _pary = 0, _parent = 0x1511d0, _pad = {_pad_y = -1, _pad_x = -1, _pad_top = -1, _pad_left = -1, _pad_bottom = -1, _pad_right = -1}, _yoffset = 0}
might show something (see the lib_addch.c source -- negative values
for _cury and/or _curx would be bad, since "line" is updated at line 348).
Seeing this on line 256:
line = win->_line + y;
then
print win->_line + y
should match "line".
(gdb) print win->_line + y
$4 = (struct ldat *) 0x153390
(gdb) print line
$5 = (struct ldat *) 0x153390
(gdb)
However, the debugger says that x and y are both 2,
which is legal for the size of the window that's supposedly in use.
So it seems that for some reason line->text is empty string, and there is only the null character and nothing else beyond that.
The line pointer itself seems to point to the right place, at least as far as line and win->_line+y go.
Best Regards,
János
--
LinkedIn: linkedin.com/in/janosszigetvari__@__˚V˚
Make the switch to open (source) applications, protocols, formats now:
- windows -> Linux, iexplore -> Firefox, msoffice -> LibreOffice
- msn -> jabber protocol (Pidgin, Google Talk)
- mp3 -> ogg, wmv -> ogg, jpg -> png, doc/xls/ppt -> odt/ods/odp