On 9/14/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote:

Yakov Lerner wrote:

> > > On 9/14/06, Haakon Riiser <[EMAIL PROTECTED]> wrote:
> > > > After recompiling Vim with -D_FILE_OFFSET_BITS=64, everything
> > > > involving tags break, including the help system.  Typing :h,
> > > > or pressing ^] to jump to a tag, causes Vim to get caught in an
> > > > infinite loop.

[...]

> > Can you find out where in the code this happens?
> >
> > I suspect the 64 bit library functions work different from the "normal"
> > functions.  Perhaps fgets(), since that's what is being used to read the
> > tags file.
>
> In situation where fgets() returns NULL, find_tags() enters
> infinite loop as follows.

Sorry, this doesn't show me where the loop actually is. Please compile
without the optimizer, otherwise code reordering confuses the debugger.

At least tell us if Vim hangs in tag_fgets() or in find_tags().

The loop is is inside find_tags(), and it procees around following line
numbers:
    1625 1626 1642 1647 1650 1651 1652 1653 1562 1564 1566
    1576 1582 1588 1601 1603 1604 1616 1619 1621 1625
and infinite loop repeats. Look at this:
  gdb> print print search_info.curr_offset
$2 = 5258708303049

The difference must be related to fseek(). I don't see where
search_info.curr_offset is first initialized, though.

Breakpoint 1, find_tags (pat=0x827b570 "[EMAIL PROTECTED]",
num_matches=0xbff9238c, matchesp=0xbff92388,
   flags=40, mincount=1, buf_ffname=0x0) at tag.c:1625
1625                    eof = tag_fgets(lbuf, LSIZE, fp);
(gdb) p eof
$1 = 1
(gdb) n
1626                    if (!eof && search_info.curr_offset != 0)
(gdb) n
1642                    while (!eof && vim_isblankline(lbuf))
(gdb) n
1647                    if (eof)
(gdb) n
1650                        state = TS_SKIP_BACK;
(gdb) n
1651                        search_info.match_offset = ftell(fp);
(gdb) n
1652                        search_info.curr_offset =
search_info.curr_offset_used;
(gdb) n
1653                        continue;
(gdb) n
1562                line_breakcheck();      /* check for CTRL-C typed */
(gdb) n
1564                if ((flags & TAG_INS_COMP)) /* Double brackets for gcc */
(gdb) n
1566                if (got_int || compl_interrupted)
(gdb) n
1576                if (mincount == TAG_MANY && match_count >= TAG_MANY)
(gdb) n
1582                if (get_it_again)
(gdb) n
1588                if (state == TS_BINARY)
(gdb) n
1601                else if (state == TS_SKIP_BACK)
(gdb) n
1603                    search_info.curr_offset -= LSIZE * 2;
(gdb) n
1604                    if (search_info.curr_offset < 0)
(gdb) n
1616                if (state == TS_BINARY || state == TS_SKIP_BACK)
(gdb) n
1619                    search_info.curr_offset_used = search_info.curr_offset;
(gdb) n
1621                    fseeko(fp, search_info.curr_offset, SEEK_SET);
(gdb) n

Breakpoint 1, find_tags (pat=0x827b570 "[EMAIL PROTECTED]",
num_matches=0xbff9238c, matchesp=0xbff92388,
   flags=40, mincount=1, buf_ffname=0x0) at tag.c:1625
1625                    eof = tag_fgets(lbuf, LSIZE, fp);
(gdb) n
1626                    if (!eof && search_info.curr_offset != 0)
(gdb) n
1642                    while (!eof && vim_isblankline(lbuf))
(gdb)

Reply via email to