translate-all: define and use DEBUG_TB_FLUSH_GATE

This gets rid of some ifdef checks while ensuring that the debug code
is compiled, which prevents bit rot.

Backports commit 424079c13b692cfcd08866bc9ffec77b887fed4e from qemu
This commit is contained in:
Emilio G. Cota 2018-03-05 02:48:14 -05:00 committed by Lioncash
parent b4a7d8b773
commit 79f53cf97b
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -66,6 +66,12 @@
/* make various TB consistency checks */
/* #define DEBUG_TB_CHECK */
#ifdef DEBUG_TB_FLUSH
#define DEBUG_TB_FLUSH_GATE 1
#else
#define DEBUG_TB_FLUSH_GATE 0
#endif
#if !defined(CONFIG_USER_ONLY)
/* TB consistency checks only implemented for usermode emulation. */
#undef DEBUG_TB_CHECK
@ -935,13 +941,13 @@ void tb_flush(CPUState *cpu)
struct uc_struct* uc = cpu->uc;
TCGContext *tcg_ctx = uc->tcg_ctx;
#if defined(DEBUG_TB_FLUSH)
printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n",
(unsigned long)(tcg_ctx->code_gen_ptr - tcg_ctx->code_gen_buffer),
tcg_ctx->tb_ctx.nb_tbs, tcg_ctx->tb_ctx.nb_tbs > 0 ?
((unsigned long)(tcg_ctx->code_gen_ptr - tcg_ctx->code_gen_buffer)) /
tcg_ctx->tb_ctx.nb_tbs : 0);
#endif
if (DEBUG_TB_FLUSH_GATE) {
printf("qemu: flush code_size=%td nb_tbs=%d avg_tb_size=%td\n",
tcg_ctx->code_gen_ptr - tcg_ctx->code_gen_buffer,
tcg_ctx->tb_ctx.nb_tbs, tcg_ctx->tb_ctx.nb_tbs > 0 ?
(tcg_ctx->code_gen_ptr - tcg_ctx->code_gen_buffer) /
tcg_ctx->tb_ctx.nb_tbs : 0);
}
if ((unsigned long)((char*)tcg_ctx->code_gen_ptr - (char*)tcg_ctx->code_gen_buffer)
> tcg_ctx->code_gen_buffer_size) {
cpu_abort(cpu, "Internal error: code buffer overflow\n");