Exemple #1
0
        /// <summary>
        /// Process any IL chunk (plugged or unplugged).
        /// </summary>
        /// <param name="aChunk">The IL chunk to process.</param>
        /// <returns>The resulting ASM chunk or null if processing failed.</returns>
        public ASMChunk ProcessILChunk(ILChunk aChunk)
        {
            ASMChunk result = null;
            //Process the chunk from IL to ASM
            if (aChunk.Plugged)
            {
                result = ProcessPluggedILChunk(aChunk);
            }
            else
            {
                result = ProcessUnpluggedILChunk(aChunk);
            }

            //Result could be null if processing failed
            if (result != null)
            {
                result.SequencePriority = aChunk.SequencePriority;

                //Add arguments info to debug database

                int argIndex = 0;
                if (TheSettings.DebugBuild)
                {
                    if (!aChunk.Method.IsStatic)
                    {
                        DB_Argument dbArgVar = new DB_Argument();
                        dbArgVar.BytesSize = Utils.GetNumBytesForType(aChunk.Method.DeclaringType);
                        dbArgVar.Id = Guid.NewGuid();
                        dbArgVar.Index = argIndex;
                        dbArgVar.TypeID = ProcessType(aChunk.Method.DeclaringType).Id;
                        dbArgVar.MethodID = TheScannerState.GetMethodID(aChunk.Method);
                        DebugDatabase.AddArgument(dbArgVar);
                        argIndex++;
                    }
                    ParameterInfo[] args = aChunk.Method.GetParameters();
                    foreach (ParameterInfo argItem in args)
                    {
                        DB_Argument dbArgVar = new DB_Argument();
                        dbArgVar.BytesSize = Utils.GetNumBytesForType(argItem.ParameterType);
                        dbArgVar.Id = Guid.NewGuid();
                        dbArgVar.Index = argIndex;
                        dbArgVar.TypeID = ProcessType(argItem.ParameterType).Id;
                        dbArgVar.MethodID = TheScannerState.GetMethodID(aChunk.Method);
                        DebugDatabase.AddArgument(dbArgVar);
                        argIndex++;
                    }
                }
                else
                {
                    //Must still process types info for release builds
                    if (!aChunk.Method.IsStatic)
                    {
                        ProcessType(aChunk.Method.DeclaringType);
                    }
                    ParameterInfo[] args = aChunk.Method.GetParameters();
                    foreach (ParameterInfo argItem in args)
                    {
                        ProcessType(argItem.ParameterType);
                    }
                }

                //Must add the return arg

                if (TheSettings.DebugBuild)
                {
                    ParameterInfo argItem = (aChunk.Method.IsConstructor || aChunk.Method is ConstructorInfo ? null : ((MethodInfo)aChunk.Method).ReturnParameter);
                    if (argItem == null)
                    {
                        //If arg item is null, then return type is void
                        //We still add info about the return value
                        //  so the debugger can make sense of what is happening
                        //  without unnecessary assumptions
                        DB_Argument dbArgVar = new DB_Argument();
                        dbArgVar.BytesSize = Utils.GetNumBytesForType(typeof(void));
                        dbArgVar.Id = Guid.NewGuid();
                        dbArgVar.Index = argIndex;
                        dbArgVar.TypeID = TheScannerState.GetTypeID(typeof(void));
                        dbArgVar.MethodID = TheScannerState.GetMethodID(aChunk.Method);
                        dbArgVar.IsReturnArg = true;
                        DebugDatabase.AddArgument(dbArgVar);
                    }
                    else
                    {
                        DB_Argument dbArgVar = new DB_Argument();
                        dbArgVar.BytesSize = Utils.GetNumBytesForType(argItem.ParameterType);
                        dbArgVar.Id = Guid.NewGuid();
                        dbArgVar.Index = argIndex;
                        dbArgVar.TypeID = ProcessType(argItem.ParameterType).Id;
                        dbArgVar.MethodID = TheScannerState.GetMethodID(aChunk.Method);
                        dbArgVar.IsReturnArg = true;
                        DebugDatabase.AddArgument(dbArgVar);
                    }
                }
                else
                {
                    ParameterInfo argItem = (aChunk.Method.IsConstructor || aChunk.Method is ConstructorInfo ? null : ((MethodInfo)aChunk.Method).ReturnParameter);
                    if (argItem != null)
                    {
                        ProcessType(argItem.ParameterType);
                    }
                }
            }

            return result;
        }
Exemple #2
0
 partial void DeleteDB_Argument(DB_Argument instance);
Exemple #3
0
		private void detach_DB_Arguments(DB_Argument entity)
		{
			this.SendPropertyChanging();
			entity.DB_Method = null;
		}
Exemple #4
0
 partial void UpdateDB_Argument(DB_Argument instance);
Exemple #5
0
 partial void InsertDB_Argument(DB_Argument instance);
Exemple #6
0
		private void attach_DB_Arguments(DB_Argument entity)
		{
			this.SendPropertyChanging();
			entity.DB_Type = this;
		}
Exemple #7
0
 /// <summary>
 /// Removes the specified argument from the database.
 /// <para>To Do's: See <see cref="RemoveMethod"/>'s to do's.</para>
 /// </summary>
 /// <param name="aArgument">The entry to remove.</param>
 /// <remarks>
 /// <para>
 /// For the moment this method does no more than just directly remove
 /// the entry from the database.
 /// </para>
 /// <para>
 /// <see cref="SubmitChanges"/> must be called at some point after this
 /// method for changes to actually be submitted to the database.
 /// </para>
 /// </remarks>
 public static void RemoveArgument(DB_Argument aArgument)
 {
     DB.DB_Arguments.DeleteOnSubmit(aArgument);
 }
Exemple #8
0
 /// <summary>
 /// Adds the pre-created argument to the database. All the entries's
 /// required parameters (i.e. ones which cannot be null) should 
 /// be set.
 /// <para>To Do's: See <see cref="AddMethod"/>'s to do's.</para>
 /// </summary>
 /// <param name="aArgument">The entry to add.</param>
 /// <remarks>
 /// <para>
 /// For the moment this method does no more than just directly add
 /// the entry to the database.
 /// </para>
 /// <para>
 /// <see cref="SubmitChanges"/> must be called at some point after this
 /// method for changes to actually be submitted to the database.
 /// </para>
 /// </remarks>
 public static void AddArgument(DB_Argument aArgument)
 {
     DB.DB_Arguments.InsertOnSubmit(aArgument);
 }