| 2829 | } |
| 2830 | |
| 2831 | String CeDebugger::TypedValueToString(const BfTypedValue& origTypedValue, const StringImpl& expr, CeFormatInfo& formatInfo, bool fullPrecision, CeTypeModKind typeModKind) |
| 2832 | { |
| 2833 | BfTypedValue typedValue = origTypedValue; |
| 2834 | |
| 2835 | auto module = mCeMachine->mCeModule; |
| 2836 | |
| 2837 | String retVal; |
| 2838 | if (typedValue.IsNoValueType()) |
| 2839 | { |
| 2840 | String typeName = TypeToString(typedValue); |
| 2841 | |
| 2842 | retVal += typeName; |
| 2843 | retVal += "\n"; |
| 2844 | retVal += typeName; |
| 2845 | retVal += "\n"; |
| 2846 | retVal += GetMemberList(typedValue.mType, 0, 0, true); |
| 2847 | return retVal; |
| 2848 | } |
| 2849 | |
| 2850 | auto constant = module->mBfIRBuilder->GetConstant(typedValue.mValue); |
| 2851 | auto ceContext = mCeMachine->mCurContext; |
| 2852 | if (constant == NULL) |
| 2853 | { |
| 2854 | return "!Invalid expression"; |
| 2855 | } |
| 2856 | |
| 2857 | bool didAlloc = false; |
| 2858 | addr_ce addr = 0; |
| 2859 | |
| 2860 | defer( |
| 2861 | { |
| 2862 | if (didAlloc) |
| 2863 | mCurDbgState->mCeContext->CeFree(addr); |
| 2864 | } |
| 2865 | ); |
| 2866 | |
| 2867 | if (constant->mConstType == BfConstType_AggCE) |
| 2868 | { |
| 2869 | auto aggCE = (BfConstantAggCE*)constant; |
| 2870 | addr = aggCE->mCEAddr; |
| 2871 | } |
| 2872 | else if ((typedValue.IsAddr()) || (typedValue.mType->IsObjectOrInterface()) || (typedValue.mType->IsPointer())) |
| 2873 | { |
| 2874 | CeTypedValue typedVal = GetAddr(constant, typedValue.mType); |
| 2875 | addr = (addr_ce)typedVal.mAddr; |
| 2876 | if (!typedVal) |
| 2877 | { |
| 2878 | return "!Invalid addr type"; |
| 2879 | } |
| 2880 | } |
| 2881 | else |
| 2882 | { |
| 2883 | int allocSize = typedValue.mType->mSize; |
| 2884 | auto typeInst = typedValue.mType->ToTypeInstance(); |
| 2885 | if (typeInst != NULL) |
| 2886 | allocSize = typeInst->mInstSize; |
| 2887 | if (allocSize < 0) |
| 2888 | return "!Invalid size"; |
nothing calls this directly
no test coverage detected