File indexing completed on 2025-01-18 10:13:31
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef __PUB_TOOL_OPTIONS_H
0030 #define __PUB_TOOL_OPTIONS_H
0031
0032 #include "pub_tool_basics.h" // for VG_ macro
0033 #include "libvex.h" // for VexControl
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 typedef
0046 enum {
0047 cloE = 1,
0048 cloP = 2,
0049 cloD = 4,
0050 cloH = 8
0051 } Clo_Mode;
0052
0053
0054 #define cloEP (cloE | cloP)
0055 #define cloED (cloE | cloD)
0056 #define cloPD (cloP | cloD)
0057
0058
0059
0060 void VG_(set_Clo_Mode) (Clo_Mode mode);
0061
0062 Clo_Mode VG_(Clo_Mode) (void);
0063
0064
0065
0066 void VG_(set_Clo_Recognised) (void);
0067 Bool VG_(Clo_Recognised) (void);
0068
0069
0070
0071
0072 void VG_(process_dynamic_option) (Clo_Mode mode, HChar *value);
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083 Bool VG_(check_clom) (Clo_Mode modes, const HChar* arg, const HChar* option,
0084 Bool recognised);
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105 extern void VG_(list_clo)(const HChar *qq_option);
0106
0107
0108
0109 #define VG_STREQN_CLOM(qq_mode, qq_len, qq_arg, qq_option) \
0110 (VG_(check_clom) \
0111 (qq_mode, qq_arg, qq_option, \
0112 VG_STREQN(qq_len, qq_arg, qq_option)))
0113
0114
0115
0116 #define VG_STREQ_CLOM(qq_mode, qq_arg, qq_option) \
0117 (VG_(check_clom) \
0118 (qq_mode, qq_arg, qq_option, \
0119 VG_STREQ(qq_arg, qq_option)))
0120
0121
0122 #define VG_BOOL_CLOM(qq_mode, qq_arg, qq_option, qq_var) \
0123 (VG_(check_clom) \
0124 (qq_mode, qq_arg, qq_option, \
0125 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0126 ({Bool res = True; \
0127 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0128 if VG_STREQ(val, "yes") (qq_var) = True; \
0129 else if VG_STREQ(val, "no") (qq_var) = False; \
0130 else {VG_(fmsg_bad_option)(qq_arg, "Invalid boolean value '%s'" \
0131 " (should be 'yes' or 'no')\n", \
0132 \
0133 \
0134 (val ? val : "(null)")); \
0135 res = False; } \
0136 res; }))
0137
0138 #define VG_BOOL_CLO(qq_arg, qq_option, qq_var) \
0139 VG_BOOL_CLOM(cloP, qq_arg, qq_option, qq_var)
0140
0141
0142 #define VG_STR_CLOM(qq_mode, qq_arg, qq_option, qq_var) \
0143 (VG_(check_clom) \
0144 (qq_mode, qq_arg, qq_option, \
0145 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0146 ({const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0147 (qq_var) = val; \
0148 True; }))
0149
0150 #define VG_STR_CLO(qq_arg, qq_option, qq_var) \
0151 VG_STR_CLOM(cloP, qq_arg, qq_option, qq_var)
0152
0153
0154
0155 #define VG_USETGEN_CLOM(qq_mode, qq_arg, qq_option, qq_vals, qq_var, qq_all) \
0156 (VG_(check_clom) \
0157 (qq_mode, qq_arg, qq_option, \
0158 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0159 ({Bool res = True; \
0160 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0161 if (!VG_(parse_enum_set)(qq_vals, \
0162 qq_all, \
0163 val, \
0164 &(qq_var))) { \
0165 VG_(fmsg_bad_option)(qq_arg, "%s is an invalid %s set\n", \
0166 val, &qq_option[2]); \
0167 res = False; } \
0168 res; }))
0169
0170
0171 #define VG_USET_CLO(qq_arg, qq_option, qq_vals, qq_var) \
0172 VG_USETGEN_CLOM(cloP, (qq_arg), qq_option, (qq_vals), (qq_var), True)
0173 #define VG_USET_CLOM(qq_mode, qq_arg, qq_option, qq_vals, qq_var) \
0174 VG_USETGEN_CLOM(qq_mode, (qq_arg), qq_option, (qq_vals), (qq_var), True)
0175
0176
0177
0178 #define VG_USETX_CLO(qq_arg, qq_option, qq_vals, qq_var) \
0179 VG_USETGEN_CLOM(cloP, (qq_arg), qq_option, (qq_vals), (qq_var), False)
0180 #define VG_USETX_CLOM(qq_mode, qq_arg, qq_option, qq_vals, qq_var) \
0181 VG_USETGEN_CLOM(qq_mode, (qq_arg), qq_option, (qq_vals), (qq_var), False)
0182
0183
0184 #define VG_INT_CLOM(qq_mode, qq_arg, qq_option, qq_var) \
0185 (VG_(check_clom) \
0186 (qq_mode, qq_arg, qq_option, \
0187 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0188 ({Bool res = True; \
0189 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0190 HChar* s; \
0191 Long n = VG_(strtoll10)( val, &s ); \
0192 (qq_var) = n; \
0193 \
0194 if ('\0' != s[0] || (qq_var) != n) { \
0195 VG_(fmsg_bad_option)(qq_arg, \
0196 "Invalid integer value '%s'\n", val); \
0197 res = False; } \
0198 res; }))
0199
0200 #define VG_INT_CLO(qq_arg, qq_option, qq_var) \
0201 VG_INT_CLOM(cloP, qq_arg, qq_option, qq_var)
0202
0203
0204
0205 #define VG_BINTN_CLOM(qq_mode, qq_base, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
0206 (VG_(check_clom) \
0207 (qq_mode, qq_arg, qq_option, \
0208 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0209 ({Bool res = True; \
0210 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0211 HChar* s; \
0212 Long n = VG_(strtoll##qq_base)( val, &s ); \
0213 (qq_var) = n; \
0214 \
0215 \
0216 \
0217 \
0218 if ('\0' != s[0] || (qq_var) != n) { \
0219 VG_(fmsg_bad_option)(qq_arg, \
0220 "Invalid integer value '%s'\n", val); \
0221 res = False; } \
0222 \
0223 if ((qq_var) < (qq_lo) || (qq_var) > (qq_hi)) { \
0224 VG_(fmsg_bad_option)(qq_arg, \
0225 "'%s' argument must be between %lld and %lld\n", \
0226 (qq_option), (Long)(qq_lo), (Long)(qq_hi)); \
0227 res = False; \
0228 } \
0229 res;}))
0230
0231
0232 #define VG_BINT_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
0233 VG_BINTN_CLOM(cloP, 10, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
0234 #define VG_BINT_CLOM(qq_mode, qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
0235 VG_BINTN_CLOM(qq_mode, 10, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
0236
0237
0238 #define VG_BHEX_CLO(qq_arg, qq_option, qq_var, qq_lo, qq_hi) \
0239 VG_BINTN_CLOM(cloP, 16, (qq_arg), qq_option, (qq_var), (qq_lo), (qq_hi))
0240
0241
0242
0243
0244 #define VG_DBL_CLOM(qq_mode, qq_arg, qq_option, qq_var) \
0245 (VG_(check_clom) \
0246 (qq_mode, qq_arg, qq_option, \
0247 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0248 ({Bool res = True; \
0249 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0250 HChar* s; \
0251 double n = VG_(strtod)( val, &s ); \
0252 (qq_var) = n; \
0253 \
0254 if ('\0' != s[0]) { \
0255 VG_(fmsg_bad_option)(qq_arg, \
0256 "Invalid floating point value '%s'\n",val); \
0257 res = False; } \
0258 res;}))
0259
0260 #define VG_DBL_CLO( qq_arg, qq_option, qq_var) \
0261 VG_DBL_CLOM(cloP, qq_arg, qq_option, qq_var)
0262
0263
0264
0265 #define VG_XACT_CLOM(qq_mode, qq_arg, qq_option, qq_var, qq_val) \
0266 (VG_(check_clom) \
0267 (qq_mode, qq_arg, qq_option, \
0268 VG_STREQ((qq_arg), (qq_option))) && \
0269 ({(qq_var) = (qq_val); \
0270 True; }))
0271
0272 #define VG_XACT_CLO(qq_arg, qq_option, qq_var, qq_val) \
0273 VG_XACT_CLOM(cloP, qq_arg, qq_option, qq_var, qq_val)
0274
0275
0276
0277
0278 #define VG_STRINDEX_CLOM(qq_mode, qq_arg, qq_option, qq_strings, qq_ix) \
0279 (VG_(check_clom) \
0280 (qq_mode, qq_arg, qq_option, \
0281 VG_STREQN(VG_(strlen)(qq_option)+1, qq_arg, qq_option"=")) && \
0282 ({Bool res = True; \
0283 const HChar* val = &(qq_arg)[ VG_(strlen)(qq_option)+1 ]; \
0284 for (qq_ix = 0; (qq_strings)[qq_ix]; qq_ix++) { \
0285 if (VG_STREQ(val, (qq_strings)[qq_ix])) \
0286 break; \
0287 } \
0288 if ((qq_strings)[qq_ix] == NULL) { \
0289 VG_(fmsg_bad_option)(qq_arg, \
0290 "Invalid string '%s' in '%s'\n", val, qq_arg); \
0291 res = False; \
0292 } \
0293 res; }))
0294
0295 #define VG_STRINDEX_CLO(qq_arg, qq_option, qq_strings, qq_ix) \
0296 VG_STRINDEX_CLOM(cloP, qq_arg, qq_option, qq_strings, qq_ix)
0297
0298
0299 extern Int VG_(clo_verbosity);
0300
0301
0302 extern Bool VG_(clo_stats);
0303
0304
0305
0306 extern Int VG_(clo_vgdb_error);
0307
0308
0309
0310
0311
0312
0313
0314 extern const HChar *VG_(arg_vgdb_prefix);
0315
0316
0317
0318
0319 extern Bool VG_(clo_xml);
0320
0321
0322
0323 extern const HChar* VG_(clo_xml_user_comment);
0324
0325
0326
0327 extern VexControl VG_(clo_vex_control);
0328 extern VexRegisterUpdates VG_(clo_px_file_backed);
0329
0330 extern Int VG_(clo_redzone_size);
0331
0332 typedef
0333 enum {
0334 Vg_XTMemory_None,
0335 Vg_XTMemory_Allocs,
0336 Vg_XTMemory_Full,
0337
0338 }
0339 VgXTMemory;
0340
0341
0342
0343 extern VgXTMemory VG_(clo_xtree_memory);
0344
0345
0346 extern const HChar* VG_(clo_xtree_memory_file);
0347
0348 extern Bool VG_(clo_xtree_compress_strings);
0349
0350
0351 extern Int VG_(clo_backtrace_size);
0352
0353
0354 extern Bool VG_(clo_show_below_main);
0355
0356
0357
0358
0359
0360 extern Bool VG_(clo_keep_debuginfo);
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381 extern HChar* VG_(expand_file_name)(const HChar* option_name,
0382 const HChar* format);
0383
0384 #endif
0385
0386
0387
0388