2

I was writing much java code lately and got quite used to IDE features like jumping to definitions.

Now I'm working on C (reading some kernel code) and wonder if there is any similar tooling for that language, too.

I am aware of ctags, cscope, and lxr, but they seem to rely much on pattern matching and do not really understand the code.

For example I have some code using struct file, how do I navigate to the definition of that struct in order to determine the available fields?

Even if I know that it is defined in fs.h and it contains a field of type fmode_t defined in types.h as unsigned __bitwise__, is there a way to get the semantics of the single bits? (Probably by finding the FMODE_* constants in fs.h again.)

Is this kind of (eclipse-like) direct navigating possible, or do I really have to do much guessing if I do not know all of this before?

michas
  • 25,361
  • 15
  • 76
  • 121
  • 1
    I use OpenGrok for this: http://opengrok.github.io/OpenGrok/ It is web interface on `ctags` which is extremely useful. But it fails to find `struct file` definition because `struct file* file` constructs are too popular in kernel. But it works well with typedefs: http://code.metager.de/source/search?q=defs%3Afmode_t&path=%2Flinux%2Fstable%2F&project=linux – myaut Mar 14 '15 at 19:07
  • > Is this kind of (eclipse-like) direct navigating possible < Didn't you try that with Eclipse CDT? AFAIK, it supports that. – myaut Mar 14 '15 at 19:09
  • Parsing C code correctly (which is required for navigating it) is a hard problem. All the #defines, #ifdefs, typedefs, different builds configured outside source code, and so on and so on, basically mean that to have 100% correct source code navigation, the code needs to be fully parsed as if by compiler. Some IDEs do a decent job (I use Qt Creator, but I'm sure there are better IDEs for C projects). Good "Find in files" is your friend here, and knowing how to use it. – hyde Mar 14 '15 at 19:15

2 Answers2

0

If you like eclipse try nsight. It's for cuda, but I think it gives you what you want.

fhtuft
  • 966
  • 5
  • 8
0

Try QtCreator for the Linux kernel. I wrote how to use it here. It is the best IDE for Linux kernel development I have ever seen.

Community
  • 1
  • 1
RedEyed
  • 2,062
  • 1
  • 23
  • 26