accel/tcg: Align data dumped at end of TB
PATCH 1/1 accel/tcg: Align data dumped at end of TB
To better visualize the data dumped at the end of a TB, left-align it (padding it with 0).
--- accel/tcg/translate-all.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
accel/tcg/translate-all.c +3 -2
@@ -2042,8 +2042,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu,int i;qemu_log (" data: [size=%d]\n" , data_size);for (i =0 ; i < data_size /sizeof (tcg_target_ulong); i++) { -qemu_log ("0x%08" PRIxPTR": .quad 0x%" TCG_PRIlx"\n" , - (uintptr_t )&rx_data_gen_ptr[i], rx_data_gen_ptr[i]); +qemu_log ("0x%08" PRIxPTR": .quad 0x%0*" TCG_PRIlx"\n" , + (uintptr_t )&rx_data_gen_ptr[i], +2 *sizeof (tcg_target_ulong), rx_data_gen_ptr[i]); } }qemu_log ("\n" );
Signature · 1 line
2.26.3
accel/tcg/translate-all.c TranslationBlock *tb_gen_code(CPUState *cpu, · line 2047
Quoted 3 lines · Philippe Mathieu-Daudé
accel/tcg/translate-all.c +3
-0+qemu_log ("0x%08" PRIxPTR": .quad 0x%0*" TCG_PRIlx"\n" , + (uintptr_t )&rx_data_gen_ptr[i], +2 *sizeof (tcg_target_ulong), rx_data_gen_ptr[i]);
This doesn't quite work, because
Quoted 8 lines
../qemu/accel/tcg/translate-all.c:2045:26: error: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]2045 | qemu_log("0x%08" PRIxPTR ": .quad 0x%0*" TCG_PRIlx "\n", | ^~~~~~~ 2046 | (uintptr_t)&rx_data_gen_ptr[i], 2047 | 2 * sizeof(tcg_target_ulong), rx_data_gen_ptr[i]); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long unsigned int
However, I also noticed that we shouldn't be printing ".quad" for 32-bit hosts either. So I'll just split this into two separate qemu_log invocations, based on sizeof(tcg_target_ulong).
r~
Quoted 24 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
+ qemu_log("0x%08" PRIxPTR ": .quad 0x%0*"
TCG_PRIlx"\n",
+ (uintptr_t)&rx_data_gen_ptr[i], + 2 *sizeof(tcg_target_ulong), rx_data_gen_ptr[i]);This doesn't quite work, because
Quoted 9 lines
../qemu/accel/tcg/translate-all.c:2045:26: error: field width specifier ‘*’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]
2045 | qemu_log("0x%08" PRIxPTR ": .quad 0x%0*"TCG_PRIlx"\n",
| ^~~~~~~
2046 | (uintptr_t)&rx_data_gen_ptr[i], 2047 | 2 *sizeof(tcg_target_ulong), rx_data_gen_ptr[i]);Quoted 3 lines
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | long unsigned int
Quoted 3 lines
However, I also noticed that we shouldn't be printing ".quad" for 32-bit hosts either. So I'll just split this into two separate
qemu_loginvocations, based onsizeof(tcg_target_ulong).
Thanks :)