Patchwork vga.c: Debug messages go to stderr

login
register
mail settings
Submitter Damian, Alexandru
Date April 2, 2013, 10:53 a.m.
Message ID <1364900032-32400-1-git-send-email-alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/232943/
State New
Headers show

Comments

Damian, Alexandru - April 2, 2013, 10:53 a.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

Move debug messages to stderr since often in vga code debug
stdio is used as serial console.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 hw/vga.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
Gerd Hoffmann - April 2, 2013, 11:58 a.m.
On 04/02/13 12:53, Alex DAMIAN wrote:
> From: Alexandru DAMIAN <alexandru.damian@intel.com>
> 
> Move debug messages to stderr since often in vga code debug
> stdio is used as serial console.

Make them tracepoints would be even better ...

cheers,
  Gerd

Patch

diff --git a/hw/vga.c b/hw/vga.c
index 59bfb22..2e337b8 100644
--- a/hw/vga.c
+++ b/hw/vga.c
@@ -391,7 +391,7 @@  uint32_t vga_ioport_read(void *opaque, uint32_t addr)
         case VGA_SEQ_D:
             val = s->sr[s->sr_index];
 #ifdef DEBUG_VGA_REG
-            printf("vga: read SR%x = 0x%02x\n", s->sr_index, val);
+            fprintf(stderr, "vga: read SR%x = 0x%02x\n", s->sr_index, val);
 #endif
             break;
         case VGA_PEL_IR:
@@ -419,7 +419,7 @@  uint32_t vga_ioport_read(void *opaque, uint32_t addr)
         case VGA_GFX_D:
             val = s->gr[s->gr_index];
 #ifdef DEBUG_VGA_REG
-            printf("vga: read GR%x = 0x%02x\n", s->gr_index, val);
+            fprintf(stderr, "vga: read GR%x = 0x%02x\n", s->gr_index, val);
 #endif
             break;
         case VGA_CRT_IM:
@@ -430,7 +430,7 @@  uint32_t vga_ioport_read(void *opaque, uint32_t addr)
         case VGA_CRT_DC:
             val = s->cr[s->cr_index];
 #ifdef DEBUG_VGA_REG
-            printf("vga: read CR%x = 0x%02x\n", s->cr_index, val);
+            fprintf(stderr, "vga: read CR%x = 0x%02x\n", s->cr_index, val);
 #endif
             break;
         case VGA_IS1_RM:
@@ -445,7 +445,7 @@  uint32_t vga_ioport_read(void *opaque, uint32_t addr)
         }
     }
 #if defined(DEBUG_VGA)
-    printf("VGA: read addr=0x%04x data=0x%02x\n", addr, val);
+    fprintf(stderr, "VGA: read addr=0x%04x data=0x%02x\n", addr, val);
 #endif
     return val;
 }
@@ -462,7 +462,7 @@  void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         return;
     }
 #ifdef DEBUG_VGA
-    printf("VGA: write addr=0x%04x data=0x%02x\n", addr, val);
+    fprintf(stderr, "VGA: write addr=0x%04x data=0x%02x\n", addr, val);
 #endif
 
     switch(addr) {
@@ -506,7 +506,7 @@  void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         break;
     case VGA_SEQ_D:
 #ifdef DEBUG_VGA_REG
-        printf("vga: write SR%x = 0x%02x\n", s->sr_index, val);
+        fprintf(stderr, "vga: write SR%x = 0x%02x\n", s->sr_index, val);
 #endif
         s->sr[s->sr_index] = val & sr_mask[s->sr_index];
         if (s->sr_index == VGA_SEQ_CLOCK_MODE) {
@@ -537,7 +537,7 @@  void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         break;
     case VGA_GFX_D:
 #ifdef DEBUG_VGA_REG
-        printf("vga: write GR%x = 0x%02x\n", s->gr_index, val);
+        fprintf(stderr, "vga: write GR%x = 0x%02x\n", s->gr_index, val);
 #endif
         s->gr[s->gr_index] = val & gr_mask[s->gr_index];
         vga_update_memory_access(s);
@@ -549,7 +549,7 @@  void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
     case VGA_CRT_DM:
     case VGA_CRT_DC:
 #ifdef DEBUG_VGA_REG
-        printf("vga: write CR%x = 0x%02x\n", s->cr_index, val);
+        fprintf(stderr, "vga: write CR%x = 0x%02x\n", s->cr_index, val);
 #endif
         /* handle CR0-7 protection */
         if ((s->cr[VGA_CRTC_V_SYNC_END] & VGA_CR11_LOCK_CR0_CR7) &&
@@ -848,7 +848,7 @@  void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
     uint32_t write_mask, bit_mask, set_mask;
 
 #ifdef DEBUG_VGA_MEM
-    printf("vga: [0x" TARGET_FMT_plx "] = 0x%02x\n", addr, val);
+    fprintf(stderr, "vga: [0x" TARGET_FMT_plx "] = 0x%02x\n", addr, val);
 #endif
     /* convert to VGA memory offset */
     memory_map_mode = (s->gr[VGA_GFX_MISC] >> 2) & 3;
@@ -881,7 +881,7 @@  void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
         if (s->sr[VGA_SEQ_PLANE_WRITE] & mask) {
             s->vram_ptr[addr] = val;
 #ifdef DEBUG_VGA_MEM
-            printf("vga: chain4: [0x" TARGET_FMT_plx "]\n", addr);
+            fprintf(stderr, "vga: chain4: [0x" TARGET_FMT_plx "]\n", addr);
 #endif
             s->plane_updated |= mask; /* only used to detect font change */
             memory_region_set_dirty(&s->vram, addr, 1);
@@ -894,7 +894,7 @@  void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
             addr = ((addr & ~1) << 1) | plane;
             s->vram_ptr[addr] = val;
 #ifdef DEBUG_VGA_MEM
-            printf("vga: odd/even: [0x" TARGET_FMT_plx "]\n", addr);
+            fprintf(stderr, "vga: odd/even: [0x" TARGET_FMT_plx "]\n", addr);
 #endif
             s->plane_updated |= mask; /* only used to detect font change */
             memory_region_set_dirty(&s->vram, addr, 1);
@@ -969,7 +969,7 @@  void vga_mem_writeb(VGACommonState *s, hwaddr addr, uint32_t val)
             (((uint32_t *)s->vram_ptr)[addr] & ~write_mask) |
             (val & write_mask);
 #ifdef DEBUG_VGA_MEM
-        printf("vga: latch: [0x" TARGET_FMT_plx "] mask=0x%08x val=0x%08x\n",
+        fprintf(stderr, "vga: latch: [0x" TARGET_FMT_plx "] mask=0x%08x val=0x%08x\n",
                addr * 4, write_mask, val);
 #endif
         memory_region_set_dirty(&s->vram, addr << 2, sizeof(uint32_t));