I tried to understand how to use cscope (with the Vim source as a set of sources to apply it to). Bram, correct me if I'm wrong. The following assumes $VIMSRC has been set (e.g. in the vimrc) to the top-level directory of the Vim source & runtime distribution (on my system, currently ~/.build/vim/vim72 ) - First of all, build the database (done once). :new :lcd $VIMSRC/src :!cscope -bv ./*.[ch] ./perl.xs auto/*.h auto/pathdef.c I have searched the src/Makefile for a target doing this kind of stuff (the way the tags target builds a Vim tagfile for the same source) but have failed. It's not clear to me whether to repeat this after the sources change, I'll have to read the cscope manpage in more detail (it seems to say cscope is clever enough to update the database if the sources have changed, but can I rely on that?) BTW, here "cscope --version" anwsers: cscope: version 15.6 - Once per session (done manually when starting to use it). First two lines are of course not needed if already done by building the database as shown above. Last line (setting 'cscopequickfix') can be in vimrc. It is of course the "useful setting" given at ":help csqf" with no quotes (also no single quotes around 'csqf'). :new :lcd $VIMSRC/src :cs add cscope.out " use quickfix for most common queries :set csqf=s-,c-,d-,i-,t-,e- - Find where a symbol is defined (with an example from a recent vim_dev thread) :cs find g TBUFSZ - Find where symbol is used (using the same symbol) :cs find s TBUFSZ etc. Best regards, Tony. -- Jacquin's Postulate on Democratic Government: No man's life, liberty, or property are safe while the legislature is in session. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
Hi, > It's not clear to me whether to repeat this after the sources change, > I'll have to read the cscope manpage in more detail (it seems to say > cscope is clever enough to update the database if the sources have > changed, but can I rely on that?) No, Vim executes cscope with "<cscopeprg> -dl -f <databasename>" where <cscopeprg> is the value of 'cscopeprg' option. -d option prevents cscope from rebuilding its database. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
On 08/06/09 07:33, Sergey Khorev wrote: > Hi, > >> It's not clear to me whether to repeat this after the sources change, >> I'll have to read the cscope manpage in more detail (it seems to say >> cscope is clever enough to update the database if the sources have >> changed, but can I rely on that?) > > No, Vim executes cscope with "<cscopeprg> -dl -f <databasename>" where > <cscopeprg> is the value of 'cscopeprg' option. > > -d option prevents cscope from rebuilding its database. > > Ah, I see, thanks. If I invoke cscope -b again with the same arguments, and the database exists, will it "run faster" acording to which sources have been updated and which ones haven't, as mentioned near the top of the manpage? > cscope builds the symbol cross-reference the first time it is used on > the source files for the program being browsed. On a subsequent invoca- > tion, cscope rebuilds the cross-reference only if a source file has > changed or the list of source files is different. When the cross-refer- > ence is rebuilt, the data for the unchanged files are copied from the > old cross-reference, which makes rebuilding faster than the initial > build. If I got the list of files right, and since it is rather complex, it would be nice to have a "cscope" and/or "cscope.out" target in the src/Makefile, don't you think? -- Maybe I should define a user-command for it (:CscopeBuildVim or something) in my vimrc. Best regards, Tony. -- Really heard in court in the U.S.A.: Q.: So, the baby was conceived on 8 August? A.: Yes. Q.: And what were you doing then? A.: Fucking. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
Tony Mechelynck wrote: > Ah, I see, thanks. If I invoke cscope -b again with the same arguments, > and the database exists, will it "run faster" acording to which sources > have been updated and which ones haven't, as mentioned near the top of > the manpage? Yes, it will. But I think Vim source code is too small to make the difference critical. > If I got the list of files right, and since it is rather complex, it > would be nice to have a "cscope" and/or "cscope.out" target in the > src/Makefile, don't you think? I've been hardly using cscope last few years but this seems useful. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
In reply to this post by Tony Mechelynck
2009/6/8 Tony Mechelynck <[hidden email]>: > > I tried to understand how to use cscope (with the Vim source as a set of > sources to apply it to). Bram, correct me if I'm wrong. > > The following assumes $VIMSRC has been set (e.g. in the vimrc) to the > top-level directory of the Vim source & runtime distribution (on my > system, currently ~/.build/vim/vim72 ) > > - First of all, build the database (done once). > > :new > :lcd $VIMSRC/src > :!cscope -bv ./*.[ch] ./perl.xs auto/*.h auto/pathdef.c I execute cscope as: cscope -qbk ./*.[ch] ./perl.xs auto/*.h auto/pathdef.c proto/*.pro (note the header files proto/*.pro). In the cscope invocation -q allegedly makes the database lookups faster, and -k is responsible for not using the system header files (i.e. the ones lying in /usr/include) -- Cheers, Lech --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
In reply to this post by Tony Mechelynck
Tony Mechelynck skribis: > I tried to understand how to use cscope (with the Vim source as a set of > sources to apply it to). Bram, correct me if I'm wrong. > > The following assumes $VIMSRC has been set (e.g. in the vimrc) to the > top-level directory of the Vim source & runtime distribution (on my > system, currently ~/.build/vim/vim72 ) > > - First of all, build the database (done once). > > :new > :lcd $VIMSRC/src > :!cscope -bv ./*.[ch] ./perl.xs auto/*.h auto/pathdef.c Seems OK. I also use option -q (see man cscope). > I have searched the src/Makefile for a target doing this kind of stuff > (the way the tags target builds a Vim tagfile for the same source) but > have failed. > > It's not clear to me whether to repeat this after the sources change, > I'll have to read the cscope manpage in more detail (it seems to say > cscope is clever enough to update the database if the sources have > changed, but can I rely on that?) You often don't need to rebuild cscope DB if the code changes slightly. But if some functions are added to vim sourrce code for example, it's nicer to rebuild cscope DB or else you won't find the new functions for example. Vim source code is small anyway so rebuilding cscope DB is very fast. > BTW, here "cscope --version" anwsers: > cscope: version 15.6 On http://sourceforge.net/projects/cscope/, I see that the latest version is 15.7a, last update: Apr 30 2009. On my machine, I see: $ cscope --version cscope: version 16.0a So I'm a bit puzzled since 16.0a is newer than what website says. I don't remember when I built cscope. Maybe it was from a CVS snapshot. > - Once per session (done manually when starting to use it). First two > lines are of course not needed if already done by building the database > as shown above. Last line (setting 'cscopequickfix') can be in vimrc. It > is of course the "useful setting" given at ":help csqf" with no quotes > (also no single quotes around 'csqf'). > > :new > :lcd $VIMSRC/src > :cs add cscope.out > " use quickfix for most common queries > :set csqf=s-,c-,d-,i-,t-,e- In my ~/.vimrc, I have: if has('cscope') if filereadable(expand("$HOME/cscope.out")) cs kill -1 cs add ~/cscope.out endif set cscopeverbose " Put output of cscope in quickfix window (use :copen) set cscopequickfix=s-,c-,d-,i-,t-,e-,g- endif The "cs kill -1" is there to ensure that I don't get an error reloading the cscope DB in case I source my ~/.vimrc several times. You can find my .vimrc at: http://dominique.pelle.free.fr/.vimrc.html Regards -- Dominique --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
2009/6/8 Dominique Pellé <[hidden email]>: ... >> BTW, here "cscope --version" anwsers: >> cscope: version 15.6 > > On http://sourceforge.net/projects/cscope/, I see that the > latest version is 15.7a, last update: Apr 30 2009. > > On my machine, I see: > $ cscope --version > cscope: version 16.0a > > So I'm a bit puzzled since 16.0a is newer than what website says. > I don't remember when I built cscope. Maybe it was from a CVS > snapshot. Looks like you downloaded it from here (as I did): http://iamphet.nm.ru/cscope/index.html This was a special version to make it work with Vim's internal support to work with Win32 (that is at least why I have it). See :h cscope-win32 Dave --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
>> On my machine, I see: >> $ cscope --version >> cscope: version 16.0a >> >> So I'm a bit puzzled since 16.0a is newer than what website says. >> I don't remember when I built cscope. Maybe it was from a CVS >> snapshot. > > Looks like you downloaded it from here (as I did): > http://iamphet.nm.ru/cscope/index.html > > This was a special version to make it work with Vim's internal support > to work with Win32 (that is at least why I have it). Not necessarily. That Win32 build has version 16.0a because version number in CVS was 16.0a So either Dominique uses my Win32 build or built cscope from CVS. -- Sergey Khorev http://iamphet.nm.ru Can anybody think of a good tagline I can steal? --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~--- |
Free forum by Nabble | Edit this page |