Unix Programming - Re: cscope & gvim

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Re: cscope & gvim





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: cscope & gvim
Hans-Bernhard Broeker

2004-01-30, 12:34 am

Fred Ma <fma@doe.carleton.ca> wrote:
quote:

> Yes, actually I mentioned that cscope worked fine when used outside
> of gvim.



That's not quite the same thing --- cscope works with an internal
representation of its query results, which is quite unlikely to be
broken in the way indicated here.

The vim interface, OTOH, relies on the _printed_ representation of
those results, which you only get to see for yourself if you run
cscope in -l or -L mode. Possible gotchas here would include line
breaks or blanks in the wrong places, or anything else that screws up
the vim interface's parser of cscope line-mode output. Since you
seemed to imply that the problem only happend sometimes, but not
reliably, that's why I suggested cscope -ld output as the next thing
to test. If you're worried about too public an exposure, you can
still send samples to me by email.

BTW: There is an open bug report from last week, posted anonymously to
the cscope bug tracker about this, too. Was that you, or somebody
else? That report mentioned an important additional detail: the
problem only happened with vim 6.2, but not with 6.0.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Mohun Biswas

2004-01-30, 12:35 am

I'm not a user of either package so this is strictly a guess, but it
sure smells like a problem caused by not handling whitespace in
pathnames correctly (a very common problem). Fred might want to take a
quick look and see if any of his files have whitespace or other special
characters.

MB

Fred Ma

2004-01-30, 2:36 am

Hans-Bernhard Broeker wrote:
quote:

>
> Fred Ma <fma@doe.carleton.ca> wrote:
>
>
> That's not quite the same thing --- cscope works with an internal
> representation of its query results, which is quite unlikely to be
> broken in the way indicated here.
>
> The vim interface, OTOH, relies on the _printed_ representation of
> those results, which you only get to see for yourself if you run
> cscope in -l or -L mode. Possible gotchas here would include line
> breaks or blanks in the wrong places, or anything else that screws up
> the vim interface's parser of cscope line-mode output. Since you
> seemed to imply that the problem only happend sometimes, but not
> reliably, that's why I suggested cscope -ld output as the next thing
> to test. If you're worried about too public an exposure, you can
> still send samples to me by email.
>
> BTW: There is an open bug report from last week, posted anonymously to
> the cscope bug tracker about this, too. Was that you, or somebody
> else? That report mentioned an important additional detail: the
> problem only happened with vim 6.2, but not with 6.0.



There's been alot of installation, reinstallation, upgrades, and
troubleshooting lately that I really didn't remember whether I might
have submitted a bug. But I found the bug report and can say with
certainty that it wasn't me.

I looked at the man page for -l. I'll spend a bit of time playing
with it. It's probably as you say, some parsing problem with the
gvim plugin. The matching list shows, but selection of a particular
match causes gvim to jump to the wrong place. I will look at it
tomorrow, as I have been up for a long time right now. If it comes
down to it, would you mind receiving 3 longish files, as well as a
description of what gvim queries give the wrong jumps? Or would
you prefer not to delve into the gvim side of things? After enough
of a look at it, I can submit a bug report to vim, as you suggested.

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6
Hans-Bernhard Broeker

2004-01-30, 3:36 am

Fred Ma <fma@doe.carleton.ca> wrote:
quote:

> I looked at the man page for -l. I'll spend a bit of time playing
> with it. It's probably as you say, some parsing problem with the
> gvim plugin. The matching list shows, but selection of a particular
> match causes gvim to jump to the wrong place. I will look at it
> tomorrow, as I have been up for a long time right now. If it comes
> down to it, would you mind receiving 3 longish files, as well as a
> description of what gvim queries give the wrong jumps?



Turns out not to be necessary --- I could reproduce a problem like
that using cscope's own C source code and VIM 6.1 I found on some
RedHat box.

A little digging in VIM's CVS repository shows what looks like a patch
exactly for this problem having been applied to VIM, recently. It's
revision 1.29 of src/if_cscope.c, checked in September 2003. Indeed,
plugging that version of this source file into the distributed vim62
source tarball fixes the problem for me.

The problem is caused by vim trying to move tags in the currently
viewed file to the top of the list, but forgetting to update the
internal counts. It's a genuine internal VIM bug, unrelated to the
cscope output format and VIM's parsing of it. They solved it by
removing that sorting step entirely.

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Fred Ma

2004-01-30, 7:33 pm

Hans-Bernhard Broeker wrote:
quote:

>
> Fred Ma <fma@doe.carleton.ca> wrote:
>
>
> I could reproduce a problem like
> that using cscope's own C source code and VIM 6.1 I found on some
> RedHat box.
>
> A little digging in VIM's CVS repository shows what looks like a patch
> exactly for this problem having been applied to VIM, recently. It's
> revision 1.29 of src/if_cscope.c, checked in September 2003. Indeed,
> plugging that version of this source file into the distributed vim62
> source tarball fixes the problem for me.
>
> The problem is caused by vim trying to move tags in the currently
> viewed file to the top of the list, but forgetting to update the
> internal counts. It's a genuine internal VIM bug, unrelated to the
> cscope output format and VIM's parsing of it. They solved it by
> removing that sorting step entirely.



I checked the vim 6.2 patches (and installed gnu patch
utility, since the solaris patch seems to be unable to
process the vim patches). I applied the patches in the
specified vim build directory. The "make" step stops
with fatal errors, so I untarred the entire vim source
from the originally downloaded tarball. Then I ran
configure, applied the patches, and reran "make". Same
errors. I'll search the vim mailing list before either
posting to comp.editors or the vim list. Thanks for
pointing out the patches.

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6
Fred Ma

2004-01-30, 10:34 pm

Fred Ma wrote:
quote:

>
> I checked the vim 6.2 patches (and installed gnu patch
> utility, since the solaris patch seems to be unable to
> process the vim patches). I applied the patches in the
> specified vim build directory. The "make" step stops
> with fatal errors, so I untarred the entire vim source
> from the originally downloaded tarball. Then I ran
> configure, applied the patches, and reran "make". Same
> errors. I'll search the vim mailing list before either
> posting to comp.editors or the vim list. Thanks for
> pointing out the patches.



Hans-Bernhard,

It worked. I had to remove the build directory, unpack
the tarball, run configure, and then run only the patches
related to cscope. These I picked from the patches
README file. Thanks alot for your help. Now it's time
to follow up on my posts at comp.editors and vim user
mailing list (can't remember if cscope had a list, but
I'll check).

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6
Fred Ma

2004-01-30, 11:34 pm

Mohun Biswas wrote:
quote:

>
> I'm not a user of either package so this is strictly a guess, but it
> sure smells like a problem caused by not handling whitespace in
> pathnames correctly (a very common problem). Fred might want to take a
> quick look and see if any of his files have whitespace or other special
> characters.
>
> MB




Mohun,

Thanks for the suggestion. Hans-Bernhard found a vim patch
that fixed the problem. I installed all vim6.2 patches that
had anything to do with cscope, then rebuilt gvim. Just as
a note, it took several tries. In the end, build
errors were avoided by not running all 6.2 patches (just
the ones related to cscope), as well as erasing the build
directory and unpacking it anew. The patches were applied
after running "configure" (with --enable-cscope, of course).
I haven't run into the problem since (recall that the
problem was that I was warped to the wrong occurance of
the matching list for a cscope query).

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com