[PATCH] plugins/execlog.c: correct dump of registers values

Frédéric Pétrot posted 1 patch 1 year, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240620083805.73603-1-frederic.petrot@univ-grenoble-alpes.fr
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Alexandre Iooss <erdnaxe@crans.org>, Mahmoud Mandour <ma.mandourr@gmail.com>, Pierrick Bouvier <pierrick.bouvier@linaro.org>
contrib/plugins/execlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] plugins/execlog.c: correct dump of registers values
Posted by Frédéric Pétrot 1 year, 5 months ago
Register values are dumped as 'sz' chunks of two nibbles in the execlog
plugin, sz was 1 too big.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
---
 contrib/plugins/execlog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index 371db97eb1..1c1601cc0b 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -101,7 +101,7 @@ static void insn_check_regs(CPU *cpu)
             GByteArray *temp = reg->last;
             g_string_append_printf(cpu->last_exec, ", %s -> 0x", reg->name);
             /* TODO: handle BE properly */
-            for (int i = sz; i >= 0; i--) {
+            for (int i = sz - 1; i >= 0; i--) {
                 g_string_append_printf(cpu->last_exec, "%02x",
                                        reg->new->data[i]);
             }
-- 
2.39.2


Re: [PATCH] plugins/execlog.c: correct dump of registers values
Posted by Alex Bennée 1 year, 5 months ago
Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr> writes:

> Register values are dumped as 'sz' chunks of two nibbles in the execlog
> plugin, sz was 1 too big.
>
> Signed-off-by: Frédéric Pétrot
> <frederic.petrot@univ-grenoble-alpes.fr>

Queued to plugins/next, thanks.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH] plugins/execlog.c: correct dump of registers values
Posted by Pierrick Bouvier 1 year, 5 months ago
On 6/20/24 01:38, Frédéric Pétrot wrote:
> Register values are dumped as 'sz' chunks of two nibbles in the execlog
> plugin, sz was 1 too big.
> 
> Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
> ---
>   contrib/plugins/execlog.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
> index 371db97eb1..1c1601cc0b 100644
> --- a/contrib/plugins/execlog.c
> +++ b/contrib/plugins/execlog.c
> @@ -101,7 +101,7 @@ static void insn_check_regs(CPU *cpu)
>               GByteArray *temp = reg->last;
>               g_string_append_printf(cpu->last_exec, ", %s -> 0x", reg->name);
>               /* TODO: handle BE properly */
> -            for (int i = sz; i >= 0; i--) {
> +            for (int i = sz - 1; i >= 0; i--) {
>                   g_string_append_printf(cpu->last_exec, "%02x",
>                                          reg->new->data[i]);
>               }

Good catch, thanks!
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

Pierrick