Browse Source

Fix warning about unused var - improves code, no order dependency now

Signed-off-by: Graham MacDonald <grahamamacdonald@gmail.com>
Graham MacDonald 6 years ago
parent
commit
a3cdd1cac7
2 changed files with 30 additions and 28 deletions
  1. 2 28
      sys/src/cmd/gdbserver/gdb.h
  2. 28 0
      sys/src/cmd/gdbserver/gdbstub.c

+ 2 - 28
sys/src/cmd/gdbserver/gdb.h

@@ -93,34 +93,8 @@ enum regnames {
 	GDB_GS,			/* 23 */
 };
 
-// Again, this is very gdb-specific.  Order should be maintained the table above
-static const
-char* regstrs[] = {
-	"AX",
-	"BX",
-	"CX",
-	"DX",
-	"SI",
-	"DI",
-	"BP",
-	"SP",
-	"R8",
-	"R9",
-	"R10",
-	"R11",
-	"R12",
-	"R13",
-	"R14",
-	"R15",
-	"PC",
-	"PS",
-	"CS",
-	"SS",
-	"DS",
-	"ES",
-	"FS",
-	"GS",
-};
+// Again, this is very gdb-specific.
+extern char* regstrs[];
 
 #define GDB_ORIG_AX		57
 #define DBG_MAX_REG_NUM		24

+ 28 - 0
sys/src/cmd/gdbserver/gdbstub.c

@@ -65,6 +65,34 @@ static struct state ks;
 
 static char *hex_asc = "0123456789abcdef";
 
+char* regstrs[] = {
+	[GDB_AX] = "AX",
+	[GDB_BX] = "BX",
+	[GDB_CX] = "CX",
+	[GDB_DX] = "DX",
+	[GDB_SI] = "SI",
+	[GDB_DI] = "DI",
+	[GDB_BP] = "BP",
+	[GDB_SP] = "SP",
+	[GDB_R8] = "R8",
+	[GDB_R9] = "R9",
+	[GDB_R10] = "R10",
+	[GDB_R11] = "R11",
+	[GDB_R12] = "R12",
+	[GDB_R13] = "R13",
+	[GDB_R14] = "R14",
+	[GDB_R15] = "R15",
+	[GDB_PC] = "PC",
+	[GDB_PS] = "PS",
+	[GDB_CS] = "CS",
+	[GDB_SS] = "SS",
+	[GDB_DS] = "DS",
+	[GDB_ES] = "ES",
+	[GDB_FS] = "FS",
+	[GDB_GS] = "GS",
+};
+
+
 // not reentrant, bla bla bla
 char *
 errstring(char *prefix)