internal TysosParameterInfo(Type param_type, int param_no, TysosMethod decl_method) { /* This is a basic implementation: tysila does not currently provide either the * parameter name or its attributes in the _Params list */ this.ClassImpl = param_type; this.PositionImpl = param_no; this.NameImpl = param_no.ToString(); this.MemberImpl = decl_method; this.DefaultValueImpl = null; this.AttrsImpl = System.Reflection.ParameterAttributes.None; }
internal ConstructorInfo(TysosMethod meth, TysosType type) { if (meth == null) { throw new Exception("libsupcs.ConstructorInfo constructor called with meth as null"); } if (type == null) { throw new Exception("libsupcs.ConstructorInfo constructor called with type as null"); } _meth = meth; _type = type; }
private void build_method_list() { System.Diagnostics.Debugger.Log(0, "libsupcs", "TysosType: building method list for " + FullName); var t = tspec; var first_mdef = ts.m.GetIntEntry(metadata.MetadataStream.tid_TypeDef, t.tdrow, 5); var last_mdef = ts.m.GetLastMethodDef(t.tdrow); var _methods = new TysosMethod[last_mdef - first_mdef]; var _first_name = new Dictionary <string, int>(new metadata.GenericEqualityComparer <string>()); var _next_name = new int[last_mdef - first_mdef]; for (int i = 0; i < last_mdef - first_mdef; i++) { _next_name[i] = -1; } var cur_idx = 0; for (var cur_mdef = first_mdef; cur_mdef < last_mdef; cur_mdef++, cur_idx++) { metadata.MethodSpec ms = new metadata.MethodSpec { type = t, mdrow = (int)cur_mdef, m = t.m, msig = (int)ts.m.GetIntEntry(metadata.MetadataStream.tid_MethodDef, (int)cur_mdef, 4) }; var cur_m = new TysosMethod(ms, this); System.Diagnostics.Debugger.Log(0, "libsupcs", "TysosType: adding method " + cur_m.Name); _methods[cur_idx] = cur_m; if (_first_name.TryGetValue(cur_m.Name, out var fn)) { while (_next_name[fn] != -1) { fn = _next_name[fn]; } _next_name[fn] = cur_idx; } else { _first_name[cur_m.Name] = cur_idx; } } if (System.Threading.Interlocked.CompareExchange(ref methods, _methods, null) == null) { first_name = _first_name; next_name = _next_name; } System.Diagnostics.Debugger.Log(0, "libsupcs", "TysosType: done building method list"); }
static System.Reflection.Assembly GetExecutingAssembly() { // Return the System.Reflection.Assembly object of the code which called this function libsupcs.Unwinder u = Program.arch.GetUnwinder(); u.UnwindOne(); libsupcs.TysosMethod prev_method = u.GetMethodInfo(); if (prev_method == null || prev_method.DeclaringType == null) { /* We don't have enough information to determine the currently executing * method (and therefore assembly), so return mscorlib instead */ return(ReinterpretAsAssembly(mscorlib_assembly)); } return(prev_method.DeclaringType.Assembly); }