> -----Original Message----- > From: Javier Martinez Canillas [mailto:martinez.javier@xxxxxxxxx] > Sent: Friday, December 16, 2011 6:04 PM > To: Jeff Haran > Cc: Alexandre Courbot; Jimmy Pan; Kernelnewbies@xxxxxxxxxxxxxxxxx > Subject: Re: Is there a way to build a cross reference with kernel file > > On Sat, Dec 17, 2011 at 1:58 AM, Jeff Haran <jharan@xxxxxxxxxxxxxx> > wrote: > >> -----Original Message----- > >> From: kernelnewbies-bounces@xxxxxxxxxxxxxxxxx > [mailto:kernelnewbies- > >> bounces@xxxxxxxxxxxxxxxxx] On Behalf Of Alexandre Courbot > >> Sent: Monday, October 24, 2011 7:05 PM > >> To: Jimmy Pan > >> Cc: Kernelnewbies@xxxxxxxxxxxxxxxxx > >> Subject: Re: Is there a way to build a cross reference with kernel > > file > >> > >> On Tue, Oct 25, 2011 at 12:00 AM, Jimmy Pan <dspjm1@xxxxxxxxx> > wrote: > >> > It seems we can use ctags, while, I don't really know how to > > implement it. > >> > I don't want to use the online cross reference every time... > >> > >> I personally use KDevelop to navigate the kernel. It's not perfect yet > >> and a little bit tricky to configure correctly, but it's still pretty > >> efficient and I work on improving it. I wrote about it recently: > >> http://www.gnurou.org/code/kdevelop-kernel > >> > >> CTags is also known to work well, actually there is even a 'make tags' > >> target in the kernel's Makefile. > >> > >> Hope this helps, > >> Alex. > > ... > > Has anybody found a tool the solves this kind of problem well? > > Specifically, given a struct foo containing a field named bar, show me > > all of the code that references the bar field of struct foos but not the > > bar fields of other structures nor instances of variables that are > > themselves named bar. > > > > I realize that with things like arbitrary type casting and the C > > pre-processor, doing this kind of thing with 100% accuracy could be > > quite difficult. But even if it was only partially successful at > > eliminating the false positives that come with tools like cscope, it > > could save a lot of time. > > > > Well you can always rely on conventions. For the sk_buff example, > generally the kernel uses sk_buff pointers and the variable name is > almost always skb. So git grep skb->cb is a good approach to this. Problem is one can't count on these conventions being followed. There are pointers to struct sk_buffs that aren't named skb (for example, struct sk_buff *skbuff and struct sk_buff *skb2 appear in several places) so by assuming they are all named skb will mean you miss some that might be important. ... > Again, ETAGS and tools like that are good for pointing where a symbol > is defined, but its usage is a little more trickier. Like you said the > kernel uses _lots_ of functions pointers so I don't think that a tool > that shows me every place a given function is called will be easier > (if possible) to implement. Yes, that's another problem. And agreed, something like this would likely be difficult to put together given the way C works. > Hope it helps, > > -- > Javier Martínez Canillas > (+34) 682 39 81 69 > Barcelona, Spain Well, it helps in the sense that I think it answers my question. No such tool seems to exist. Thanks, Jeff Haran _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies