Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Emacs + cscope (xcscope.el)

  1. #1
    Join Date
    May 2005
    Beans
    3

    Emacs + cscope (xcscope.el)

    Hi there:

    Can anyone give me some tips on using cscope and emacs?

    I was able to load xcscope.el from cscope package. However, whenever i tries to use it, it says it finds nothing.

    I edited my .emacs like this:
    Code:
    (load-file "/usr/share/emacs/site-lisp/xcscope.el")
    (require 'xcscope)
    Then, I untar-ed linux kernel in my home folder, under which I ran cscope to generate search database. And I tried to edit some files

    Code:
    me@box:~/linux-source-2.6.22$ cscope -R -q -b
    me@box:~/linux-source-2.6.22$ emacs kernel/time.c
    When I tried to find symbol definition using C-c s d, it returns no matched result

    Code:
    Finding symbol: tv_nsec
    
    Database directory: /home/me/linux-source-2.6.22/
    -------------------------------------------------------------------------------
    cscope: no source files found
    
    -------------------------------------------------------------------------------
    
    Search complete.  Search time = 0.01 seconds.
    Can someone tell me what I did wrong?

  2. #2
    Join Date
    Nov 2007
    Beans
    3

    Re: Emacs + cscope (xcscope.el)

    Hi,

    I am also facing the same problem mentioned by you in this post. Please let me know if you were able to solve this.

    Thanks
    TuxFan

  3. #3
    Join Date
    Nov 2007
    Beans
    3

    Re: Emacs + cscope (xcscope.el)

    I was able to solve this problem by adding the following lines in the emacs startup file, .emacs. although I am not sure how it solved the problem.

    (setq cscope-do-not-update-database t)
    (load-file "/usr/share/emacs/site-lisp/xcscope.el")
    (require 'xcscope)

    Cheers
    TuxFan

  4. #4
    Join Date
    Aug 2008
    Beans
    1

    Re: Emacs + cscope (xcscope.el)

    But I think it is because you didn't use abs path s to make the cscope database. Then when you lingered to other directories it can't find appropriate definitions.

  5. #5
    Join Date
    May 2008
    Beans
    32

    Re: Emacs + cscope (xcscope.el)

    I'm guessing no one cares anymore, but in case someone stumbles upon this while searching (like I did) here is what worked for me:

    Like suggested, put
    Code:
    (load-file "/usr/share/emacs/site-lisp/xcscope.el")
    (require 'xcscope)
    in your .emacs file.

    Then, if you have code in ~/mycode, cd to that directory and run
    Code:
    myusernam@mycomputer:~/mycode$ cscope-indexer -r
    That should generate the required files. Then you can just open any file in emacs and cscope should work.

  6. #6
    Join Date
    Mar 2009
    Beans
    1

    Re: Emacs + cscope (xcscope.el)

    Well I care mkokotovich. Thanks for your post. That just solved the problem for me, specifically using the command cscope-indexer to generate the index rather than just running cscope itself.

  7. #7
    Join Date
    Jan 2007
    Location
    India
    Beans
    29

    Question Re: Emacs + cscope (xcscope.el)

    Having faced a similar ordeal, I tried the suggestions in this thread by changing my .emacs file to include
    Code:
    (load-file "/usr/share/emacs/site-lisp/xcscope.el")
    After having done that, as mkokotovich suggested, I tried to run the cscope-indexer on the top level directory of my src tree.

    It gave me:
    Code:
    /usr/bin/cscope-indexer: line 142: cscope.files: No such file or directory
    Finally I opened a sample file and ran
    Code:
    cscope-find-this-symbol
    which gave me the list of all places that has that symbol (defined or declared or used). I chose a sample line and pressed return hoping cscope would take me to the relevant src file. But instead I got:
    Code:
    path to file is not readable or exists
    Additionally, to be specific I am trying to create a database of the linux kernel src tree. As a test I opened the file /include/linux/skbuff.h and then searched for the symbol sk_buff which is declared in the file. It gives me a long list of all the files containing that symbol. On clicking one of the entries in the list I get the following
    Code:
    /usr/src/linux/include/linux/include/linux/skbuff.h does not exist or is not readable
    Closely examine the line above. The substring in bold face is something that seems to have come from nowhere. The actual path is /usr/src/linux/include/linux/skbuff.h so there must be something wrong in the set up of cscope here.

    Kindly let me know what mistake am I doing.

    Regards,
    Aijaz
    Last edited by aijazbaig1; March 16th, 2010 at 10:01 AM. Reason: additional info

  8. #8
    Join Date
    May 2008
    Beans
    32

    Re: Emacs + cscope (xcscope.el)

    Let's handle one problem at a time here. First, cscope-indexer. That shouldn't be spitting out any errors like that. Can you describe exactly how you ran it? (i.e. which directory you were in, who you were logged in as, what arguments you supplied, etc)

    Then, if you want to open /usr/bin/cscope-indexer in a text editor (it is a script) and copy and paste lines 130-150 into your reply. Hopefully we can figure out why it is failing.

  9. #9
    Join Date
    Jan 2007
    Location
    India
    Beans
    29

    Re: Emacs + cscope (xcscope.el)

    Hello people,

    @mkokotovich:
    Can you describe exactly how you ran it? (i.e. which directory you were in, who you were logged in as, what arguments you supplied, etc)
    I was in the top level directory of my linux kernel source tree where I ran the cscope-indexer in a shell as a super user. The way I ran it was exactly like what you mentioned in your last post. Like so
    Code:
    /usr/bin/cscope-indexer -r
    Well I didn't knew it is a script. Nonetheless, now my cscope seems to be working for some strange reason. Well I would try opening the script in an editor and see whats inside.
    Then, if you want to open /usr/bin/cscope-indexer in a text editor (it is a script) and copy and paste lines 130-150 into your reply.
    Do you mean I should first run the indexer like before and then if it fails I should copy those lines (so you can see the arguments and other variables it might have been working on)?

    Keen to hear from you,

  10. #10
    Join Date
    Jan 2005
    Location
    Israel
    Beans
    74

    Re: Emacs + cscope (xcscope.el)

    I am using 'ascope.el' (627 lines) written by Staton Sun
    that I got from him sunnycamel-AT-gmail-DOT-com.
    It works fine form me. I wish I could attach it here.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •