Skip to contentSkip to conversation

id-utils?

Cocci Wolfram Sang 2 participants 6 messages May 25, 2013 – May 27, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

I wanted to try the --id-utils option to see what the speedup was like. The docs mention a script called 'idindex-cocci.sh' to generate the index but I am unable to find it (no luck in older version of coccinelle, too). Does someone still have it? And in one older mail thread cscope was mentioned as an alternative. Has this been tried meanwhile?

Thanks,

Wolfram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130525/b6202329/attachment.asc>

#1 lore raw
Quoted 8 lines · Wolfram Sang

Hi,

I wanted to try the --id-utils option to see what the speedup was like. The docs mention a script called 'idindex-cocci.sh' to generate the index but I am unable to find it (no luck in older version of coccinelle, too). Does someone still have it? And in one older mail thread cscope was mentioned as an alternative. Has this been tried meanwhile?

I don't seem to have it, which is quite strange... I'll try to make another one.

julia

#2 lore raw
In reply to Wolfram Sang

Attached.

julia

Quoted 9 lines · Wolfram Sang

Hi,

I wanted to try the --id-utils option to see what the speedup was like. The docs mention a script called 'idindex-cocci.sh' to generate the index but I am unable to find it (no luck in older version of coccinelle, too). Does someone still have it? And in one older mail thread cscope was mentioned as an alternative. Has this been tried meanwhile?

Quoted 4 lines

Thanks,

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: idutils_index.sh
Type: application/x-sh
Size: 48 bytes
Desc:
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130525/84fb3123/attachment.sh>

#3 lore raw
Quoted 1 line · Julia Lawall

Attached.

Thanks, works like a charm! Processing the kernel took 20 seconds (plus 3 minutes to generate the index once). Without idutils, processing was 9 minutes. So, I love it!

I found out that I can also use the index generated by the viewer 'seascope'. The name is 'ID' instead of '.id-utils.index', so I symlinked to it. It might be an idea to give the --use-idutils option an optional filename argument to point to the index it should use?

Anyhow, thanks for the help, this seems to speed up things by a magnitude.

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20130527/98f89a8c/attachment.asc>

#4 lore raw
Quoted 11 lines · Wolfram Sang
Quoted 1 line · Julia Lawall

Attached.

Thanks, works like a charm! Processing the kernel took 20 seconds (plus 3 minutes to generate the index once). Without idutils, processing was 9 minutes. So, I love it!

I found out that I can also use the index generated by the viewer 'seascope'. The name is 'ID' instead of '.id-utils.index', so I symlinked to it. It might be an idea to give the --use-idutils option an optional filename argument to point to the index it should use?

I'll try to do that. I don't know if the ocaml argumenmt parser supports optional arguments. If not it will have to be some other argument flag.

Thanks for the feedback.

julia

#5 lore raw
In reply to Wolfram Sang
Quoted 4 lines

I found out that I can also use the index generated by the viewer 'seascope'. The name is 'ID' instead of '.id-utils.index', so I symlinked to it. It might be an idea to give the --use-idutils option an optional filename argument to point to the index it should use?

A patch is below. It is only very lightly tested.

julia

commit 4bac82f94d224182f8af80046d23f2e708c9a7b5

Author: julia <[email protected]>
Date:   Mon May 27 22:54:57 2013 +0200

optional file name argument for idutils

docs/manual/spatch_options.tex +9 -2
index feca3f1..d163d2d 100644
@@ -188,12 +188,19 @@ specified.  The index may be created using the script {\tt
 http://webglimpse.net/.  In conjunction with the option {\bf --patch-cocci}
 this option prints the regular expression that will be passed to glimpse.}
 
-\normal{--use-idutils}{ Use an id-utils index created using lid to select
+\normal{--use-idutils $[\langle$file$\rangle]$}
+{ Use an id-utils index created using lid to select
   the files to which a semantic patch may be relevant.  This option
   requires that a directory is specified.  The index may be created using
   the script {\tt coccinelle/scripts/ idindex-cocci.sh}.  In conjunction
   with the option {\bf --patch-cocci} this option prints the regular
-  expression that will be passed to glimpse.}
+  expression that will be passed to glimpse.
+
+The optional file name option is the name of the file in which to find the
+index.  It has been reported that the viewer seascope can be used to
+generate an appropriate index.  If no file name is specified, the default
+is .id-utils.index.
+}
 
 \rare{--dir}{ Specify a directory containing C files to process.  A trailing
   {\tt /} is permitted on the directory name and has no impact on the
main.ml +12 -1
index 22c1f32..ac570b1 100644
@@ -302,7 +302,9 @@ let short_options = [
   "    works with -dir, use info generated by glimpseindex";
   "--use-google", Arg.String (function s -> Flag.scanner := Flag.Google s),
   "    find relevant files using google code search";
-  "--use-idutils", Arg.Unit (function s -> Flag.scanner := Flag.IdUtils),
+  "--use-idutils",
+  Arg.String (function s -> Flag_parsing_cocci.id_utils_index := s;
+    Flag.scanner := Flag.IdUtils),
   "    find relevant files using id-utils";
   "--patch",
     Arg.String (function s -> Flag.patch := Some (Cocci.normalize_path s)),
@@ -1021,6 +1023,14 @@ let fix_chars s =
   then "-"^(String.concat "-" (Str.split (Str.regexp_string "_") s))
   else s
 
+let rec fix_idutils = function
+    [] -> []
+  | ["--use-idutils"] -> ["--use-idutils";".id-utils.index"]
+  | "--use-idutils"::second::rest
+    when String.length second > 0 && String.get second 0 = '-' ->
+       "--use-idutils"::".id-utils.index" :: (fix_idutils (second :: rest))
+  | x :: rest -> x :: (fix_idutils rest)
+
 (*****************************************************************************)
 (* The coccinelle main entry point *)
 (*****************************************************************************)
@@ -1029,6 +1039,7 @@ let main () =
     let arglist = Array.to_list Sys.argv in
     let arglist = Command_line.command_line arglist in
     let arglist = List.map fix_chars arglist in
+    let arglist = fix_idutils arglist in
 
     let contains_cocci =
       (* rather a hack... don't want to think about all possible options *)
parsing_cocci/flag_parsing_cocci.ml +2 -0
index 4f446d2..76f415b 100644
@@ -14,3 +14,5 @@ let disabled_isos = ref ([] : string list)
 
 (* Used to debug embedded ML scripts *)
 let keep_ml_script = ref false
+
+let id_utils_index = ref ".id-utils.index" (* default id-utils value *)
parsing_cocci/id_utils.ml +2 -2
index a53feca..d7052dc 100644
@@ -17,8 +17,8 @@ let rec interpret dir exp =
 	(match exp with
 	  GC.Elem oo ->
 	    let cmd =
-	      Printf.sprintf
-		"lid -f %s/.id-utils.index -l %s -S newline" dir oo in
+	      Printf.sprintf "lid -f %s/%s -l %s -S newline"
+		dir !Flag_parsing_cocci.id_utils_index oo in
 	    Common.cmd_to_list cmd
 	| GC.And l ->
 	    let rec loop = function