Changeset 107166 in vbox
- Timestamp:
- Nov 27, 2024 1:25:02 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCGdbRemoteStub.cpp
r106061 r107166 1027 1027 * amd64 GDB register set. 1028 1028 */ 1029 static const GDBREGDESC g_aGdbRegs 64[] =1029 static const GDBREGDESC g_aGdbRegsAmd64[] = 1030 1030 { 1031 1031 DBGREG_DESC_INIT_INT64( "rax", DBGFREG_RAX), … … 1077 1077 * i386 GDB register set. 1078 1078 */ 1079 static const GDBREGDESC g_aGdbRegs 32[] =1079 static const GDBREGDESC g_aGdbRegsX86[] = 1080 1080 { 1081 1081 DBGREG_DESC_INIT_INT32( "eax", DBGFREG_EAX), … … 1115 1115 }; 1116 1116 1117 1118 /** 1119 * arm64 GDB register set. 1120 */ 1121 static const GDBREGDESC g_aGdbRegsArm64[] = 1122 { 1123 DBGREG_DESC_INIT_INT64( "x0", DBGFREG_ARMV8_GREG_X0), 1124 DBGREG_DESC_INIT_INT64( "x1", DBGFREG_ARMV8_GREG_X1), 1125 DBGREG_DESC_INIT_INT64( "x2", DBGFREG_ARMV8_GREG_X2), 1126 DBGREG_DESC_INIT_INT64( "x3", DBGFREG_ARMV8_GREG_X3), 1127 DBGREG_DESC_INIT_INT64( "x4", DBGFREG_ARMV8_GREG_X4), 1128 DBGREG_DESC_INIT_INT64( "x5", DBGFREG_ARMV8_GREG_X5), 1129 DBGREG_DESC_INIT_INT64( "x6", DBGFREG_ARMV8_GREG_X6), 1130 DBGREG_DESC_INIT_INT64( "x7", DBGFREG_ARMV8_GREG_X7), 1131 DBGREG_DESC_INIT_INT64( "x8", DBGFREG_ARMV8_GREG_X8), 1132 DBGREG_DESC_INIT_INT64( "x9", DBGFREG_ARMV8_GREG_X9), 1133 DBGREG_DESC_INIT_INT64( "x10", DBGFREG_ARMV8_GREG_X10), 1134 DBGREG_DESC_INIT_INT64( "x11", DBGFREG_ARMV8_GREG_X11), 1135 DBGREG_DESC_INIT_INT64( "x12", DBGFREG_ARMV8_GREG_X12), 1136 DBGREG_DESC_INIT_INT64( "x13", DBGFREG_ARMV8_GREG_X13), 1137 DBGREG_DESC_INIT_INT64( "x14", DBGFREG_ARMV8_GREG_X14), 1138 DBGREG_DESC_INIT_INT64( "x15", DBGFREG_ARMV8_GREG_X15), 1139 DBGREG_DESC_INIT_INT64( "x16", DBGFREG_ARMV8_GREG_X16), 1140 DBGREG_DESC_INIT_INT64( "x17", DBGFREG_ARMV8_GREG_X17), 1141 DBGREG_DESC_INIT_INT64( "x18", DBGFREG_ARMV8_GREG_X18), 1142 DBGREG_DESC_INIT_INT64( "x19", DBGFREG_ARMV8_GREG_X19), 1143 DBGREG_DESC_INIT_INT64( "x20", DBGFREG_ARMV8_GREG_X20), 1144 DBGREG_DESC_INIT_INT64( "x21", DBGFREG_ARMV8_GREG_X21), 1145 DBGREG_DESC_INIT_INT64( "x22", DBGFREG_ARMV8_GREG_X22), 1146 DBGREG_DESC_INIT_INT64( "x23", DBGFREG_ARMV8_GREG_X23), 1147 DBGREG_DESC_INIT_INT64( "x24", DBGFREG_ARMV8_GREG_X24), 1148 DBGREG_DESC_INIT_INT64( "x25", DBGFREG_ARMV8_GREG_X25), 1149 DBGREG_DESC_INIT_INT64( "x26", DBGFREG_ARMV8_GREG_X26), 1150 DBGREG_DESC_INIT_INT64( "x27", DBGFREG_ARMV8_GREG_X27), 1151 DBGREG_DESC_INIT_INT64( "x28", DBGFREG_ARMV8_GREG_X28), 1152 DBGREG_DESC_INIT_INT64( "x29", DBGFREG_ARMV8_GREG_X29), 1153 DBGREG_DESC_INIT_CODE_PTR64("x30", DBGFREG_ARMV8_GREG_LR), 1154 1155 DBGREG_DESC_INIT_DATA_PTR64("sp", DBGFREG_ARMV8_SP_EL1), /** @todo EL0 */ 1156 DBGREG_DESC_INIT_CODE_PTR64("pc", DBGFREG_ARMV8_PC), 1157 1158 DBGREG_DESC_INIT_INT32( "cpsr", DBGFREG_ARMV8_PSTATE), 1159 }; 1160 1161 1117 1162 #undef DBGREG_DESC_INIT_CODE_PTR64 1118 1163 #undef DBGREG_DESC_INIT_DATA_PTR64 … … 1133 1178 static int dbgcGdbStubCtxTgtXmlDescCreate(PGDBSTUBCTX pThis) 1134 1179 { 1135 static const char s_szXmlTgtHdr 64[] =1180 static const char s_szXmlTgtHdrAmd64[] = 1136 1181 "<?xml version=\"1.0\"?>\n" 1137 1182 "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">\n" … … 1139 1184 " <architecture>i386:x86-64</architecture>\n" 1140 1185 " <feature name=\"org.gnu.gdb.i386.core\">\n"; 1141 static const char s_szXmlTgtHdr 32[] =1186 static const char s_szXmlTgtHdrX86[] = 1142 1187 "<?xml version=\"1.0\"?>\n" 1143 1188 "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">\n" … … 1145 1190 " <architecture>i386</architecture>\n" 1146 1191 " <feature name=\"org.gnu.gdb.i386.core\">\n"; 1192 static const char s_szXmlTgtHdrArm64[] = 1193 "<?xml version=\"1.0\"?>\n" 1194 "<!DOCTYPE target SYSTEM \"gdb-target.dtd\">\n" 1195 "<target version=\"1.0\">\n" 1196 " <architecture>aarch64</architecture>\n" 1197 " <feature name=\"org.gnu.gdb.aarch64.core\">\n"; 1147 1198 static const char s_szXmlTgtFooter[] = 1148 1199 " </feature>\n" … … 1158 1209 pThis->cbTgtXmlDesc = cbLeft; 1159 1210 1160 rc = RTStrCatP(&pachXmlCur, &cbLeft, pThis->paRegs == &g_aGdbRegs64[0] ? &s_szXmlTgtHdr64[0] : &s_szXmlTgtHdr32[0]); 1211 const char *pszHdr = NULL; 1212 if (pThis->paRegs == &g_aGdbRegsAmd64[0]) 1213 pszHdr = &s_szXmlTgtHdrAmd64[0]; 1214 else if (pThis->paRegs == &g_aGdbRegsX86[0]) 1215 pszHdr = &s_szXmlTgtHdrX86[0]; 1216 else if (pThis->paRegs == &g_aGdbRegsArm64[0]) 1217 pszHdr = &s_szXmlTgtHdrArm64[0]; 1218 else 1219 return VERR_INVALID_STATE; 1220 1221 rc = RTStrCatP(&pachXmlCur, &cbLeft, pszHdr); 1161 1222 if (RT_SUCCESS(rc)) 1162 1223 { … … 1759 1820 uint32_t idxRegMax = 0; 1760 1821 size_t cbRegs = 0; 1761 for ( ;;)1822 for (uint32_t i = 0; i < pThis->cRegs; i++) 1762 1823 { 1763 1824 const GDBREGDESC *pReg = &pThis->paRegs[idxRegMax++]; 1764 1825 cbRegs += pReg->cBits / 8; 1765 if (pReg->enmReg == DBGFREG_SS) /* Up to this seems to belong to the general register set . */1826 if (pReg->enmReg == DBGFREG_SS) /* Up to this seems to belong to the general register set on x86/amd64. */ 1766 1827 break; 1767 1828 } … … 2567 2628 { 2568 2629 case CPUMMODE_PROTECTED: 2569 pThis->paRegs = &g_aGdbRegs 32[0];2570 pThis->cRegs = RT_ELEMENTS(g_aGdbRegs 32);2630 pThis->paRegs = &g_aGdbRegsX86[0]; 2631 pThis->cRegs = RT_ELEMENTS(g_aGdbRegsX86); 2571 2632 break; 2572 2633 case CPUMMODE_LONG: 2573 pThis->paRegs = &g_aGdbRegs64[0]; 2574 pThis->cRegs = RT_ELEMENTS(g_aGdbRegs64); 2634 pThis->paRegs = &g_aGdbRegsAmd64[0]; 2635 pThis->cRegs = RT_ELEMENTS(g_aGdbRegsAmd64); 2636 break; 2637 case CPUMMODE_ARMV8_AARCH64: 2638 pThis->paRegs = &g_aGdbRegsArm64[0]; 2639 pThis->cRegs = RT_ELEMENTS(g_aGdbRegsArm64); 2575 2640 break; 2576 2641 case CPUMMODE_REAL:
Note:
See TracChangeset
for help on using the changeset viewer.