vmm: Change decode to use stderr
authorGan Shun Lim <ganshun@gmail.com>
Mon, 5 Dec 2016 06:16:00 +0000 (14:16 +0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Tue, 6 Dec 2016 17:37:42 +0000 (09:37 -0800)
Using printf causes the last few prints to not show up before we bail
out. For debug purposes, we probably want fprintf stderr.

Change-Id: Iba69da4db583072f15e7bb31c5cb81849d1ab561
Signed-off-by: Gan Shun Lim <ganshun@gmail.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/vmm/decode.c

index e0cbaf6..b220f03 100644 (file)
 
 int debug_decode = 0;
 #define DPRINTF(fmt, ...) \
-       if (debug_decode) { printf("decode: " fmt , ## __VA_ARGS__); }
+       do { \
+               if (debug_decode) { \
+                       fprintf(stderr, "decode: " fmt, ## __VA_ARGS__); \
+               } \
+       } \
+       while (0)
 
 static char *modrmreg[] = {"rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi"};