Skip to contentSkip to conversation

serial: Fix debug format strings

PATCH Applied Kevin Wolf 4 participants 5 messages Mar 19, 2013 – Mar 22, 2013

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 serial: Fix debug format strings

This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.

---
 hw/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/serial.c +2 -2
index 48a5eb6..0ccc499 100644
@@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
     addr &= 7;
-    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
+    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);
     switch(addr) {
     default:
     case 0:
@@ -527,7 +527,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
         ret = s->scr;
         break;
     }
-    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
+    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
     return ret;
 }
 
Signature · 1 line
1.8.1.4
#1 lore raw

Cc'ing qemu-trivial

Quoted 28 lines · Kevin Wolf

This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.

---
 hw/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/serial.c +2 -2
index 48a5eb6..0ccc499 100644
@@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
     addr &= 7;
-    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
+    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);
     switch(addr) {
     default:
     case 0:
@@ -527,7 +527,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
         ret = s->scr;
         break;
     }
-    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
+    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
     return ret;
 }
#2 lore raw
In reply to Kevin Wolf

Am 19.03.2013 12:25, schrieb Kevin Wolf:

Quoted 12 lines

This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.

---
 hw/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/serial.c +0 -0
index 48a5eb6..0ccc499 100644

hw/serial.c static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val, · line 309

Quoted 5 lines
hw/serial.c +1 -1
@@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
     addr &= 7;
-    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
+    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);

Are you intentionally dropping 02 in both places? That changes output FWIW.

Andreas

Quoted 13 lines
hw/serial.c +1 -1
     switch(addr) {
     default:
     case 0:
@@ -527,7 +527,7 @@ static uint64_t serial_ioport_read(void *opaque, hwaddr addr, unsigned size)
         ret = s->scr;
         break;
     }
-    DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret);
+    DPRINTF("read addr=0x%" HWADDR_PRIx " val=0x%02x\n", addr, ret);
     return ret;
 }
 
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#3 lore raw

Am 19.03.2013 um 14:29 hat Andreas Färber geschrieben:

Quoted 15 lines

Am 19.03.2013 12:25, schrieb Kevin Wolf:

Quoted 14 lines

This fixes the build of hw/serial.c with DEBUG_SERIAL enabled.

---
 hw/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/serial.c +0 -0
index 48a5eb6..0ccc499 100644
@@ -306,7 +306,7 @@ static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     SerialState *s = opaque;
 
Quoted 5 lines

hw/serial.c static void serial_ioport_write(void *opaque, hwaddr addr, uint64_t val, · line 309

Quoted 3 lines
hw/serial.c +1 -1
     addr &= 7;
-    DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val);
+    DPRINTF("write addr=0x%" HWADDR_PRIx " val=0x%" PRIx64 "\n", addr, val);

Are you intentionally dropping 02 in both places? That changes output FWIW.

%02 for 64 bit values felt odd, but I think they might be guaranteed to be small enough in practice. If you really prefer, I can send a v2 which adds it back. But it's only debug code, so... *shrug*

Kevin