0

i'm studying about os especially linux kernel

i'll tell my situation.

i downloaded linux kernel at kernel.org and get some tools like ctags, cscope and add some plugin at vimrc and i think, i compiled kernel too. there are linux-header.deb and linux-image.deb at the folder, and did something to cscope. so i got cscope.out and i know command cscope -d

and now, my question is what can i do with cscope-d?

i need to find task_struct and thread_struct, and what's the variable of thread_struct type in task_struct

i dont know what can i do with cscope. there are 'find c symbol', 'global definition', 'text string' etc

when i typed task_struct at 'find this c symbol' there are lots of header files. whe i typed task_struct at 'global defition' there are lots too 1)what's the difference with that two?

and when i entered a header, there's just a statement with out detail of struct. 2)something i missed? or i need to check all of header files?

it was long, but questions are 1) and 2) i need ur help:(

jan
  • 1
  • 1

1 Answers1

0

Please have a look at some existing articles or posts like here, here and here.

I have not used cscope but I tend to recommend generating tags especially since for kernel you can generate tags by simply invoking "make tags" from the root of the kernel source directory. For jumping to a definition, you can then do Ctrl + [. You can see the rest of bindings here. Note that to be more specific this is ctags and works without any special settings for vim.

To answer your question on "lots of header files". task_struct is defined in lockdep.h or sched.h and have different fields and information depending on that context. The rest of instances that you see, for example like in arch/ directories tend to be forward declarations. For an understanding of task_struct, you might want to have a look at this.

For forward declaration, see here.

Sanchayan Maity
  • 637
  • 6
  • 19