public byte[] GetSymAttribute(SymbolToken parent, string name) { uint bufSize; reader.GetSymAttribute((uint)parent.GetToken(), name, 0, out bufSize, null); var buffer = new byte[bufSize]; reader.GetSymAttribute((uint)parent.GetToken(), name, (uint)buffer.Length, out bufSize, buffer); return buffer; }
public ISymbolVariable[] GetVariables(SymbolToken parent) { uint numVars; reader.GetVariables((uint)parent.GetToken(), 0, out numVars, null); var unVars = new ISymUnmanagedVariable[numVars]; reader.GetVariables((uint)parent.GetToken(), (uint)unVars.Length, out numVars, unVars); var vars = new ISymbolVariable[numVars]; for (uint i = 0; i < numVars; i++) vars[i] = new SymbolVariable(unVars[i]); return vars; }
public byte[] GetSymAttribute(SymbolToken parent, string name) { int buffSize; HRESULT.ThrowOnFailure(_unmanaged.GetSymAttribute(parent.GetToken(), name, 0, out buffSize, null)); byte[] buff = new byte[buffSize]; HRESULT.ThrowOnFailure(_unmanaged.GetSymAttribute(parent.GetToken(), name, buff.Length, out buffSize, buff)); return(buff); }
public void DefineField(SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3) { HRESULT.ThrowOnFailure(_unmanaged.DefineField( parent.GetToken(), name, (int)attributes, signature.Length, signature, (int)addrKind, addr1, addr2, addr3)); }
public void Ctor_Value(int value) { var symbolToken = new SymbolToken(value); Assert.Equal(value, symbolToken.GetToken()); Assert.Equal(value, symbolToken.GetHashCode()); }
// Write out a reference to the entry point method (if one exists) private void WriteEntryPoint(ISymbolReader reader) { // If there is no entry point token (such as in a dll), this will throw. SymbolToken token = reader.UserEntryPoint; if (token.GetToken() == 0) { // If the Symbol APIs fail when looking for an entry point token, there is no entry point. m_writer.WriteComment( "There is no entry point token such as a 'Main' method. This module is probably a '.dll'"); return; } ISymbolMethod m = reader.GetMethod(token); Debug.Assert(m != null); // would have thrown by now. // Should not throw past this point m_writer.WriteComment( "This is the token for the 'entry point' method, which is the method that will be called when the assembly is loaded." + " This usually corresponds to 'Main'"); m_writer.WriteStartElement("EntryPoint"); WriteMethod(m); m_writer.WriteEndElement(); }
public ISymbolMethod GetMethod(SymbolToken method) { ISymUnmanagedMethod unmanagedMethod; HRESULT.ThrowOnFailure(_unmanaged.GetMethod(method.GetToken(), out unmanagedMethod)); return(new SymbolMethod(unmanagedMethod)); }
public ISymbolMethod GetMethod(SymbolToken method) { SymbolMethod result = null; methodTokenLookup.TryGetValue(method.GetToken(), out result); return(result); }
public ISymbolMethod GetMethod(SymbolToken method, int version) { ISymUnmanagedMethod unMethod; int hr = reader.GetMethodByVersion((uint)method.GetToken(), version, out unMethod); if (hr == E_FAIL) return null; Marshal.ThrowExceptionForHR(hr); return unMethod == null ? null : new SymbolMethod(unMethod); }
//------------------------------------------------------------------------------ // SetSymAttribute() wrapper //------------------------------------------------------------------------------ void ISymbolWriter.SetSymAttribute(SymbolToken parent, string name, byte[] data) { int hr = m_vtable.SetSymAttribute(m_pWriter, parent.GetToken(), name, data.Length, data); if (hr < 0) { throw Marshal.GetExceptionForHR(hr) !; } }
//------------------------------------------------------------------------------ // OpenMethod() wrapper //------------------------------------------------------------------------------ void ISymbolWriter.OpenMethod(SymbolToken method) { int hr = m_vtable.OpenMethod(m_pWriter, method.GetToken()); if (hr < 0) { throw Marshal.GetExceptionForHR(hr) !; } }
[System.Security.SecurityCritical] // auto-generated #endif void ISymbolWriter.SetUserEntryPoint(SymbolToken entryMethod) { int hr = m_vtable.SetUserEntryPoint(m_pWriter, entryMethod.GetToken()); if (hr < 0) { throw Marshal.GetExceptionForHR(hr); } }
public ISymbolVariable[] GetVariables(SymbolToken parent) { int varCount; HRESULT.ThrowOnFailure(_unmanaged.GetVariables(parent.GetToken(), 0, out varCount, null)); var unmanagedVars = new ISymUnmanagedVariable[varCount]; HRESULT.ThrowOnFailure(_unmanaged.GetVariables(parent.GetToken(), unmanagedVars.Length, out varCount, unmanagedVars)); var variables = new ISymbolVariable[varCount]; for (int i = 0; i < varCount; i++) { variables[i] = new SymbolVariable(unmanagedVars[i]); } return(variables); }
ISymbolMethod ISymbolReader.GetMethod(SymbolToken method) { DbiFunction symMethod; if (functions.TryGetValue((uint)method.GetToken(), out symMethod)) { return(symMethod); } return(null); }
public ISymbolMethod GetMethod(SymbolToken method) { ISymUnmanagedMethod unMethod; int hr = reader.GetMethod((uint)method.GetToken(), out unMethod); if (hr == E_FAIL) { return(null); } Marshal.ThrowExceptionForHR(hr); return(unMethod == null ? null : new SymbolMethod(unMethod)); }
int ISymUnmanagedReader.GetSymAttribute(SymbolToken token, string name, int bytesDesired, out int bytesRead, byte[] buffer) { Assert.Equal("MD2", name); MethodDebugInfo info; if (!_methodDebugInfoMap.TryGetValue(token.GetToken(), out info)) { bytesRead = 0; return(SymUnmanagedReaderExtensions.S_FALSE); // This is a guess. We're not consuming it, so it doesn't really matter. } Assert.NotNull(info); info.Bytes.TwoPhaseCopy(bytesDesired, out bytesRead, buffer); return(SymUnmanagedReaderExtensions.S_OK); }
int ISymUnmanagedReader.GetMethodByVersion(SymbolToken methodToken, int version, out ISymUnmanagedMethod retVal) { Assert.Equal(1, version); MethodDebugInfo info; if (!_methodDebugInfoMap.TryGetValue(methodToken.GetToken(), out info)) { retVal = null; return(SymUnmanagedReaderExtensions.E_FAIL); } Assert.NotNull(info); retVal = info.Method; return(SymUnmanagedReaderExtensions.S_OK); }
public RuntimeValue CallMemberFunction(RuntimeThread thread, SymbolToken token, params RuntimeValue[] arguments) { ICorDebugFunction comFunction; ComObjectValue.GetVirtualMethod((uint)token.GetToken(), out comFunction); var evaluation = thread.CreateEvaluation(); evaluation.Call(comFunction, arguments.GetComValues().ToArray()); if (evaluation.WaitForResult(1000)) { return(evaluation.Result); } throw new TimeoutException("Evaluation timed out."); }
// Write out a reference to the entry point method (if one exists) private void WriteEntryPoint(ISymbolReader reader) { // If there is no entry point token (such as in a dll), this will throw. SymbolToken token = reader.UserEntryPoint; if (token.GetToken() == 0) { // If the Symbol APIs fail when looking for an entry point token, there is no entry point. return; } ISymbolMethod m = reader.GetMethod(token); xmlWriter.WriteStartElement("entryPoint"); WriteMethod(m); xmlWriter.WriteEndElement(); // </entryPoint> }
byte[] ISymbolReader.GetSymAttribute(SymbolToken parent, string name) { DbiFunction func; bool b = functions.TryGetValue((uint)parent.GetToken(), out func); Debug.Assert(b); if (!b) { return(emptyByteArray); } var res = func.Root.GetSymAttribute(name); if (res == null) { return(emptyByteArray); } return(res); }
public RuntimeValue GetFieldValue(RuntimeThread thread, SymbolToken token) { // TODO: static members if (!IsObject) { throw new InvalidOperationException("Value must be an object in order to get values of fields."); } RuntimeValue value; if (!_fieldValues.TryGetValue(token, out value)) { ICorDebugValue comValue; ComObjectValue.GetFieldValue(Type.Class.ComClass, (uint)token.GetToken(), out comValue); _fieldValues.Add(token, value = new RuntimeValue(Session, comValue)); } return(value); }
public void SetSymAttribute(SymbolToken parent, string name, byte[] data) { writer.SetSymAttribute((uint)parent.GetToken(), name, (uint)data.Length, data); }
public void OpenMethod(SymbolToken method) { currentToken = method.GetToken(); }
public void OpenMethod(SymbolToken method) { currentToken = method.GetToken (); }
public void SetUserEntryPoint(SymbolToken entryMethod) { HRESULT.ThrowOnFailure(_unmanaged.SetUserEntryPoint(entryMethod.GetToken())); }
public void OpenMethod(SymbolToken method) { writer.OpenMethod((uint)method.GetToken()); }
public void Ctor_Default() { var symbolToken = new SymbolToken(); Assert.Equal(0, symbolToken.GetToken()); }
public void DefineField(SymbolToken parent, string name, System.Reflection.FieldAttributes attributes, byte[] signature, SymAddressKind addrKind, int addr1, int addr2, int addr3) { writer.DefineField((uint)parent.GetToken(), name, (uint)attributes, (uint)signature.Length, signature, (uint)addrKind, (uint)addr1, (uint)addr2, (uint)addr3); }
public void SetUserEntryPoint(SymbolToken entryMethod) { writer.SetUserEntryPoint((uint)entryMethod.GetToken()); }
protected override Token CreateToken(string literal) { return(SymbolToken.GetToken(literal)); }
public void SetSymAttribute(SymbolToken parent, string name, byte[] data) { HRESULT.ThrowOnFailure(_unmanaged.SetSymAttribute( parent.GetToken(), name, data.Length, data)); }