Skip to contentSkip to conversation

target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray

PATCH-for-5.0 Applied Philippe Mathieu-Daudé 4 participants 7 messages Apr 9, 2020

lore
Share & tools
lore
#0 lore raw

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Fixes a010bdbe719 ("extend GByteArray to read register helpers")

---
Based-on: <[email protected]>

---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +2 -2
index 014657c637..cad4083895 100644
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Signature · 1 line
2.21.1
Reviewed-by
#1 lore raw

Le 09/04/2020 à 19:25, Philippe Mathieu-Daudé a écrit :

Quoted 20 lines

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Fixes a010bdbe719 ("extend GByteArray to read register helpers")

---
Based-on: <[email protected]>

---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +0 -0
index 014657c637..cad4083895 100644

target/m68k/helper.c static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n) · line 116

Quoted 10 lines
target/m68k/helper.c +2 -2
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Reviewed-by
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Fixes a010bdbe719 ("extend GByteArray to read register helpers")

Should this be instead 462474d760 ("target/m68k: use gdb_get_reg helpers", 2020-03-17)?

Quoted 2 lines
Quoted 3 lines

---
Based-on: <[email protected]>

(One benigh extra line; same thing could happen to me when amending
like this with "---")

Quoted 22 lines
---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +2 -2
index 014657c637..cad4083895 100644
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Signature · 1 line
2.21.1
Signature · 1 line
Peter Xu
#3 lore raw

Le 09/04/2020 à 20:22, Peter Xu a écrit :

Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 5 lines

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Fixes a010bdbe719 ("extend GByteArray to read register helpers")

Should this be instead 462474d760 ("target/m68k: use gdb_get_reg helpers", 2020-03-17)?

No, this one is correct because it uses an "uint8_t *", then a010bdbe719 changed this to a GByteArray and didn't remove the "+ len".

Thanks,
Laurent

Quoted 36 lines
Quoted 3 lines
Quoted 3 lines

---
Based-on: <[email protected]>

(One benigh extra line; same thing could happen to me when amending
like this with "---")

Quoted 22 lines
---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +2 -2
index 014657c637..cad4083895 100644
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Signature · 1 line
2.21.1
#4 lore raw
In reply to Peter Xu

Le 09/04/2020 à 20:22, Peter Xu a écrit :

Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 5 lines

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Fixes a010bdbe719 ("extend GByteArray to read register helpers")

Should this be instead 462474d760 ("target/m68k: use gdb_get_reg helpers", 2020-03-17)?

No, this one is correct because it uses an "uint8_t *", then a010bdbe719 changed this to a GByteArray and didn't remove the "+ len".

Thanks,
Laurent

Quoted 35 lines
Quoted 2 lines
Quoted 3 lines

---
Based-on: <[email protected]>

(One benigh extra line; same thing could happen to me when amending
like this with "---")

Quoted 22 lines
---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +2 -2
index 014657c637..cad4083895 100644
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Signature · 1 line
2.21.1
#5 lore raw
Quoted 6 lines · Laurent Vivier

Le 09/04/2020 à 20:22, Peter Xu a écrit :

Quoted 5 lines · Philippe Mathieu-Daudé
Quoted 4 lines

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Fixes a010bdbe719 ("extend GByteArray to read register helpers")

Should this be instead 462474d760 ("target/m68k: use gdb_get_reg helpers", 2020-03-17)?

No, this one is correct because it uses an "uint8_t *", then a010bdbe719 changed this to a GByteArray and didn't remove the "+ len".

Ah right...

Signature · 1 line
Peter Xu
Applied
#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 4 lines · Philippe Mathieu-Daudé

Since a010bdbe719 the gdbstub API takes a GByteArray*. Unfortunately we forgot to update the gdb_get_reg*() calls. Do it now.

Queued to for-5.0/more-random-fixes, thanks.

Quoted 25 lines
Fixes a010bdbe719 ("extend GByteArray to read register helpers")

---
Based-on: <[email protected]>

---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target/m68k/helper.c +2 -2
index 014657c637..cad4083895 100644
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
-        len += gdb_get_reg16(mem_buf + len, 0);
-        len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
Signature · 1 line
Alex Bennée