Dominique Pellé wrote:
> > Cesar Romani wrote:
> >
>> >> Dominique Pellé wrote:
> > ...
>>> >>> When putting a breakpoint at line term.c:1615,
>>> >>> what is the value of 'term' variable? (output of gdb command: print
term)
>>> >>>
>>> >>> Ex:
>>> >>>
>>> >>> (gdb) p term
>>> >>> $1 = (char_u *) 0x946e25c "xterm-256color"
>> >> $1 = (char_u *) 0xa0158c0 "msys"
>> >>
>>> >>> What is also the value of 'term' later at line 1866 where it
crashes?
>> >> $1 = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of bounds>
>> >>
>>> >>> Output of gdb command "bt full" might also be helpful.
>> >> --------------------
>> >> (gdb) bt full
>> >> #0  0x004fd3a2 in set_termname (
>> >>    term=0x3a6c3532 <Address 0x3a6c3532 out of bounds>) at term.c:1866
>> >>        termp = (struct builtin_term *) 0x22f860
>> >>        builtin_first = 1
>> >>        try = 2
>> >>        termcap_cleared = 1
>> >>        width = 80
>> >>        height = 25
>> >>        error_msg = (char_u *) 0x0
>> >>        bs_p = (char_u *) 0x22f860 ":\017R"
>> >>        del_p = (char_u *) 0x3a6c3532 <Address 0x3a6c3532 out of
bounds>
>> >> #1  0x3f5b455c in ?? ()
>> >> No symbol table info available.
>> >> #2  0x3a6c3532 in ?? ()
>> >> No symbol table info available.
>> >> ...
>> >> #189 0x00000000 in ?? ()
>> >> No symbol table info available.
>> >> --------------------
> >
> > I can't see any place where 'term' variable would be changed
> > other than when it's set to DEFAULT_TERM at line 1816 (but
> > that would not cause 'term' pointer to be incorrect).
> >
> > So it leaves the possibility of a corrupted stack.
> >
> > Can you put intermediate breakpoints (or execute line by line with
> > the "next" gdb command if you prefer) between line term.c:1615
> > (where 'term' pointer is still OK) and line term.c:1866 where 'term'
> > pointer becomes invalid so we can narrow it down? At each steps,
> > you can do "print term" in gdb to see when 'term' pointer starts to
> > become "out of bounds".

--------------------
Breakpoint 1, set_termname (term=0xa0158c0 "msys") at term.c:1615
1615        if (term_is_builtin(term))
(gdb) p term
$1 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1634        for (try = builtin_first ? 0 : 1; try < 3; ++try)
(gdb) p term
$2 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1639            if (try == 1)
(gdb) p term
$3 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1762                if (try == 2 && builtin_first && termcap_cleared)
(gdb) p term
$4 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1768                termp = find_builtin_term(term);
(gdb) p term
$5 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1769                if (termp->bt_string == NULL)       /* did not find
it */
(gdb) p term
$6 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1779                    if (try == 0)                   /* try external
one */
(gdb) p term
$7 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1780                        continue;
(gdb) p term
$8 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1634        for (try = builtin_first ? 0 : 1; try < 3; ++try)
(gdb) p term
$9 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1639            if (try == 1)
(gdb) p term
$10 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1675                if ((error_msg = tgetent_error(tbuf, term)) == NULL)
(gdb) p term
$11 = (char_u *) 0xa0158c0 "msys"
(gdb) n
1677                    tp = tstrbuf;
(gdb) p term
$12 = (char_u *) 0x5b455c3d <Address 0x5b455c3d out of bounds>
--------------------

>> >> If I re-compile with CFLAGS = -g -O0 -Wall, vim executes fine on the
>> >> console but not on rxvt:
>> >>
>> >> --------------------
>> >> (gdb) run
>> >> Starting program: C:\msys\1.0\home\Romer\msys\vim72\src/vim.exe
>> >> [New thread 252.0xe14]
>> >> Vim: Warning: Output is not to a terminal
>> >> Vim: Warning: Input is not from a terminal
>> >> [New thread 252.0xe3c]
>> >>
>> >> Program received signal SIGSEGV, Segmentation fault.
>> >> 0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
>> >> --------------------
>> >>
>> >> For the console TERM=cygwin and for rxvt TERM=msys
> >
> > Ah. So if I understand correctly what you're saying:
> > - with -O0, Vim works in the cygwin console, but with -O2 it
> >   did not work in the cygwin console (correct?)

that's correct.

> > - In in rxvt, it still does not work even with -O0.  What is the
> >   stack where it crashes?  (output of gdb "backtrace" command).

--------------------
(gdb) backtrace
#0  0x71084d3a in strcmp () from C:\msys\1.0\bin\msys-1.0.dll
#1  0x0053a9d4 in set_termname (
    term=0x5b455c3d <Address 0x5b455c3d out of bounds>) at term.c:1866
#2  0x69253a24 in ?? ()
#3  0x5b455c3d in ?? ()
...
#176 0x0022003a in ?? ()
#177 0x71004c7f in msys-1!_dll_c...@0 () from C:\msys\1.0\bin\msys-1.0.dll
(gdb) Cannot access memory at address 0x355b4560
--------------------

Regards,
Cesar


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui