[Linux] Emacs + cscope

Status
Not open for further replies.
NOTE:This is regarding the linux kernel.

I use linux along with freebsd which I have recently started exploring. I hope you guys here might have dabbled enough with kernel code and as such would not mind helping another open source fellow get with his thing. :)

I am trying to configure emacs so that I can use it with cscope. I followed the instructions in this page and this.
Additionally I also added
Code:
(load-file "/usr/share/emacs/site-lisp/xcscope.el")
to my .emacs file.

After having done that, I ran 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:
[I]path to file[/I] 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[B]/include/linux/[/B]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
 
Dear Aijaz,

Unfortunately I don't know enough about Emacs to help you but I think you 'll find the following link really helpful for your studies until you figure out how to properly configure Emacs; it's what I'm using nowdays to study freebsd kernel code.

http://fxr.watson.org/

happy hacking!
 
Hi there,
I have it installed already on my box. Its just that I am so fond of emacs that I would like to have a way to use it within emacs just like we use gdb from within emacs.

Well..thanks for the watson tip.
 
Code:
OPTIONS=	XCSCOPE "Install (X)Emacs package" off

Did you enable that option?
 
I'm getting confused by this thread ;) Is this a question about running emacs on Linux or on FreeBSD?
 
It's emacs on FreeBSD but the OP is doing some linux kernel work :e
 
Sorting the Mess !!

Hello there fellows,

I guess I got people here a lil confused, my bad :p. Actually I have been wanting to use cscope on the linux kernel and now I have even installed it on my FreeBSD box.

The thing with this is that, I have followed the docs related to getting the thing working to the point but it still seems that things aren't working.

Like, now I have created an 'inverted index' on the FreeBSD kernel source and I have integrated cscope with emacs.

The way I did the former task was that I first created a 'cscope.files' file in a directory like so:
Code:
find /usr/src/sys/ -name "*.[chxsS]" -print > /home/aijazbaig1/cscope.files
Then I chdir'd to the directory containing the 'cscope.files' file and then ran
Code:
cscope -b -q -k
so it created three files cscope.out cscope.in.out cscope.po.out.

Now assuming everything is fine, I open emacs and then I search for the global definiton of say mbuff and it gives me a list of possible answers. Then when I run a search again 'in the same buffer' I get a message which reads that it cannot open cscope.out. Now this is really confusing me. I don't know why it cannot open that file a second time (or may be there is something else which I do not know of :p)

Please do let me know if you need some more diagnostic information.

Update:
****************************************************************************
Here are the links from where I got my info:

About integrating using cscope with emacs:
http://www.linux.com/archive/feature/114237

About using cscope on large projects:
http://cscope.sourceforge.net/large_projects.html

And some tips from here and there.

Plus here is my .emacs file:
Code:
(global-font-lock-mode t)              ; always highlight source code
(blink-cursor-mode -1)                 ; make cursor not blink
(setq-default indent-tabs-mode nil)    ; use 8 spaces instead of 1 tab
(setq require-final-newline t)         ; make sure all files end in \n
(setq case-fold-search t)              ; search is case-insensitive
;(if window-system
 ; (setq mouse-wheel-mode t))           ; enable mouse wheel in graphical mode
(setq c-basic-offset 4)                ; make indent size 4 spaces in C
(global-set-key [(meta g)] 'goto-line) ; bind M-g to the goto-line command
(show-paren-mode t)
(transient-mark-mode t)
(set-background-color "gray22")
(set-foreground-color "green yellow")
(setq inhibit-startup-message t)
(fset 'yes-or-no-p 'y-or-n-p)
(setq insert-default-directory t)
(setq inhibit-splash-screen t) ;; no splash screen
(progn
  (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))  ;; no toolbar
  ;;(menu-bar-mode -1) ;;no menubar
  (scroll-bar-mode -1) ;; no scroll bar
)
(progn (cd "/home/aijazbaig1/cscopedbase/") (normal-top-level-add-subdirs-to-load-path))
(load-file "/home/aijazbaig1/cscopedbase/xcscope.el")
(require 'xcscope)
(setq cscope-do-not-update-database t)
(setq cscope-set-initial-directory "/usr/src/sys/")

; retitle emacs window
 (defun frame-retitle (title)
   (modify-frame-parameters 
     nil 
     (list
       (cons
          'name
          title
       )
     )
   )
 )
  
 ;; set a beautiful title bar
 (setq frame-title-format
       '("%S: " (buffer-file-name "%f"
                                  (dired-directory dired-directory "%b"))))
 
Status
Not open for further replies.
Back
Top