All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] accel/tcg: Align data dumped at end of TB
@ 2021-05-15 10:42 Philippe Mathieu-Daudé
  2021-05-16 14:01 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-15 10:42 UTC (permalink / raw
  To: qemu-devel
  Cc: Alex Bennée, Stefan Weil, Richard Henderson,
	Philippe Mathieu-Daudé, Paolo Bonzini

To better visualize the data dumped at the end of a TB,
left-align it (padding it with 0).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/tcg/translate-all.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ae7e873713a..387f3dc2303 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -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");
-- 
2.26.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/tcg: Align data dumped at end of TB
  2021-05-15 10:42 [PATCH] accel/tcg: Align data dumped at end of TB Philippe Mathieu-Daudé
@ 2021-05-16 14:01 ` Richard Henderson
  2021-05-16 17:54   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2021-05-16 14:01 UTC (permalink / raw
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Stefan Weil, Alex Bennée, Paolo Bonzini

On 5/15/21 5:42 AM, Philippe Mathieu-Daudé wrote:
> +                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


> ../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~


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] accel/tcg: Align data dumped at end of TB
  2021-05-16 14:01 ` Richard Henderson
@ 2021-05-16 17:54   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-16 17:54 UTC (permalink / raw
  To: Richard Henderson, qemu-devel
  Cc: Stefan Weil, Alex Bennée, Paolo Bonzini

On 5/16/21 4:01 PM, Richard Henderson wrote:
> On 5/15/21 5:42 AM, Philippe Mathieu-Daudé wrote:
>> +                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
> 
> 
>> ../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).

Thanks :)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-16 17:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-15 10:42 [PATCH] accel/tcg: Align data dumped at end of TB Philippe Mathieu-Daudé
2021-05-16 14:01 ` Richard Henderson
2021-05-16 17:54   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.