]> mj.ucw.cz Git - libucw.git/commitdiff
Config: Split CONFIG_UCW_DEBUG off CONFIG_DEBUG
authorMartin Mares <mj@ucw.cz>
Sat, 11 Feb 2012 18:48:53 +0000 (19:48 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 11 Feb 2012 18:48:53 +0000 (19:48 +0100)
CONFIG_DEBUG controls the build system,
CONFIG_UCW_DEBUG gets embedded in the library.

Turning CONFIG_DEBUG in programs using LibUCW can influence
ASSERTs and other debugging constructs in the headers, but
not presence of debugging code in the library.

ucw/bigalloc.c
ucw/conf-input.c
ucw/getopt.h
ucw/mainloop.c
ucw/mainloop.h
ucw/perl/UCW/Configure/LibUCW.pm

index 3133170e5f6921dd86e5aaa893a0b3769c411a64..852d8e42cd1fe2be17dcf1f70cb9d085cc3c53e9 100644 (file)
@@ -65,11 +65,11 @@ big_alloc(u64 len)
   u64 l = big_round(len);
   if (l > SIZE_MAX - 2*CPU_PAGE_SIZE)
     die("big_alloc: Size %llu is too large for the current architecture", (long long) len);
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
   l += 2*CPU_PAGE_SIZE;
 #endif
   byte *p = page_alloc(l);
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
   *(u64*)p = len;
   mprotect(p, CPU_PAGE_SIZE, PROT_NONE);
   mprotect(p+l-CPU_PAGE_SIZE, CPU_PAGE_SIZE, PROT_NONE);
@@ -91,7 +91,7 @@ big_free(void *start, u64 len)
 {
   byte *p = start;
   u64 l = big_round(len);
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
   p -= CPU_PAGE_SIZE;
   mprotect(p, CPU_PAGE_SIZE, PROT_READ);
   ASSERT(*(u64*)p == len);
index ad8bfc8e26c1c440b6c2a1800cd44f5ebf7cf185..568aba2ece1b6ae2b4d0c0e4c5dd4c38b5ae7c44 100644 (file)
@@ -487,7 +487,7 @@ cf_getopt(int argc, char * const argv[], const char *short_opts, const struct op
        if (cf_load(optarg))
          die("Cannot load config file %s", optarg);
       }
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
       else {   /* --dumpconfig */
        load_default();
        final_commit();
index a192c0f725584960c6d662bd8691e98f17749ceb..43866fc484fb0abfcdb741013d10cd76ea4bd10e 100644 (file)
@@ -167,7 +167,7 @@ void cf_journal_rollback_transaction(uns new_pool, struct cf_journal_item *oldj)
 "-C, --config filename\t" CF_USAGE_TAB "Override the default configuration file\n\
 -S, --set sec.item=val\t" CF_USAGE_TAB "Manual setting of a configuration item\n" CF_USAGE_DEBUG
 
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
 #define CF_LONG_OPTS_DEBUG { "dumpconfig", 0, 0, 0x64436667 } ,
 #define CF_USAGE_DEBUG "    --dumpconfig\t" CF_USAGE_TAB "Dump program configuration\n"
 #else
index 3c9dc623b4a4916648655ba2f6e17c8d23d98ceb..e81e26eb4b4a0a03d6e4e13a3549ff0c4451a4fd 100644 (file)
@@ -598,7 +598,7 @@ signal_del(struct main_signal *ms)
   signal_del_ctx(main_current(), ms);
 }
 
-#ifdef CONFIG_DEBUG
+#ifdef CONFIG_UCW_DEBUG
 
 void
 file_debug(struct main_file *fi)
index 336439beed7ed0cc881d628d581dd34c51e9f601..60a97f2141a78fe051c5039b7c725ad4523e4f82 100644 (file)
@@ -112,7 +112,7 @@ static inline void main_shut_down(void)
 
 /**
  * Show the current state of a given context (use @main_debug() for the current context).
- * Available only if LibUCW has been compiled with `CONFIG_DEBUG`.
+ * Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`.
  **/
 void main_debug_context(struct main_context *m);
 
@@ -197,7 +197,7 @@ static inline int timer_is_active(struct main_timer *tm)
  **/
 void main_get_time(void);
 
-/** Show current state of a timer. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a timer. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
 void timer_debug(struct main_timer *tm);
 
 /***
@@ -266,7 +266,7 @@ static inline int hook_is_active(struct main_hook *ho)
   return clist_is_linked(&ho->n);
 }
 
-/** Show current state of a hook. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a hook. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
 void hook_debug(struct main_hook *ho);
 
 
@@ -353,7 +353,7 @@ static inline int file_is_active(struct main_file *fi)
   return clist_is_linked(&fi->n);
 }
 
-/** Show current state of a file. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a file. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
 void file_debug(struct main_file *fi);
 
 /***
@@ -638,7 +638,7 @@ static inline int process_is_active(struct main_process *mp)
   return clist_is_linked(&mp->n);
 }
 
-/** Show current state of a process. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a process. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
 void process_debug(struct main_process *pr);
 
 /***
@@ -687,7 +687,7 @@ static inline int signal_is_active(struct main_signal *ms)
   return clist_is_linked(&ms->n);
 }
 
-/** Show current state of a signal catcher. Available only if LibUCW has been compiled with `CONFIG_DEBUG`. **/
+/** Show current state of a signal catcher. Available only if LibUCW has been compiled with `CONFIG_UCW_DEBUG`. **/
 void signal_debug(struct main_signal *sg);
 
 #endif
index a35ca87b5904fa0f5c1181161ef3387032d0d5db..853f02c39965c163d67deb615161ebc3009146ef 100644 (file)
@@ -9,6 +9,11 @@ use UCW::Configure;
 use strict;
 use warnings;
 
+# Turn on debugging support if CONFIG_DEBUG
+if (Get("CONFIG_DEBUG")) {
+       Set("CONFIG_UCW_DEBUG");
+}
+
 # Determine page size
 Test("CPU_PAGE_SIZE", "Determining page size", sub {
        my $p;