Changeset 4009
- Timestamp:
- Nov 23, 2009, 1:26:53 AM (11 years ago)
- Location:
- zzuf/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
zzuf/trunk/doc/libzzuf.3
r4006 r4009 1 .TH libzzuf 3 "200 8-06-10" "libzzuf"1 .TH libzzuf 3 "2009-11-22" "libzzuf" 2 2 .SH NAME 3 3 libzzuf \- helper library for the zzuf multiple purpose fuzzer … … 21 21 .TP 22 22 \fBZZUF_DEBUG\fR 23 This environment variable is set to the debugging level. 0 means no debugging 24 information is sent to \fBzzuf\fR. 1 logs important information as well as 25 all diverted functions. 2 logs fuzzing status and all optional file stream 26 information. 27 .TP 28 \fBZZUF_DEBUGFD\fR 23 29 This environment variable is set to a file descriptor where \fBlibzzuf\fR will 24 30 send debugging information. This is used to send data to the main \fBzzuf\fR -
zzuf/trunk/doc/zzuf.1
r4006 r4009 1 .TH zzuf 1 "200 6-12-22" "zzuf"1 .TH zzuf 1 "2009-11-22" "zzuf" 2 2 .SH NAME 3 3 zzuf \- multiple purpose fuzzer … … 93 93 .TP 94 94 \fB\-d\fR, \fB\-\-debug\fR 95 Activate the display of debug messages. 95 Activate the display of debug messages. Can be specified multiple times for 96 increased verbosity. 96 97 .TP 97 98 \fB\-D\fR, \fB\-\-delay\fR=\fIdelay\fR -
zzuf/trunk/src/debug.c
r2336 r4009 1 1 /* 2 2 * zzuf - general purpose fuzzer 3 * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>3 * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> 4 4 * All Rights Reserved 5 5 * … … 37 37 #include "libzzuf.h" 38 38 39 extern int _zz_debugfd;39 static void mydebug(char const *format, va_list args); 40 40 41 41 /** … … 57 57 } while(0) 58 58 59 void _zz_debug(char const *format, ...) 60 { 61 va_list args; 62 va_start(args, format); 63 if (_zz_debuglevel >= 1) 64 mydebug(format, args); 65 va_end(args); 66 } 67 68 void _zz_debug2(char const *format, ...) 69 { 70 va_list args; 71 va_start(args, format); 72 if (_zz_debuglevel >= 2) 73 mydebug(format, args); 74 va_end(args); 75 } 76 59 77 /** 60 78 * Format a string, printf-like, and write the resulting data to zzuf's … … 68 86 * - fprintf(stderr, "\n"); 69 87 */ 70 void _zz_debug(char const *format, ...)88 static void mydebug(char const *format, va_list args) 71 89 { 72 90 static char const *hex2char = "0123456789abcdef"; 73 91 char const *f; 74 va_list args;75 92 int saved_errno; 76 93 … … 79 96 80 97 saved_errno = errno; 81 va_start(args, format);82 98 83 99 write(_zz_debugfd, "** zzuf debug ** ", 17); … … 187 203 } 188 204 write(_zz_debugfd, "\n", 1); 189 va_end(args);190 205 errno = saved_errno; 191 206 } -
zzuf/trunk/src/debug.h
r2577 r4009 1 1 /* 2 2 * zzuf - general purpose fuzzer 3 * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>3 * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> 4 4 * All Rights Reserved 5 5 * … … 18 18 19 19 extern void _zz_debug(const char *format, ...) ATTRIBUTE_PRINTF(1,2); 20 extern void _zz_debug2(const char *format, ...) ATTRIBUTE_PRINTF(1,2); 20 21 21 22 #ifdef LIBZZUF 22 23 # define debug _zz_debug 24 # define debug2 _zz_debug2 23 25 #else 24 # define debug(...) 26 # define debug(...) do {} while(0) 27 # define debug2(...) do {} while(0) 25 28 #endif 26 29 -
zzuf/trunk/src/fd.c
r3635 r4009 224 224 return; 225 225 226 #if 0227 226 if(autoinc) 228 debug("using seed %li", (long int)seed); 229 #endif 227 debug2("using seed %li", (long int)seed); 230 228 231 229 /* If filedescriptor is outside our bounds */ … … 378 376 return; 379 377 378 debug2("setfuzzed(%i, %i)", fd, count); 379 380 380 files[fds[fd]].already_pos = files[fds[fd]].pos; 381 381 files[fds[fd]].already_fuzzed = count; -
zzuf/trunk/src/fuzz.c
r2575 r4009 1 1 /* 2 2 * zzuf - general purpose fuzzer 3 * Copyright (c) 2006-200 7 Sam Hocevar <sam@zoy.org>3 * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> 4 4 * All Rights Reserved 5 5 * … … 92 92 int todo; 93 93 94 debug ("fuzz(%i, @%lli, %lli)", fd, (long long int)pos, (long long int)len);94 debug2("fuzz(%i, @%lli, %lli)", fd, (long long int)pos, (long long int)len); 95 95 96 96 aligned_buf = buf - pos; -
zzuf/trunk/src/libzzuf.c
r3635 r4009 65 65 * Is libzzuf fully initialised? 66 66 */ 67 int _zz_ready = 0; 67 int _zz_ready = 0; 68 69 /** 70 * The debugging level that libzzuf should use. 0 means no debugging, 71 * 1 means minimal debugging, 2 means verbose debugging. Its value is set 72 * by the ZZUF_DEBUG environment variable. 73 */ 74 int _zz_debuglevel = 0; 68 75 69 76 /** 70 77 * The file descriptor used by libzzuf for communication with the main 71 * zzuf program in debug mode. Its value is set by the ZZUF_DEBUG 78 * zzuf program in debug mode. Its value is set by the ZZUF_DEBUGFD 72 79 * environment variable. 73 80 */ 74 int _zz_debugfd= -1;81 int _zz_debugfd = -1; 75 82 76 83 /** … … 80 87 * instance. Its value is set by the ZZUF_SIGNAL environment variable. 81 88 */ 82 int _zz_signal= 0;89 int _zz_signal = 0; 83 90 84 91 /** … … 88 95 * variable. 89 96 */ 90 int _zz_memory= 0;97 int _zz_memory = 0; 91 98 92 99 /** … … 95 102 * variable. 96 103 */ 97 int _zz_network= 0;104 int _zz_network = 0; 98 105 99 106 /** … … 111 118 112 119 tmp = getenv("ZZUF_DEBUG"); 120 if(tmp) 121 _zz_debuglevel = atoi(tmp); 122 123 tmp = getenv("ZZUF_DEBUGFD"); 113 124 if(tmp) 114 125 _zz_debugfd = atoi(tmp); -
zzuf/trunk/src/libzzuf.h
r2521 r4009 1 1 /* 2 2 * zzuf - general purpose fuzzer 3 * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>3 * Copyright (c) 2006-2009 Sam Hocevar <sam@hocevar.net> 4 4 * All Rights Reserved 5 5 * … … 51 51 extern int _zz_ready; 52 52 extern int _zz_disabled; 53 extern int _zz_debuglevel; 53 54 extern int _zz_debugfd; 54 55 extern int _zz_signal; -
zzuf/trunk/src/zzuf.c
r3637 r4009 158 158 int cmdline = 0; 159 159 #endif 160 int network = 0;160 int debug = 0, network = 0; 161 161 int i; 162 162 … … 260 260 break; 261 261 case 'd': /* --debug */ 262 setenv("ZZUF_DEBUG", DEBUG_FILENO_STR, 1);262 debug++; 263 263 break; 264 264 case 'D': /* --delay */ … … 467 467 setenv("ZZUF_EXCLUDE", exclude, 1); 468 468 #endif 469 470 setenv("ZZUF_DEBUG", debug ? debug > 1 ? "2" : "1" : "0", 1); 471 setenv("ZZUF_DEBUGFD", DEBUG_FILENO_STR, 1); 469 472 470 473 if(opts->fuzzing)
Note: See TracChangeset
for help on using the changeset viewer.