LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-18-2011, 02:42 AM   #1
cyker
LQ Newbie
 
Registered: Jul 2010
Location: Beijing
Distribution: Arch
Posts: 9

Rep: Reputation: 0
Unhappy Avoid declarations in cscope


I use vim+cscope. Since a struct or a function can be declared many times, when I want to find how it is defined, I'm troubled by a long list of declarations.

I use 'cscope f g [def]', and I don't know why declarations are listed.

So how can I configure cscope so that declarations won't be listed? Thanks.
 
Old 01-23-2011, 08:19 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Can you give us some example output ?
 
Old 01-24-2011, 05:13 AM   #3
cyker
LQ Newbie
 
Registered: Jul 2010
Location: Beijing
Distribution: Arch
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Can you give us some example output ?
I use cs f g task_struct to find out how it's defined, while the result is as follows (using cscope command line):


0 mmc_queue.h 5 struct task_struct;
1 cpu_buffer.h 18 struct task_struct;
2 udfdecl.h 42 struct task_struct;
3 current.h 6 struct task_struct;
4 processor.h 492 struct task_struct;
5 ptrace.h 58 struct task_struct;
6 system.h 12 struct task_struct;
7 file.h 79 struct task_struct;
8 profile.h 36 struct task_struct;
9 sched.h 528 struct task_struct {
a avc.h 32 struct task_struct;


But I just want Result 9.

So I think it'd be better if you can control macros/declarations/definitions for variables/functions separately. Is there any way to achieve this goal?

Last edited by cyker; 01-24-2011 at 05:15 AM.
 
Old 01-24-2011, 04:32 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Does it work correctly interactively ?

Code:
...
Find all function definitions: task_struct
...
 
Old 01-24-2011, 06:52 PM   #5
cyker
LQ Newbie
 
Registered: Jul 2010
Location: Beijing
Distribution: Arch
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Does it work correctly interactively ?

Code:
...
Find all function definitions: task_struct
...
I'm not quite clear what you mean by that. I don't see the "Find all function definitions:" option. I tried both command line cscope and cscope in Vim. Neither works...
 
Old 01-25-2011, 12:13 AM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Looks like we're on different versions .. I'm on Fedora 13 with cscope version 15.7a, what's yours ?
 
Old 01-25-2011, 04:56 AM   #7
cyker
LQ Newbie
 
Registered: Jul 2010
Location: Beijing
Distribution: Arch
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Looks like we're on different versions .. I'm on Fedora 13 with cscope version 15.7a, what's yours ?
Arch with version 15.7a. Available options are:

Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
 
Old 01-25-2011, 06:56 AM   #8
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Strange... my options:

Code:
Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
Find all function definitions:
Find all symbol assignments:
Try removing the cscope.out file, I think '-u' will unconditionally rebuild it as well
 
Old 01-26-2011, 09:02 AM   #9
cyker
LQ Newbie
 
Registered: Jul 2010
Location: Beijing
Distribution: Arch
Posts: 9

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by kbp View Post
Strange... my options:

Code:
Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:
Find all function definitions:
Find all symbol assignments:
Try removing the cscope.out file, I think '-u' will unconditionally rebuild it as well
But will it depend on versions? I just want to control macros/declarations/definitions for variables/functions separately. Does cscope implement this, or can you make it done in your version?
 
Old 01-26-2011, 03:59 PM   #10
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
It does work but according to the man page it can get confused, please read the Notices section for more details
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
CScope with color syntax ON amitpardesi Linux - General 2 09-22-2011 09:40 PM
[SOLVED] Is there any g++ Compiler option to avoid forward declarations akonchada Programming 6 09-24-2010 11:20 PM
cscope is in fedora 5 ptlchetan Linux - Software 4 09-24-2006 10:58 PM
Doubt regarding cscope subu_s Programming 2 02-25-2005 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration