Skip to contentSkip to conversation

Non-web based LXR

DISCUSSION Tobin C. Harding 6 participants 8 messages Oct 30, 2017 – Nov 2, 2017

lore
Share & tools
lore
#0 lore raw

CC'd Thomas because I read online recently him commenting on web based cross reference tools.

Hi,

Does any one use a terminal based source code cross referencer to search the kernel tree?

thanks,
Tobin.

#1 lore raw
Quoted 2 lines · Tobin C. Harding

Does any one use a terminal based source code cross referencer to search the kernel tree?

Are you including 'git grep'?

#2 lore raw
In reply to Tobin C. Harding

If you use vim or emacs then cscope is very useful for spelunking the sources.

At the top level of your kernel source tree use the cscope target under make

make cscope

Vim from 7 ish onwards is compiled with +cscope so it automatically recognizes cscope.out files.

Within vim you can use the default keybindings of CTRL-] to jump to a definition of a variable or function and CTRL-t to jump back. There are many more for finding for ex who calls a given function.

Just make sure you open vim in the top level directory, the same one as the cscope.out file which was created when you invoked "make cscope"

Works with emacs too, but I'm not an emacs user.

The documentation on cscope can be a bit confusing, since cscope may be used in an interactive curses mode, this is not something I've ever found useful.

So focus on investigating vim cscope bindings and vimrc mappings.

Cheers

Rob Rennison

Regarding "searching

Quoted 15 lines · Tobin C. Harding

CC'd Thomas because I read online recently him commenting on web based cross reference tools.

Hi,

Does any one use a terminal based source code cross referencer to search the kernel tree?

thanks,
Tobin.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#3 lore raw
In reply to Tobin C. Harding
Quoted 10 lines · Tobin C. Harding

CC'd Thomas because I read online recently him commenting on web based cross reference tools.

Hi,

Does any one use a terminal based source code cross referencer to search the kernel tree?

thanks,
Tobin.

Responding to all responses in single email. Thanks for the responses. Apologies, I need to learn to be more explicit when asking questions to be more respectful of other peoples time.

I already use grep (various versions, git grep, egreg, and ack).

I also already use ctags in emacs (or is it called etags when in emacs).

I [too] often still find myself going to

http://elixir.free-electrons.com

I just attempted to recreate an example search that fails using grep or ctags but was unable to. Perhaps the problem is a user error, i.e I come across a code search that is not fully serviced by grep/ctags, go to free-electros, then go back to it from habit only later realizing that I am doing so when I get annoyed with having to use a web browser.

So, thank you for your ideas. I'll consider this issue resolved by;

Use git grep
Use ctags/etags
Use free-electrons as a last resort

thanks,
Tobin.

#5 lore raw
Quoted 7 lines · Fran?ois
Quoted 5 lines · Tobin C. Harding

So, thank you for your ideas. I'll consider this issue resolved by;

Use git grep
Use ctags/etags
Use free-electrons as a last resort

Quoted 6 lines

Also, there's a tool called cscope [1].
There are also occurences of coccigrep [2] in the kernel.

[1] https://courses.cs.washington.edu/courses/cse451/12sp/tutorials/tutorial_cscope.html
[2] https://home.regit.org/software/coccigrep/

and another to add to the list is gscope, which is based off of cscope:

* https://github.com/tefletch/gscope

--Mike

#6 lore raw
In reply to François
Quoted 9 lines · Fran?ois
Quoted 5 lines · Tobin C. Harding

So, thank you for your ideas. I'll consider this issue resolved by;

Use git grep
Use ctags/etags
Use free-electrons as a last resort

Also, there's a tool called cscope [1].
There are also occurences of coccigrep [2] in the kernel.

Cool, thanks Fran?ois

#7 lore raw
In reply to François
Quoted 7 lines · Fran?ois
Quoted 5 lines · Tobin C. Harding

So, thank you for your ideas. I'll consider this issue resolved by;

Use git grep
Use ctags/etags
Use free-electrons as a last resort

Quoted 5 lines

Also, there's a tool called cscope [1].
There are also occurences of coccigrep [2] in the kernel.

[1] https://courses.cs.washington.edu/courses/cse451/12sp/tutorials/tutorial_cscope.html
[2] https://home.regit.org/software/coccigrep/

and another to add to the list is gscope, which is based off of cscope:

* https://github.com/tefletch/gscope

--Mike