Skip to contentSkip to conversation

Add a --enable-debug-tcgv option to configure

PATCH Superseded Stuart Brady 2 participants 2 messages Apr 12, 2009 – Apr 13, 2009

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add a --enable-debug-tcgv option to configure

This patch allows DEBUG_TCGV to be defined by passing an option to the configure script. This should help to prevent any accidental changes that enable DEBUG_TCGV in tcg/tcg.h from being committed in future, and may help to encourage testing with DEBUG_TCGV enabled.

(My thinking being that it would often be handy to use two build directories, one for building with DEBUG_TCGV enabled and one for building without DEBUG_TCGV enabled, as this would avoid the need to edit tcg/tcg.h.)

tcg.h +1 -2
Index: tcg/tcg.h
===================================================================
@@ -21,6 +21,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#include "qemu-common.h"
 #include "tcg-target.h"
 
 #if TCG_TARGET_REG_BITS == 32
@@ -120,8 +121,6 @@
    are aliases for target_ulong and host pointer sized values respectively.
  */
 
-//#define DEBUG_TCGV 1
-
 #ifdef DEBUG_TCGV
 
 typedef struct
configure +10 -0
Index: configure
===================================================================
@@ -153,6 +153,7 @@
   ;;
 esac
 gprof="no"
+debug_tcgv="no"
 sparse="no"
 strip_opt="yes"
 bigendian="no"
@@ -394,6 +395,10 @@
   ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
   ;;
+  --enable-debug-tcgv) debug_tcgv="yes"
+  ;;
+  --disable-debug-tcgv) debug_tcgv="no"
+  ;;
   --enable-sparse) sparse="yes"
   ;;
   --disable-sparse) sparse="no"
@@ -562,6 +567,8 @@
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"
 echo "  --static                 enable static build [$static]"
+echo "  --enable-debug-tcgv      enable TCGv debugging"
+echo "  --disable-debug-tcgv     disable TCGv debugging (default)"
 echo "  --enable-sparse          enable sparse checker"
 echo "  --disable-sparse         disable sparse checker (default)"
 echo "  --disable-strip          disable stripping binaries"
@@ -1359,6 +1366,9 @@
     exit 1
   ;;
 esac
+if test "$debug_tcgv" = "yes" ; then
+  echo "#define DEBUG_TCGV 1" >> $config_h
+fi
 if test "$sparse" = "yes" ; then
   echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
   echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
Signature · 1 line
Stuart Brady
#1 lore raw
Quoted 11 lines · Stuart Brady

This patch allows DEBUG_TCGV to be defined by passing an option to the configure script. This should help to prevent any accidental changes that enable DEBUG_TCGV in tcg/tcg.h from being committed in future, and may help to encourage testing with DEBUG_TCGV enabled.

(My thinking being that it would often be handy to use two build directories, one for building with DEBUG_TCGV enabled and one for building without DEBUG_TCGV enabled, as this would avoid the need to edit tcg/tcg.h.)

Looks like a good idea, but it would also be nice that when --enable-debug-tcgv is used, NDEBUG is not defined in tcg/tcg.c, as it disables a few useful assert when debugging. I guess this option should then be renamed to --enable-debug-tcg.

Quoted 68 lines

Index: tcg/tcg.h
===================================================================

tcg.h +1 -2
@@ -21,6 +21,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#include "qemu-common.h"
 #include "tcg-target.h"
 
 #if TCG_TARGET_REG_BITS == 32
@@ -120,8 +121,6 @@
    are aliases for target_ulong and host pointer sized values respectively.
  */
 
-//#define DEBUG_TCGV 1
-
 #ifdef DEBUG_TCGV
 
 typedef struct

Index: configure
===================================================================

configure +10 -0
@@ -153,6 +153,7 @@
   ;;
 esac
 gprof="no"
+debug_tcgv="no"
 sparse="no"
 strip_opt="yes"
 bigendian="no"
@@ -394,6 +395,10 @@
   ;;
   --audio-drv-list=*) audio_drv_list="$optarg"
   ;;
+  --enable-debug-tcgv) debug_tcgv="yes"
+  ;;
+  --disable-debug-tcgv) debug_tcgv="no"
+  ;;
   --enable-sparse) sparse="yes"
   ;;
   --disable-sparse) sparse="no"
@@ -562,6 +567,8 @@
 echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"
 echo "  --static                 enable static build [$static]"
+echo "  --enable-debug-tcgv      enable TCGv debugging"
+echo "  --disable-debug-tcgv     disable TCGv debugging (default)"
 echo "  --enable-sparse          enable sparse checker"
 echo "  --disable-sparse         disable sparse checker (default)"
 echo "  --disable-strip          disable stripping binaries"
@@ -1359,6 +1366,9 @@
     exit 1
   ;;
 esac
+if test "$debug_tcgv" = "yes" ; then
+  echo "#define DEBUG_TCGV 1" >> $config_h
+fi
 if test "$sparse" = "yes" ; then
   echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
   echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
Signature · 1 line
Stuart Brady
Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net