| 5716 | } |
| 5717 | |
| 5718 | bool WinDebugger::ParseFormatInfo(DbgModule* dbgModule, const StringImpl& formatInfoStr, DwFormatInfo* formatInfo, BfPassInstance* bfPassInstance, int* assignExprOffset, String* assignExprString, String* errorString, DbgTypedValue contextTypedValue) |
| 5719 | { |
| 5720 | String formatFlags = formatInfoStr; |
| 5721 | if (assignExprOffset != NULL) |
| 5722 | *assignExprOffset = -1; |
| 5723 | |
| 5724 | while (formatFlags.length() > 0) |
| 5725 | { |
| 5726 | formatFlags = Trim(formatFlags); |
| 5727 | if (formatFlags.IsEmpty()) |
| 5728 | break; |
| 5729 | if (formatFlags[0] != ',') |
| 5730 | { |
| 5731 | return false; |
| 5732 | } |
| 5733 | else |
| 5734 | { |
| 5735 | int nextComma = formatFlags.IndexOf(',', 1); |
| 5736 | int quotePos = formatFlags.IndexOf('"', 1); |
| 5737 | if ((quotePos != -1) && (quotePos < nextComma)) |
| 5738 | { |
| 5739 | int nextQuotePos = formatFlags.IndexOf('"', quotePos + 1); |
| 5740 | if (nextQuotePos != -1) |
| 5741 | nextComma = formatFlags.IndexOf(',', nextQuotePos + 1); |
| 5742 | } |
| 5743 | if (nextComma == -1) |
| 5744 | nextComma = formatFlags.length(); |
| 5745 | |
| 5746 | String formatCmd = formatFlags.Substring(1, nextComma - 1); |
| 5747 | formatCmd = Trim(formatCmd); |
| 5748 | bool hadError = false; |
| 5749 | |
| 5750 | if (strncmp(formatCmd.c_str(), "this=", 5) == 0) |
| 5751 | { |
| 5752 | formatCmd = formatFlags.Substring(1); |
| 5753 | formatCmd = Trim(formatCmd); |
| 5754 | String thisExpr = formatCmd.Substring(5); |
| 5755 | if (thisExpr.empty()) |
| 5756 | break; |
| 5757 | DbgEvaluationContext dbgEvaluationContext(this, dbgModule, thisExpr, formatInfo); |
| 5758 | formatInfo->mExplicitThis = dbgEvaluationContext.EvaluateInContext(contextTypedValue); |
| 5759 | if (dbgEvaluationContext.HadError()) |
| 5760 | { |
| 5761 | if (errorString != NULL) |
| 5762 | *errorString = dbgEvaluationContext.GetErrorStr(); |
| 5763 | return false; |
| 5764 | } |
| 5765 | formatFlags = thisExpr.Substring(dbgEvaluationContext.mExprNode->GetSrcEnd()); |
| 5766 | continue; |
| 5767 | } |
| 5768 | else if (strncmp(formatCmd.c_str(), "count=", 6) == 0) |
| 5769 | { |
| 5770 | formatCmd = formatFlags.Substring(1); |
| 5771 | formatCmd = Trim(formatCmd); |
| 5772 | String countExpr = formatCmd.Substring(6); |
| 5773 | if (countExpr.empty()) |
| 5774 | break; |
| 5775 | DbgEvaluationContext dbgEvaluationContext(this, dbgModule, countExpr, formatInfo); |
no test coverage detected