winedbg: Use defines instead of magic values

André Hentschel nerv at dawncrow.de
Tue Feb 21 16:37:03 CST 2012


---
 programs/winedbg/be_arm.c |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index c39043c..85f28b3 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -22,6 +22,19 @@
 
 #include "debugger.h"
 
+#define CPSR_USER26    0
+#define CPSR_FIQ26     1
+#define CPSR_IRQ26     2
+#define CPSR_SVC26     3
+#define CPSR_USER     16
+#define CPSR_FIQ      17
+#define CPSR_IRQ      18
+#define CPSR_SVC      19
+#define CPSR_ABT      23
+#define CPSR_UND      27
+#define CPSR_MODEMASK 31
+#define CPSR_THUMB    32
+
 #if defined(__arm__)
 
 static unsigned be_arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
@@ -61,23 +74,23 @@ static void be_arm_print_context(HANDLE hThread, const CONTEXT* ctx, int all_reg
     int i;
     char        buf[8];
 
-    switch (ctx->Cpsr & 0x1F)
+    switch (ctx->Cpsr & CPSR_MODEMASK)
     {
-    case 0:  strcpy(buf, "User26"); break;
-    case 1:  strcpy(buf, "FIQ26"); break;
-    case 2:  strcpy(buf, "IRQ26"); break;
-    case 3:  strcpy(buf, "SVC26"); break;
-    case 16: strcpy(buf, "User"); break;
-    case 17: strcpy(buf, "FIQ"); break;
-    case 18: strcpy(buf, "IRQ"); break;
-    case 19: strcpy(buf, "SVC"); break;
-    case 23: strcpy(buf, "ABT"); break;
-    case 27: strcpy(buf, "UND"); break;
+    case CPSR_USER26: strcpy(buf, "User26"); break;
+    case CPSR_FIQ26:  strcpy(buf, "FIQ26"); break;
+    case CPSR_IRQ26:  strcpy(buf, "IRQ26"); break;
+    case CPSR_SVC26:  strcpy(buf, "SVC26"); break;
+    case CPSR_USER:   strcpy(buf, "User"); break;
+    case CPSR_FIQ:    strcpy(buf, "FIQ"); break;
+    case CPSR_IRQ:    strcpy(buf, "IRQ"); break;
+    case CPSR_SVC:    strcpy(buf, "SVC"); break;
+    case CPSR_ABT:    strcpy(buf, "ABT"); break;
+    case CPSR_UND:    strcpy(buf, "UND"); break;
     default: strcpy(buf, "UNKNWN"); break;
     }
 
     dbg_printf("Register dump:\n");
-    dbg_printf("%s %s Mode\n", (ctx->Cpsr & 0x20) ? "Thumb" : "ARM", buf);
+    dbg_printf("%s %s Mode\n", (ctx->Cpsr & CPSR_THUMB) ? "Thumb" : "ARM", buf);
 
     strcpy(buf, condflags);
     for (i = 0; buf[i]; i++)
-- 

Best Regards, André Hentschel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Nachrichtenteil als Anhang
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120221/b7eb4a0a/attachment.ksh>


More information about the wine-patches mailing list