Predator  [unstable] git snapshot
config.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2012 Kamil Dudka <kdudka@redhat.com>
3  *
4  * This file is part of predator.
5  *
6  * predator is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * any later version.
10  *
11  * predator is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with predator. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * @file config.h
22  * various compile-time options
23  */
24 
25 #ifndef H_GUARD_CONFIG_H
26 #define H_GUARD_CONFIG_H
27 
28 #define GIT_SHA1 sl_git_sha1
29 #include "trap.h"
30 
31 /**
32  * if 1, print block scheduler statistics whenever end of a fnc is not reached
33  */
34 #define DEBUG_SE_END_NOT_REACHED 0
35 
36 /**
37  * bit mask of fixed-point debugging flags, zero means no debugging
38  * - 0x1 ... print the counts of heaps per each unit
39  * - 0x2 ... dump the fixed point as a set of plots per each unit
40  * - 0x4 ... use a single instruction as the unit (basic block otherwise)
41  */
42 #define DEBUG_SE_FIXED_POINT 0
43 
44 /**
45  * - 0 ... do not debug branching by non-deterministic conditions
46  * - 1 ... plot heap graphs of branching by non-deterministic abstract values
47  * - 2 ... plot heap graphs of branching by any non-deterministic conditions
48  */
49 #define DEBUG_SE_NONDET_COND 0
50 
51 /**
52  * if 1, print created/destroyed variables when running in verbose mode
53  */
54 #define DEBUG_SE_STACK_FRAME 0
55 
56 /**
57  * if 1, plot each abstraction/concretization step to a separate heap graph
58  */
59 #define DEBUG_SYMABSTRACT 0
60 
61 /**
62  * if 1, plot some interesting operations as being performed by symcall
63  */
64 #define DEBUG_SYMCALL 0
65 
66 /**
67  * if 1, the symcut module prints some extra debugging info
68  */
69 #define DEBUG_SYMCUT 0
70 
71 /**
72  * if 1, plot shape of the data structures being leaked
73  */
74 #define DEBUG_SYMGC 0
75 
76 /**
77  * if 1, symjoin prints some extra debugging info
78  */
79 #define DEBUG_SYMJOIN 0
80 
81 /**
82  * if 1, SymState plots heap graphs per each heap comparison (expensive)
83  */
84 #define DEBUG_SYMSTATE 0
85 
86 /**
87  * if 1, perform abstraction after each just completed call on @b caller's side
88  */
89 #define SE_ABSTRACT_ON_CALL_DONE 1
90 
91 /**
92  * if 1, do not perform abstraction on each end of BB, but only when looping
93  */
94 #define SE_ABSTRACT_ON_LOOP_EDGES_ONLY 1
95 
96 /**
97  * if 1, allow to replace already referenced trace graph nodes (creates cycles)
98  */
99 #define SE_ALLOW_CYCLIC_TRACE_GRAPH 0
100 
101 /**
102  * bit mask of allowed operations on integral ranges
103  * - 0x1 ... allow to create integral ranges from integral constants if needed
104  * - 0x2 ... allow widening of the upper bound of integral ranges
105  * - 0x4 ... allow widening of the lower bound of integral ranges
106  */
107 #define SE_ALLOW_INT_RANGES 0x6
108 
109 /**
110  * bit mask of allowed operations on values with offset specified by int ranges
111  * - 0x1 ... allow to introduce values with offset specified by integral ranges
112  * - 0x2 ... allow widening of the upper bound of values with offset ranges
113  * - 0x4 ... allow widening of the upper lower of values with offset ranges
114  */
115 #define SE_ALLOW_OFF_RANGES 0x1
116 
117 /*
118  * if non-zero, allow incomplete discovery paths with lower costs to apply
119  */
120 #define SE_ALLOW_SUBPATH_RANKING 0
121 
122 /**
123  * how much do we allow to use three-way join
124  * - 0 ... never ever
125  * - 1 ... only when joining prototypes
126  * - 2 ... also when joining states if the three-way join is considered useful
127  * - 3 ... do not restrict the usage of three-way join at the level of symjoin
128  */
129 #define SE_ALLOW_THREE_WAY_JOIN 2
130 
131 /**
132  * if 1, assume that the contents of static data is initialized on first access
133  */
134 #define SE_ASSUME_FRESH_STATIC_DATA 1
135 
136 /**
137  * - 0 ... use BFS scheduler
138  * - 1 ... use DFS scheduler, keep already scheduled blocks at their position
139  * - 2 ... use DFS scheduler, move already scheduled blocks to front of queue
140  * - 3 ... use load-driven scheduler (picks the one with fewer pending heaps)
141  */
142 #define SE_BLOCK_SCHEDULER_KIND 2
143 
144 /**
145  * call cache miss count that will trigger function removal (0 means disabled)
146  */
147 #define SE_CALL_CACHE_MISS_THR 0x10
148 
149 /**
150  * increase the cost of abstraction path consisting of concrete objects only by
151  */
152 #define SE_COST_OF_SEG_INTRODUCTION 0
153 
154 /**
155  * abstraction length threshold for cost of path equal to 0
156  */
157 #define SE_COST0_LEN_THR 2
158 
159 /**
160  * abstraction length threshold for cost of path equal to 1
161  * @note only values >= SE_COST0_LEN_THR make sense
162  */
163 #define SE_COST1_LEN_THR 2
164 
165 /**
166  * abstraction length threshold for cost of path equal to 2
167  * @note only values >= SE_COST1_LEN_THR make sense
168  */
169 #define SE_COST2_LEN_THR 3
170 
171 /**
172  * if 1, do not use alignment tracking unless we get it for free
173  */
174 #define SE_DISABLE_ALIGNMENT_TRACKING 0
175 
176 /**
177  * if 1, do not use DLS (Doubly-linked List Segment) abstraction
178  */
179 #define SE_DISABLE_DLS 0
180 
181 /**
182  * if 1, do not use SLS (Singly-linked List Segment) abstraction
183  */
184 #define SE_DISABLE_SLS 0
185 
186 /**
187  * if 1, do not use the @b symcut module at all
188  */
189 #define SE_DISABLE_SYMCUT 0
190 
191 /**
192  * - 0 ... do not dump trace graphs unless explicitly asked to do so
193  * - 1 ... dump a single trace graph for all errors/warnings (may be huge)
194  * - 2 ... dump a single trace graph for each error/warning
195  */
196 #define SE_DUMP_TRACE_GRAPHS 0
197 
198 /**
199  * - 0 ... kill local variables only on stack frame destruction
200  * - 1 ... kill local variables as soon as they become dead
201  */
202 #define SE_EARLY_VARS_DESTRUCTION 1
203 
204 /**
205  * - 0 ... call cache completely disabled (saves a lot of memory)
206  * - 1 ... call cache enabled, use graph isomorphism for lookup (hungry on mem)
207  * - 2 ... call cache enabled, use join operator for lookup [experimental]
208  */
209 #define SE_ENABLE_CALL_CACHE 1
210 
211 /**
212  * - 0 no error recovery, stop the analysis as soon as an error is detected
213  * - 1 low-cost error recovery (stop analyzing paths with errors already caught)
214  * - 2 full error recovery (keep analyzing until a non-recoverable error occurs)
215  */
216 #define SE_ERROR_RECOVERY_MODE 1
217 
218 /**
219  * if non-zero, do not replace a previously tracked if entailed by a new one
220  */
221 #define SE_FORBID_HEAP_REPLACE 0
222 
223 /**
224  * the highest integral number we can count to (only partial implementation atm)
225  */
226 #define SE_INT_ARITHMETIC_LIMIT 10
227 
228 /**
229  * - -1 ... never join, never check for entailment, always check for isomorphism
230  * - 0 ... join states on each basic block entry
231  * - 1 ... join only when traversing a loop-closing edge, entailment otherwise
232  * - 2 ... join only when traversing a loop-closing edge, isomorphism otherwise
233  * - 3 ... same as 2 but skips the isomorphism check when considered redundant
234  */
235 #define SE_JOIN_ON_LOOP_EDGES_ONLY 3
236 
237 /**
238  * maximal call depth
239  */
240 #define SE_MAX_CALL_DEPTH 0x40
241 
242 /**
243  * if non-zero, plot each state that caused an error to be reported
244  */
245 #define SE_PLOT_ERROR_STATES 0
246 
247 /**
248  * preserve heaps with different DLS minimum lengths up to the specified number
249  */
250 #define SE_PRESERVE_DLS_MINLEN 2
251 
252 /**
253  * upper bound of DLS minimal length (zero means unlimited)
254  */
255 #define SE_RESTRICT_DLS_MINLEN 2
256 
257 /**
258  * upper bound of SLS minimal length (zero means unlimited)
259  */
260 #define SE_RESTRICT_SLS_MINLEN 2
261 
262 /**
263  * - 0 ... do not try to optimize the order of heaps in SymState containers
264  * - 1 ... reorder heaps in SymStateWithJoin based on hit ratio
265  * - 2 ... reorder heaps also in SymHeapUnion based on hit ratio [experimental]
266  */
267 #define SE_STATE_ON_THE_FLY_ORDERING 1
268 
269 /**
270  * - 0 ... keep state info for all basic blocks of a function
271  * - 1 ... keep state info for all basic blocks except trivial basic blocks
272  * - 2 ... keep state info for all basic blocks with more than one ingoing edge
273  * - 3 ... keep state info for all basic blocks that a CFG loop starts with
274  */
275 #define SE_STATE_PRUNING_MODE 1
276 
277 /**
278  * prune non-loop blocks on reaching the count of join misses (0 means disabled)
279  */
280 #define SE_STATE_PRUNING_MISS_THR 0x8
281 
282 /**
283  * prune non-loop blocks on reaching the count of states (0 means disabled)
284  */
285 #define SE_STATE_PRUNING_TOTAL_THR 0x80
286 
287 /**
288  * if 1, the symcut module allows generic minimal lengths to survive a function
289  * call/return. @b Not recommended unless SymCallCache has been rewritten to
290  * use symjoin to maintain cache entries.
291  */
292 #define SE_SYMCUT_PRESERVES_MIN_LENGTHS 1
293 
294 /**
295  * - 0 ... disable tracking non-pointer values
296  * - 1 ... basic tracking of non-pointer values
297  * - 2 ... expensive tracking of pointer values
298  * - 3 ... track also code pointers
299  */
300 #define SE_TRACK_NON_POINTER_VALUES 2
301 
302 /**
303  * if 1, do not make deep copy on copy of SymHeap [experimental]
304  */
305 #define SH_COPY_ON_WRITE 1
306 
307 /**
308  * if 1, do not destroy fields immediately as they become unused
309  */
310 #define SH_DELAYED_FIELDS_DESTRUCTION 1
311 
312 /**
313  * if 1, prevent collisions on entity IDs with descendants heaps
314  */
315 #define SH_PREVENT_AMBIGUOUS_ENT_ID 1
316 
317 /**
318  * if more than zero, jump to debugger as soon as N graph of the same name has
319  * been plotted
320  */
321 #define SYMPLOT_STOP_AFTER_N_STATES 0
322 
323 #if 0
324 #define SYMPLOT_STOP_CONDITION(name) \
325  (!(name).compare("symabstract-0003-DLS-0001-0000"))
326 #endif
327 
328 #endif /* H_GUARD_CONFIG_H */