1CSGREP(1) User Commands CSGREP(1)
2
3
4
6 csgrep - filter the list of defects by the specified regex-based predi‐
7 cates
8
10 csgrep [options] [file1.err [...]], where options are:
11
13 --checker arg
14 defect matches if its checker matches the given regex (each
15 defect has assigned exactly one checker)
16
17 --path arg
18 defect matches if the path of its key event matches the given
19 regex
20
21 --event arg
22 defect matches if its key event matches the given regex (each
23 defect has exactly one key event, which determines its location
24 in the code)
25
26 --error arg
27 defect matches if the message of its key event matches the given
28 regex
29
30 --msg arg
31 defect matches if any of its messages matches the given regex
32
33 --annot arg
34 defect matches if its annotation matches the given regex
35
36 --src-annot arg
37 defect matches if an annotation in the _source_ file matches the
38 given regex
39
40 -U [ --embed-context ] arg
41 embed a number of lines of context from the source file for the
42 key event
43
44 --prune-events arg
45 event is preserved if its verbosity level is below the given
46 number
47
48 -u [ --remove-duplicates ]
49 remove defects that are not unique by their key event
50
51 --strip-path-prefix arg
52 string prefix to strip from path (applied after all filters)
53
54 -i [ --ignore-case ]
55 ignore case when matching regular expressions
56
57 -v [ --invert-match ]
58 select defects that do not match the selected criteria
59
60 -n [ --invert-regex ]
61 invert regular expressions in all predicates
62
63 --color
64 use colorized console output (default if connected to a termi‐
65 nal)
66
67 --no-color
68 do not use colorized console output
69
70 -q [ --quiet ]
71 do not report any parsing errors
72
73 --mode arg (=grep)
74 grep, json, evtstat, files, filestat, grouped, stat, or
75 dig_key_events
76
77 --help print the usage of csgrep
78
79 --version
80 print the version of csgrep
81
83 csgrep exits with status 0 if arguments are valid and input files are
84 parsed successfully. It does not matter whether any defects were
85 matched or not.
86
88 Error: FORWARD_NULL (CWE-476):
89 libhsm.c:1168: assign_zero: Assigning: key_handles = NULL.
90 libhsm.c:1210: var_deref_op: Dereferencing null pointer key_handles.
91
92 In the above example, FORWARD_NULL is the checker , assign_zero and
93 var_deref_op are events , where var_deref_op is the key event and
94 "Dereferencing null pointer key_handles." is the message associated
95 with the key event.
96
98 dig_key_events - for each defect, print only the checker and key event
99
100 evtstat - print overall checker/key_event statistics for the matched
101 defects
102
103 files - print only names of error files that contain the matched
104 defects
105
106 filestat - print statistics of matched defects per individual source
107 files
108
109 grep - print matched defects using the same format as expected on the
110 input
111
112 grouped - print matched defects, grouped by error files they originate
113 from
114
115 json - print matched defects in a JSON format
116
117 stat - print overall statistics of the matched defects in given error
118 files
119
120
121
122csgrep 2.1.0 February 2021 CSGREP(1)