changeset 1904:be236878efcf

Add -v variable debug levels for server too -vvvv is equivalent to the old -v
author Matt Johnston <matt@ucc.asn.au>
date Thu, 24 Mar 2022 14:44:13 +0800
parents 9382271da9ef
children 77e5c8f778d3
files debug.h dropbearconvert.c dropbearkey.c fuzz/fuzz-harness.c svr-runopts.c
diffstat 5 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/debug.h	Thu Mar 24 14:18:45 2022 +0800
+++ b/debug.h	Thu Mar 24 14:44:13 2022 +0800
@@ -48,6 +48,8 @@
 /*#define DEBUG_KEXHASH*/
 /*#define DEBUG_RSA*/
 
+/* The level of TRACE() statements */
+#define DROPBEAR_VERBOSE_LEVEL 4
 
 #if DEBUG_TRACE
 extern int debug_trace;
--- a/dropbearconvert.c	Thu Mar 24 14:18:45 2022 +0800
+++ b/dropbearconvert.c	Thu Mar 24 14:44:13 2022 +0800
@@ -69,7 +69,7 @@
 
 #if DEBUG_TRACE
 	/* It's hard for it to get in the way _too_ much */
-	debug_trace = 1;
+	debug_trace = DROPBEAR_VERBOSE_LEVEL;
 #endif
 
 	/* get the commandline options */
--- a/dropbearkey.c	Thu Mar 24 14:18:45 2022 +0800
+++ b/dropbearkey.c	Thu Mar 24 14:44:13 2022 +0800
@@ -195,7 +195,7 @@
 					break;
 #if DEBUG_TRACE
 				case 'v':
-					debug_trace = 1;
+					debug_trace = DROPBEAR_VERBOSE_LEVEL;
 					break;
 #endif
 				default:
--- a/fuzz/fuzz-harness.c	Thu Mar 24 14:18:45 2022 +0800
+++ b/fuzz/fuzz-harness.c	Thu Mar 24 14:44:13 2022 +0800
@@ -12,8 +12,8 @@
     for (i = 1; i < argc; i++) {
 #if DEBUG_TRACE
         if (strcmp(argv[i], "-v") == 0) {
-            debug_trace = 1;
-            TRACE(("debug printing on"))
+            debug_trace++;
+            fprintf(stderr, "debug level -> %d\n", debug_trace);
         }
 #endif
         if (strcmp(argv[i], "-q") == 0) {
--- a/svr-runopts.c	Thu Mar 24 14:18:45 2022 +0800
+++ b/svr-runopts.c	Thu Mar 24 14:44:13 2022 +0800
@@ -109,7 +109,7 @@
 #endif
 					"-V    Version\n"
 #if DEBUG_TRACE
-					"-v		verbose (compiled with DEBUG_TRACE)\n"
+					"-v    verbose (repeat for more verbose)\n"
 #endif
 					,DROPBEAR_VERSION, progname,
 #if DROPBEAR_DSS
@@ -310,7 +310,7 @@
 #endif
 #if DEBUG_TRACE
 				case 'v':
-					debug_trace = 1;
+					debug_trace++;
 					break;
 #endif
 				case 'V':