Skip to content
hari-rangarajan edited this page Sep 14, 2017 · 1 revision

Frequently Asked Questions (FAQ)

General Usage

* How can I get started with CCTree quickly?

Take a look at the screencast for version 0.3. The only caveat is that it does not cover the recent xrefdb related commands.

* How can I initialize the CCTree database at start-up time?


The following line can be added to ~/.vimrc, assuming the cscope database name is cscope.out and vim is launched from the directory
containing the cscope.out file.

autocmd VimEnter * if filereadable('cscope.out') | CCTreeLoadDB cscope.out | endif

It is also possible to use the native xref database (built with CCTree or ccglue) in a similar fashion and load it directly upon startup

autocmd VimEnter * if filereadable('xref.out') | CCTreeLoadXRefDbFromDisk xref.out | endif

* I spent a bit of time loading a cscope database, can I retain the session state on a subsequent vim session?

Yes, take a look at the :CCTreeSaveXRefDb, :CCTreeLoadXrefDb, :CCTreeLoadXRefDbFromDisk commands. Also, check out ccglue to save on loading time.

Key mappings/Preview/


* Are there shortcuts for using folding capabilities of CCTree?

Refer to |:help fold|. Standard Vim folding shortcuts will work in the CCTree window.


* When attempting to open symbols in CCTree window, an error  "Tag file not found" pops up

CCTree leverages the cscope and tags interface for locating the tags instead of re-inventing the wheel. Refer to |cscope| or |tags| for setting it up
accordingly.

* The default shortcuts get my arms into a knot...

Users can custom-map the short-cut  overriding the following variables on their Vim start-up configuration.
   g:CCTreeKeyTraceForwardTree = '<C-\>>'
   g:CCTreeKeyTraceReverseTree = '<C-\><'
   g:CCTreeKeyHilightTree = '<C-l>'
   g:CCTreeKeySaveWindow = '<C-\>y'
   g:CCTreeKeyToggleWindow = '<C-\>w
   g:CCTreeKeyCompressTree = 'zs'  
   g:CCTreeKeyDepthPlus = '<C-\>='
   g:CCTreeKeyDepthMinus = '<C-\>-'

Performance

* "CCTree is slow"

Version 0.85 addresses the slow loading speed issue. Database loading and decompression speeds should be 3-4x times faster than previous versions.

* "CCTree cannot load large database files"


Version 0.90 added this functionality through external split utility or internal perl interface.

* Benchmark results?

Dual Core 2.4Ghz/Vim 7.3

Linux kernel source code 2.6.37.1
-rw-r--r-- 1 xx xx 280573897 2011-02-19 08:55 /tmp/cscope.out
CCTree: Done loading database. Xref Symbol Count: 267445. Time taken: 663.358394 secs


* CCTree is still not usable for my very large project

The ccglue project (http://ccglue.sourceforge.net/) provides an external utility that can cross-reference files. The project is developed in C code with
an emphasis on performance. Check out the section on using ccglue.

Miscellaneous Issues

* "CCTree: Done loading database. xRef Symbol Count: 0. "

Check :messages, most likely, the split utility didn't work with the default settings. Please refer to the help section on how to tweak
this for your system. Version 1.51 adds robust error reporting for such failures.

* "I get an error message akin to Split option -C not supported"

The problem:  SunOS split utility does not support -C option (GNU coreutils and linux derivates do).

Now, you have two choices here, add one of the two to your .vimrc:
1) let CCTreeDbFileMaxSize = 100000000          (set this to a high number, so its always memory)

2) let CCTreeSplitProgOption = '-l'

    let CCTreeDbFileSplitLines = 100000                 (this is the number of lines you want to split to conserve RAM)

* "I do not see all symbols in my dependency tree"

Cscope parser does run into trouble at times with code segments involving pre-processor statements (reference). Unfortunately, this is a
limitation hard to correct without writing another cscope within cctree (and is best avoided).



Starting from 0.85, these steps should no longer be necessary.

* My Cscope database takes a long time to load?


Use option "-c" to build an uncompressed database. Compressed databases require additional time to uncompress. Caveat will be extra
disk space usage.

* I have a huge Cscope database and Vim complains that it runs out of memory when I use CCTree to load it?

There is a possible work-around using a two-step process:

(i) Strip the cscope database to essentials by running this command:
            sed -n -e '/^\t[`#$}@~]/p' < cscope.out > /tmp/cscope.min

(ii) Now, load with ':CCTreeLoadDB /tmp/cscope.min'


NOTE: Older versions of sed have trouble interpreting the '\t' tab character in the regular expression. In that case, it is advised that you try the old trick of inserting a real tab using 'Ctrl-V[tab key]'.

* I tried the solution mentioned in (2), but I still can't load my huge database. What now?

The best work-around would be to break the cscope database into smaller exclusive sets of files. CCTree attempts to cross-reference the symbols in memory. Although, the same can be done on disk -- the VimScript API is limited in terms of functionality to achieve the same.
    If more people express interest in fixing this problem of loading huge databases, then I can request for a change in the VimScript API. Although this can be done using a perl or python extension (Note: Version 0.1 and 0.2 do have a perl interface that can be tried out, its no longer supported in the later versions), I assume native functionality is usually desired. Please write to me and let me know how you feel about this.



Clone this wiki locally