Commit f839394688825069557d6f7754a48d5c64fc4dfc

Authored by aurel32
1 parent 169dc5d3

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

This patch allows DEBUG_TCGV to be defined (and also prevents NDEBUG
from being defined) when 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.

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7105 c046a42c-6fe2-441c-8c8c-71466251a162
configure
@@ -153,6 +153,7 @@ case &quot;$cpu&quot; in @@ -153,6 +153,7 @@ case &quot;$cpu&quot; in
153 ;; 153 ;;
154 esac 154 esac
155 gprof="no" 155 gprof="no"
  156 +debug_tcg="no"
156 sparse="no" 157 sparse="no"
157 strip_opt="yes" 158 strip_opt="yes"
158 bigendian="no" 159 bigendian="no"
@@ -400,6 +401,10 @@ for opt do @@ -400,6 +401,10 @@ for opt do
400 ;; 401 ;;
401 --audio-drv-list=*) audio_drv_list="$optarg" 402 --audio-drv-list=*) audio_drv_list="$optarg"
402 ;; 403 ;;
  404 + --enable-debug-tcg) debug_tcg="yes"
  405 + ;;
  406 + --disable-debug-tcg) debug_tcg="no"
  407 + ;;
403 --enable-sparse) sparse="yes" 408 --enable-sparse) sparse="yes"
404 ;; 409 ;;
405 --disable-sparse) sparse="no" 410 --disable-sparse) sparse="no"
@@ -568,6 +573,8 @@ echo &quot; --extra-ldflags=LDFLAGS add linker flags LDFLAGS&quot; @@ -568,6 +573,8 @@ echo &quot; --extra-ldflags=LDFLAGS add linker flags LDFLAGS&quot;
568 echo " --make=MAKE use specified make [$make]" 573 echo " --make=MAKE use specified make [$make]"
569 echo " --install=INSTALL use specified install [$install]" 574 echo " --install=INSTALL use specified install [$install]"
570 echo " --static enable static build [$static]" 575 echo " --static enable static build [$static]"
  576 +echo " --enable-debug-tcg enable TCG debugging"
  577 +echo " --disable-debug-tcg disable TCG debugging (default)"
571 echo " --enable-sparse enable sparse checker" 578 echo " --enable-sparse enable sparse checker"
572 echo " --disable-sparse disable sparse checker (default)" 579 echo " --disable-sparse disable sparse checker (default)"
573 echo " --disable-strip disable stripping binaries" 580 echo " --disable-strip disable stripping binaries"
@@ -1368,6 +1375,9 @@ case &quot;$cpu&quot; in @@ -1368,6 +1375,9 @@ case &quot;$cpu&quot; in
1368 exit 1 1375 exit 1
1369 ;; 1376 ;;
1370 esac 1377 esac
  1378 +if test "$debug_tcg" = "yes" ; then
  1379 + echo "#define DEBUG_TCG 1" >> $config_h
  1380 +fi
1371 if test "$sparse" = "yes" ; then 1381 if test "$sparse" = "yes" ; then
1372 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak 1382 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1373 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak 1383 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
tcg/tcg.c
@@ -22,9 +22,6 @@ @@ -22,9 +22,6 @@
22 * THE SOFTWARE. 22 * THE SOFTWARE.
23 */ 23 */
24 24
25 -/* define it to suppress various consistency checks (faster) */  
26 -#define NDEBUG  
27 -  
28 /* define it to use liveness analysis (better code) */ 25 /* define it to use liveness analysis (better code) */
29 #define USE_LIVENESS_ANALYSIS 26 #define USE_LIVENESS_ANALYSIS
30 27
@@ -45,6 +42,11 @@ @@ -45,6 +42,11 @@
45 #include "qemu-common.h" 42 #include "qemu-common.h"
46 #include "cache-utils.h" 43 #include "cache-utils.h"
47 44
  45 +#ifndef DEBUG_TCG
  46 +/* define it to suppress various consistency checks (faster) */
  47 +#define NDEBUG
  48 +#endif
  49 +
48 /* Note: the long term plan is to reduce the dependancies on the QEMU 50 /* Note: the long term plan is to reduce the dependancies on the QEMU
49 CPU definitions. Currently they are used for qemu_ld/st 51 CPU definitions. Currently they are used for qemu_ld/st
50 instructions */ 52 instructions */
tcg/tcg.h
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE. 22 * THE SOFTWARE.
23 */ 23 */
  24 +#include "qemu-common.h"
24 #include "tcg-target.h" 25 #include "tcg-target.h"
25 26
26 #if TCG_TARGET_REG_BITS == 32 27 #if TCG_TARGET_REG_BITS == 32
@@ -120,7 +121,9 @@ typedef tcg_target_ulong TCGArg; @@ -120,7 +121,9 @@ typedef tcg_target_ulong TCGArg;
120 are aliases for target_ulong and host pointer sized values respectively. 121 are aliases for target_ulong and host pointer sized values respectively.
121 */ 122 */
122 123
123 -//#define DEBUG_TCGV 1 124 +#ifdef DEBUG_TCG
  125 +#define DEBUG_TCGV 1
  126 +#endif
124 127
125 #ifdef DEBUG_TCGV 128 #ifdef DEBUG_TCGV
126 129