Skip to contentSkip to conversation

trace-cmd: generate cscope.files when building cscope index

PATCH In review Marcelo Diop-Gonzalez 2 participants 9 messages Jan 12, 2020 – Jan 23, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: generate cscope.files when building cscope index

Currently, running 'make cscope' gives this output:

rm -f cscope*
find . -name '\.pc' -prune -o -name '*\.[ch]' -print -o -name '*\.[ch]pp' ! -name '\.#' -print | cscope -b -q
cscope: no source files found
make: *** [Makefile:351: cscope] Error 1

By default, cscope looks in cscope.files for the list of sources, so printing the source file list to this file fixes the above error.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index efd9ed4..0b15bf5 100644
@@ -348,7 +348,8 @@ TAGS:	force
 
 cscope: force
 	$(RM) cscope*
-	$(call find_tag_files) | cscope -b -q
+	$(call find_tag_files) > cscope.files
+	cscope -b -q
 
 install_plugins_traceevent: force
 	$(Q)$(MAKE) -C $(src)/lib/traceevent/plugins install_plugins
Signature · 1 line
2.20.1
#1 lore raw
Quoted 1 line · On Sun, 12 Jan 2020 14:05:37 -0500 Marcelo Diop-Gonzalez…

Currently, running 'make cscope' gives this output:

Hi Marcelo!

Quoted 20 lines

rm -f cscope*
find . -name '\.pc' -prune -o -name '*\.[ch]' -print -o -name '*\.[ch]pp' ! -name '\.#' -print | cscope -b -q
cscope: no source files found
make: *** [Makefile:351: cscope] Error 1

By default, cscope looks in cscope.files for the list of sources, so printing the source file list to this file fixes the above error.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index efd9ed4..0b15bf5 100644

Makefile TAGS: force · line 352

Quoted 6 lines
Makefile +2 -1
@@ -348,7 +348,8 @@ TAGS:	force
 
 cscope: force
 	$(RM) cscope*
-	$(call find_tag_files) | cscope -b -q
+	$(call find_tag_files) > cscope.files
+	cscope -b -q

I think the following should work too, without the need to create an extra file:

Makefile +1 -1
index efd9ed4b..782df41b 100644
@@ -348,7 +348,7 @@ TAGS:	force
 
 cscope: force
 	$(RM) cscope*
-	$(call find_tag_files) | cscope -b -q
+	$(call find_tag_files) | cscope -b -q -i-
 
 install_plugins_traceevent: force
 	$(Q)$(MAKE) -C $(src)/lib/traceevent/plugins install_plugins

Care to test it out. And feel free to resend this version.

Thanks!

-- Steve

#2 lore raw
Quoted 43 lines · Steven Rostedt
Quoted 1 line · On Sun, 12 Jan 2020 14:05:37 -0500 Marcelo Diop-Gonzalez…

Currently, running 'make cscope' gives this output:

Hi Marcelo!

Quoted 20 lines

rm -f cscope*
find . -name '\.pc' -prune -o -name '*\.[ch]' -print -o -name '*\.[ch]pp' ! -name '\.#' -print | cscope -b -q
cscope: no source files found
make: *** [Makefile:351: cscope] Error 1

By default, cscope looks in cscope.files for the list of sources, so printing the source file list to this file fixes the above error.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index efd9ed4..0b15bf5 100644

Makefile TAGS: force · line 352

Quoted 6 lines
Makefile +2 -1
@@ -348,7 +348,8 @@ TAGS:     force
 
 cscope: force
      $(RM) cscope*
-     $(call find_tag_files) | cscope -b -q
+     $(call find_tag_files) > cscope.files
+     cscope -b -q

I think the following should work too, without the need to create an extra file:

Makefile +0 -0
index efd9ed4b..782df41b 100644

Makefile TAGS: force · line 351

Quoted 5 lines
Makefile +1 -1
@@ -348,7 +348,7 @@ TAGS:       force
 
 cscope: force
        $(RM) cscope*
-       $(call find_tag_files) | cscope -b -q
+       $(call find_tag_files) | cscope -b -q -i-

Hi Steven!

I think one problem with this is that it requires that you pass cscope a list of files to look in when using it after building the index. Running "cscope"
with no arguments gives the output: "cscope: no source files found", whereas if cscope.files is populated, running "cscope" lets you look at everything that went into building the index. For example, I think running "make cscope" inside a kernel repository will spit out a 'cscope.files' (done in docscope() in ./scripts/tags.sh).
But I guess it depends on how people usually like to use cscope (I'm no expert!).
What do you think is best?

Thanks,

-Marcelo

Quoted 10 lines
Makefile +0 -0
 install_plugins_traceevent: force
        $(Q)$(MAKE) -C $(src)/lib/traceevent/plugins install_plugins
 

Care to test it out. And feel free to resend this version.

Thanks!

-- Steve

#3 lore raw
Quoted 33 lines · On Wed, 22 Jan 2020 12:21:54 -0500 Marcelo Diop-Gonzalez…
Quoted 25 lines
Quoted 10 lines
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index efd9ed4..0b15bf5 100644

Makefile TAGS: force · line 352

Quoted 6 lines
Makefile +2 -1
@@ -348,7 +348,8 @@ TAGS:     force
 
 cscope: force
      $(RM) cscope*
-     $(call find_tag_files) | cscope -b -q
+     $(call find_tag_files) > cscope.files
+     cscope -b -q  

I think the following should work too, without the need to create an extra file:

Makefile +0 -0
index efd9ed4b..782df41b 100644

Makefile TAGS: force · line 351

Quoted 5 lines
Makefile +1 -1
@@ -348,7 +348,7 @@ TAGS:       force
 
 cscope: force
        $(RM) cscope*
-       $(call find_tag_files) | cscope -b -q
+       $(call find_tag_files) | cscope -b -q -i-  

Hi Steven!

Quoted 11 lines

I think one problem with this is that it requires that you pass cscope a list of files to look in when using it after building the index. Running "cscope"
with no arguments gives the output: "cscope: no source files found", whereas if cscope.files is populated, running "cscope" lets you look at everything that went into building the index. For example, I think running "make cscope" inside a kernel repository will spit out a 'cscope.files' (done in docscope() in ./scripts/tags.sh).
But I guess it depends on how people usually like to use cscope (I'm no expert!).
What do you think is best?

As I do my development with emacs, I honestly have no opinion on the use of cscope. ;-)

Is it common practice to look at the file used for cscope? If it is, then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Thanks!

-- Steve

#4 lore raw
Quoted 49 lines · Steven Rostedt
Quoted 33 lines · On Wed, 22 Jan 2020 12:21:54 -0500 Marcelo Diop-Gonzalez…
Quoted 25 lines
Quoted 10 lines
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index efd9ed4..0b15bf5 100644

Makefile TAGS: force · line 352

Quoted 6 lines
Makefile +2 -1
@@ -348,7 +348,8 @@ TAGS:     force
 
 cscope: force
      $(RM) cscope*
-     $(call find_tag_files) | cscope -b -q
+     $(call find_tag_files) > cscope.files
+     cscope -b -q

I think the following should work too, without the need to create an extra file:

Makefile +0 -0
index efd9ed4b..782df41b 100644

Makefile TAGS: force · line 351

Quoted 5 lines
Makefile +1 -1
@@ -348,7 +348,7 @@ TAGS:       force
 
 cscope: force
        $(RM) cscope*
-       $(call find_tag_files) | cscope -b -q
+       $(call find_tag_files) | cscope -b -q -i-

Hi Steven!

Quoted 11 lines

I think one problem with this is that it requires that you pass cscope a list of files to look in when using it after building the index. Running "cscope"
with no arguments gives the output: "cscope: no source files found", whereas if cscope.files is populated, running "cscope" lets you look at everything that went into building the index. For example, I think running "make cscope" inside a kernel repository will spit out a 'cscope.files' (done in docscope() in ./scripts/tags.sh).
But I guess it depends on how people usually like to use cscope (I'm no expert!).
What do you think is best?

Quoted 4 lines

As I do my development with emacs, I honestly have no opinion on the use of cscope. ;-)

Is it common practice to look at the file used for cscope? If it is,

I find it useful to have cscope.files present just so that 'cscope' by itself works. Also I've been using https://github.com/dkogan/xcscope.el with emacs a bit, and it's easier to use with cscope.files present. I'm not too sure how common it is though, my only data point is myself I guess :)

Quoted 2 lines

then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Ah good point! I'll send out another version if this way's the way to go.

Thanks,

-Marcelo

Quoted 4 lines

Thanks!

-- Steve

#5 lore raw
Quoted 5 lines · On Wed, 22 Jan 2020 13:49:40 -0500 Marcelo Diop-Gonzalez…
Quoted 3 lines

then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Ah good point! I'll send out another version if this way's the way to go.

Yes, please do. Thanks!

-- Steve

#6 lore raw
Quoted 10 lines · Steven Rostedt
Quoted 5 lines · On Wed, 22 Jan 2020 13:49:40 -0500 Marcelo Diop-Gonzalez…
Quoted 3 lines

then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Ah good point! I'll send out another version if this way's the way to go.

Yes, please do. Thanks!

Ah actually, should these be covered by the 'cscope* ' lines in .gitignore and the clean make target?

-Marcelo

Quoted 2 lines

-- Steve

#7 lore raw
Quoted 8 lines · On Thu, 23 Jan 2020 14:51:53 -0500 Marcelo Diop-Gonzalez…
Quoted 7 lines · Steven Rostedt
Quoted 4 lines · On Wed, 22 Jan 2020 13:49:40 -0500 Marcelo Diop-Gonzalez…
Quoted 3 lines

then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Ah good point! I'll send out another version if this way's the way to go.

Yes, please do. Thanks!

Ah actually, should these be covered by the 'cscope* ' lines in .gitignore and the clean make target?

Ah, I guess they are ;-)

OK, I'll take your original patch. Thanks!

-- Steve

#8 lore raw
Quoted 16 lines · Steven Rostedt
Quoted 12 lines · On Thu, 23 Jan 2020 14:51:53 -0500 Marcelo Diop-Gonzalez…
Quoted 10 lines · Steven Rostedt
Quoted 5 lines · On Wed, 22 Jan 2020 13:49:40 -0500 Marcelo Diop-Gonzalez…
Quoted 3 lines

then I'm OK with your approach, but we need to make sure we update the .gitignore and clean make target to remove it.

Ah good point! I'll send out another version if this way's the way to go.

Yes, please do. Thanks!

Quoted 7 lines
Quoted 3 lines

Ah actually, should these be covered by the 'cscope* ' lines in .gitignore and the clean make target?

Ah, I guess they are ;-)

OK, I'll take your original patch. Thanks!

Sounds good, thanks!

-Marcelo

Quoted 2 lines

-- Steve