| 1090 | } |
| 1091 | |
| 1092 | String CeDebugger::Evaluate(const StringImpl& expr, CeFormatInfo formatInfo, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags) |
| 1093 | { |
| 1094 | BP_ZONE_F("WinDebugger::Evaluate %s", BP_DYN_STR(expr.c_str())); |
| 1095 | |
| 1096 | AutoCrit autoCrit(mCeMachine->mCritSect); |
| 1097 | |
| 1098 | if ((expressionFlags & DwEvalExpressionFlag_RawStr) != 0) |
| 1099 | { |
| 1100 | formatInfo.mRawString = true; |
| 1101 | } |
| 1102 | |
| 1103 | auto ceContext = mCeMachine->mCurContext; |
| 1104 | bool valIsAddr = false; |
| 1105 | |
| 1106 | BfParser* parser = new BfParser(mCompiler->mSystem); |
| 1107 | |
| 1108 | BfPassInstance* bfPassInstance = new BfPassInstance(mCompiler->mSystem); |
| 1109 | |
| 1110 | auto parseAsType = false; |
| 1111 | |
| 1112 | auto terminatedExpr = expr; |
| 1113 | terminatedExpr.Trim(); |
| 1114 | |
| 1115 | if (terminatedExpr.StartsWith("!")) |
| 1116 | { |
| 1117 | if (terminatedExpr == "!info") |
| 1118 | { |
| 1119 | auto ceFrame = GetFrame(callStackIdx); |
| 1120 | if (ceFrame != NULL) |
| 1121 | { |
| 1122 | if (ceFrame->mFunction->mCeFunctionInfo->mMethodInstance != NULL) |
| 1123 | OutputMessage(StrFormat("Module: %s\n", ceFrame->mFunction->mCeFunctionInfo->mMethodInstance->GetOwner()->mModule->mModuleName.c_str())); |
| 1124 | OutputMessage(StrFormat("Link Name: %s\n", ceFrame->mFunction->mCeFunctionInfo->mName.c_str())); |
| 1125 | } |
| 1126 | return ""; |
| 1127 | } |
| 1128 | } |
| 1129 | |
| 1130 | if (terminatedExpr.EndsWith(">")) |
| 1131 | parseAsType = true; |
| 1132 | else if ((terminatedExpr.StartsWith("comptype(")) && (!terminatedExpr.Contains('.'))) |
| 1133 | parseAsType = true; |
| 1134 | |
| 1135 | if (!parseAsType) |
| 1136 | terminatedExpr += ";"; |
| 1137 | if ((terminatedExpr.length() > 2) && (terminatedExpr[0] == '@')) |
| 1138 | { |
| 1139 | if (terminatedExpr[1] == '!') // Return string as error |
| 1140 | { |
| 1141 | int errorEnd = (int)terminatedExpr.IndexOf("@!", 2); |
| 1142 | if (errorEnd != -1) |
| 1143 | return terminatedExpr.Substring(1, errorEnd - 1); |
| 1144 | else |
| 1145 | return terminatedExpr.Substring(1); |
| 1146 | } |
| 1147 | else if (terminatedExpr[1] == '>') // Return string as text |
| 1148 | { |
| 1149 | int errorEnd = (int)terminatedExpr.IndexOf("@>", 2); |
no test coverage detected