string IDkmLanguageInstructionDecoder.GetMethodName(DkmLanguageInstructionAddress languageInstructionAddress, DkmVariableInfoFlags argumentFlags) { try { // DkmVariableInfoFlags.FullNames was accepted by the old GetMethodName implementation, // but it was ignored. Furthermore, it's not clear what FullNames would mean with respect // to argument names in C# or Visual Basic. For consistency with the old behavior, we'll // just ignore the flag as well. Debug.Assert((argumentFlags & (DkmVariableInfoFlags.FullNames | DkmVariableInfoFlags.Names | DkmVariableInfoFlags.Types)) == argumentFlags, $"Unexpected argumentFlags '{argumentFlags}'"); var instructionAddress = (DkmClrInstructionAddress)languageInstructionAddress.Address; var compilation = _instructionDecoder.GetCompilation(instructionAddress.ModuleInstance); var method = _instructionDecoder.GetMethod(compilation, instructionAddress); var includeParameterTypes = argumentFlags.Includes(DkmVariableInfoFlags.Types); var includeParameterNames = argumentFlags.Includes(DkmVariableInfoFlags.Names); return(_instructionDecoder.GetName(method, includeParameterTypes, includeParameterNames)); } catch (NotImplementedMetadataException) { return(languageInstructionAddress.GetMethodName(argumentFlags)); } catch (Exception e) when(ExpressionEvaluatorFatalError.CrashIfFailFastEnabled(e)) { throw ExceptionUtilities.Unreachable; } }
private void GetNameWithGenericTypeArguments( DkmWorkList workList, DkmStackWalkFrame frame, Action <TMethodSymbol> onSuccess, Action <Exception> onFailure ) { // NOTE: We could always call GetClrGenericParameters, pass them to GetMethod and have that // return a constructed method symbol, but it seems unwise to call GetClrGenericParameters // for all frames (as this call requires a round-trip to the debuggee process). var instructionAddress = (DkmClrInstructionAddress)frame.InstructionAddress; var compilation = _instructionDecoder.GetCompilation(instructionAddress.ModuleInstance); var method = _instructionDecoder.GetMethod(compilation, instructionAddress); var typeParameters = _instructionDecoder.GetAllTypeParameters(method); if (!typeParameters.IsEmpty) { frame.GetClrGenericParameters( workList, result => { try { // DkmGetClrGenericParametersAsyncResult.ParameterTypeNames will throw if ErrorCode != 0. var serializedTypeNames = (result.ErrorCode == 0) ? result.ParameterTypeNames : null; var typeArguments = _instructionDecoder.GetTypeSymbols( compilation, method, serializedTypeNames ); if (!typeArguments.IsEmpty) { method = _instructionDecoder.ConstructMethod( method, typeParameters, typeArguments ); } onSuccess(method); } catch (Exception e) { onFailure(e); } } ); } else { onSuccess(method); } }
private void GetNameWithGenericTypeArguments( DkmInspectionContext inspectionContext, DkmWorkList workList, DkmStackWalkFrame frame, Action <TMethodSymbol> onSuccess, Action <Exception> onFailure) { // NOTE: We could always call GetClrGenericParameters, pass them to GetMethod and have that // return a constructed method symbol, but it seems unwise to call GetClrGenericParameters // for all frames (as this call requires a round-trip to the debuggee process). var instructionAddress = (DkmClrInstructionAddress)frame.InstructionAddress; var compilation = _instructionDecoder.GetCompilation(instructionAddress.ModuleInstance); var method = _instructionDecoder.GetMethod(compilation, instructionAddress); var typeParameters = _instructionDecoder.GetAllTypeParameters(method); if (!typeParameters.IsEmpty) { frame.GetClrGenericParameters( workList, result => { try { var typeArguments = _instructionDecoder.GetTypeSymbols(compilation, method, result.ParameterTypeNames); if (!typeArguments.IsEmpty) { method = _instructionDecoder.ConstructMethod(method, typeParameters, typeArguments); } onSuccess(method); } catch (Exception e) when(ExpressionEvaluatorFatalError.ReportNonFatalException(e, DkmComponentManager.ReportCurrentNonFatalException)) { onFailure(e); } }); } else { onSuccess(method); } }