Skip to contentSkip to conversation

semihosting: Added to support GDB_O_APPEND flag of host_open()

PATCH In review ~foxes 2 participants 4 messages Jun 20, 2023

lore
Share & tools
lore

~foxes

author
#0 lore raw

PATCH 1/2 semihosting: Added to support GDB_O_APPEND flag of host_open()

From: Foxes Hung <[email protected]>

---
 semihosting/syscalls.c | 3 +++
 1 file changed, 3 insertions(+)
semihosting/syscalls.c +3 -0
index 68899ebb1c..1a5d39da01 100644
@@ -281,6 +281,9 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
     if (gdb_flags & GDB_O_TRUNC) {
         host_flags |= O_TRUNC;
     }
+    if (gdb_flags & GDB_O_APPEND) {
+        host_flags |= O_APPEND;
+    }
     if (gdb_flags & GDB_O_EXCL) {
         host_flags |= O_EXCL;
     }
Signature · 1 line
2.38.5
author
#1 lore raw

PATCH 2/2 gdbstub: Fixed gdb_open() does not work issue while an extra 'x' is being added when converting '%s' to a pointer

From: Foxes Hung <[email protected]>

---
 gdbstub/syscalls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
gdbstub/syscalls.c +1 -1
index 02e3a8f74c..4c6b5f728b 100644
@@ -126,7 +126,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
             case 's':
                 i64 = va_arg(va, uint64_t);
                 i32 = va_arg(va, uint32_t);
-                p += snprintf(p, p_end - p, "%" PRIx64 "/%x" PRIx32, i64, i32);
+                p += snprintf(p, p_end - p, "%" PRIx64 "/%" PRIx32, i64, i32);
                 break;
             default:
             bad_format:
Signature · 1 line
2.38.5
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH qemu 2/2] gdbstub: Fixed gdb_open() does not work issue while an extra 'x' is being added when converting '%s' to a pointer

Quoted 12 lines · ~foxes

From: Foxes Hung <[email protected]>

---
  gdbstub/syscalls.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
gdbstub/syscalls.c +0 -0
index 02e3a8f74c..4c6b5f728b 100644

gdbstub/syscalls.c void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) · line 132

Quoted 8 lines
gdbstub/syscalls.c +1 -1
@@ -126,7 +126,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
              case 's':
                  i64 = va_arg(va, uint64_t);
                  i32 = va_arg(va, uint32_t);
-                p += snprintf(p, p_end - p, "%" PRIx64 "/%x" PRIx32, i64, i32);
+                p += snprintf(p, p_end - p, "%" PRIx64 "/%" PRIx32, i64, i32);
                  break;
              default:
              bad_format:

r~

Reviewed-by on v1 1/2
#3 lore raw
In reply to ~foxes
Quoted 12 lines · ~foxes

From: Foxes Hung <[email protected]>

---
  semihosting/syscalls.c | 3 +++
  1 file changed, 3 insertions(+)
semihosting/syscalls.c +0 -0
index 68899ebb1c..1a5d39da01 100644

semihosting/syscalls.c static void host_open(CPUState *cs, gdb_syscall_complete_cb complete, · line 289

Quoted 9 lines
semihosting/syscalls.c +3 -0
@@ -281,6 +281,9 @@ static void host_open(CPUState *cs, gdb_syscall_complete_cb complete,
      if (gdb_flags & GDB_O_TRUNC) {
          host_flags |= O_TRUNC;
      }
+    if (gdb_flags & GDB_O_APPEND) {
+        host_flags |= O_APPEND;
+    }
      if (gdb_flags & GDB_O_EXCL) {
          host_flags |= O_EXCL;
      }

r~