Changeset 35586 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jan 17, 2011 2:20:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r35551 r35586 1053 1053 * @param a_enmType The type of the value. 1054 1054 */ 1055 static HRESULT formatRegisterValue(Bstr *a_pbstr, PCDBGFREGVAL a_pValue, DBGFREGVALTYPE a_enmType) 1056 { 1057 char szHex[128]; /* Must be big because RTStrFormatNumber is unsafe. */ 1058 1059 switch (a_enmType) 1060 { 1061 case DBGFREGVALTYPE_U8: 1062 RTStrFormatNumber(szHex, a_pValue->u8, 16, 2+2, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_8BIT); 1063 *a_pbstr = szHex; 1064 return S_OK; 1065 1066 case DBGFREGVALTYPE_U16: 1067 RTStrFormatNumber(szHex, a_pValue->u16, 16, 2+4, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_16BIT); 1068 *a_pbstr = szHex; 1069 return S_OK; 1070 1071 case DBGFREGVALTYPE_U32: 1072 RTStrFormatNumber(szHex, a_pValue->u32, 16, 2+8, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_32BIT); 1073 *a_pbstr = szHex; 1074 return S_OK; 1075 1076 case DBGFREGVALTYPE_U64: 1077 RTStrFormatNumber(szHex, a_pValue->u64, 16, 2+16, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 1078 *a_pbstr = szHex; 1079 return S_OK; 1080 1081 case DBGFREGVALTYPE_U128: 1082 RTStrFormatNumber(szHex, a_pValue->au64[1], 16, 2+16, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 1083 RTStrFormatNumber(&szHex[2+16], a_pValue->au64[0], 16, 16, 0, RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 1084 *a_pbstr = szHex; 1085 return S_OK; 1086 1087 case DBGFREGVALTYPE_R80: 1088 { 1089 char *pszHex = szHex; 1090 if (a_pValue->r80.s.fSign) 1091 *pszHex++ = '-'; 1092 else 1093 *pszHex++ = '+'; 1094 1095 if (a_pValue->r80.s.uExponent == 0) 1096 { 1097 if ( !a_pValue->r80.sj64.u63Fraction 1098 && a_pValue->r80.sj64.fInteger) 1099 *pszHex++ = '0'; 1100 /* else: Denormal, handled way below. */ 1101 } 1102 else if (a_pValue->r80.sj64.uExponent == UINT16_C(0x7fff)) 1103 { 1104 /** @todo Figure out Pseudo inf/nan... */ 1105 if (a_pValue->r80.sj64.fInteger) 1106 *pszHex++ = 'P'; 1107 if (a_pValue->r80.sj64.u63Fraction == 0) 1108 { 1109 *pszHex++ = 'I'; 1110 *pszHex++ = 'n'; 1111 *pszHex++ = 'f'; 1112 } 1113 else 1114 { 1115 *pszHex++ = 'N'; 1116 *pszHex++ = 'a'; 1117 *pszHex++ = 'N'; 1118 } 1119 } 1120 if (pszHex != &szHex[1]) 1121 *pszHex = '\0'; 1122 else 1123 { 1124 *pszHex++ = a_pValue->r80.sj64.fInteger ? '1' : '0'; 1125 *pszHex++ = 'm'; 1126 pszHex += RTStrFormatNumber(pszHex, a_pValue->r80.sj64.u63Fraction, 16, 2+16, 0, 1127 RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 1128 1129 *pszHex++ = 'e'; 1130 pszHex += RTStrFormatNumber(pszHex, (int32_t)a_pValue->r80.sj64.uExponent - 16383, 10, 0, 0, 1131 RTSTR_F_ZEROPAD | RTSTR_F_32BIT | RTSTR_F_VALSIGNED); 1132 } 1133 *a_pbstr = szHex; 1134 return S_OK; 1135 } 1136 1137 case DBGFREGVALTYPE_DTR: 1138 RTStrFormatNumber(szHex, a_pValue->dtr.u64Base, 16, 2+16, 0, RTSTR_F_SPECIAL | RTSTR_F_ZEROPAD | RTSTR_F_64BIT); 1139 szHex[2+16] = ':'; 1140 RTStrFormatNumber(&szHex[2+16+1], a_pValue->dtr.u32Limit, 16, 4, 0, RTSTR_F_ZEROPAD | RTSTR_F_32BIT); 1141 *a_pbstr = szHex; 1142 return S_OK; 1143 1144 case DBGFREGVALTYPE_INVALID: 1145 case DBGFREGVALTYPE_END: 1146 case DBGFREGVALTYPE_32BIT_HACK: 1147 break; 1148 /* no default */ 1149 } 1150 1151 return E_UNEXPECTED; 1055 DECLINLINE(HRESULT) formatRegisterValue(Bstr *a_pbstr, PCDBGFREGVAL a_pValue, DBGFREGVALTYPE a_enmType) 1056 { 1057 char szHex[160]; 1058 ssize_t cch = DBGFR3RegFormatValue(szHex, sizeof(szHex), a_pValue, a_enmType, true /*fSpecial*/); 1059 if (RT_UNLIKELY(cch <= 0)) 1060 return E_UNEXPECTED; 1061 *a_pbstr = szHex; 1062 return S_OK; 1152 1063 } 1153 1064
Note:
See TracChangeset
for help on using the changeset viewer.