diff options
Diffstat (limited to 'mcs/ilasm')
-rw-r--r-- | mcs/ilasm/codegen/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/ilasm/codegen/DebuggingInfo.cs | 3 | ||||
-rw-r--r-- | mcs/ilasm/codegen/MethodDef.cs | 22 |
3 files changed, 29 insertions, 1 deletions
diff --git a/mcs/ilasm/codegen/ChangeLog b/mcs/ilasm/codegen/ChangeLog index adec9cb0889..e22d54e9b42 100644 --- a/mcs/ilasm/codegen/ChangeLog +++ b/mcs/ilasm/codegen/ChangeLog @@ -1,3 +1,8 @@ +2008-04-07 Erven Rohou <erven.rohou@st.com> + + * DebugInfo.cs, MethodDef.cs: Add support for emitting variable names + in mdb file. + 2008-02-07 Gert Driesen <drieseng@users.sourceforge.net> * CodeGen.cs: Use original filename as base name for debug file. diff --git a/mcs/ilasm/codegen/DebuggingInfo.cs b/mcs/ilasm/codegen/DebuggingInfo.cs index 23fcac2b771..8c87559bb52 100644 --- a/mcs/ilasm/codegen/DebuggingInfo.cs +++ b/mcs/ilasm/codegen/DebuggingInfo.cs @@ -108,9 +108,10 @@ namespace Mono.ILASM { lines.CopyTo (lne); uint token = ((uint) PEAPI.MDTable.Method << 24) | pemethod.Row; + LocalVariableEntry[] locals = method.GetLocalVars(); file.DefineMethod ( - method.Name, (int) token, null, lne, null, + method.Name, (int) token, locals, lne, null, StartLine, EndLine, 0); } } diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs index 152113cc418..1478f01b1ff 100644 --- a/mcs/ilasm/codegen/MethodDef.cs +++ b/mcs/ilasm/codegen/MethodDef.cs @@ -13,6 +13,8 @@ using System.Text; using System.Collections; using System.Security; +using Mono.CompilerServices.SymbolWriter; + namespace Mono.ILASM { public class MethodDef : ICustomAttrTarget, IDeclSecurityTarget { @@ -48,12 +50,14 @@ namespace Mono.ILASM { private TypeDef type_def; private GenericParameters gen_params; private Location start; + private CodeGen codegen; public MethodDef (CodeGen codegen, PEAPI.MethAttr meth_attr, PEAPI.CallConv call_conv, PEAPI.ImplAttr impl_attr, string name, BaseTypeRef ret_type, ArrayList param_list, Location start, GenericParameters gen_params, TypeDef type_def) { + this.codegen = codegen; this.meth_attr = meth_attr; this.call_conv = call_conv; this.impl_attr = impl_attr; @@ -258,6 +262,24 @@ namespace Mono.ILASM { return pos; } + public LocalVariableEntry[] GetLocalVars() + { + System.IO.MemoryStream str = new System.IO.MemoryStream(); + int i = 0; + int num_locals = named_local_table.Count; + LocalVariableEntry[] locals = new LocalVariableEntry[num_locals]; + + foreach (Local local in local_list) { + if (local.Name != null) { // only named variables + PEAPI.Local plocal = local.GetPeapiLocal(codegen); + byte[] sig = plocal.TypeSig(); + locals[i++] = new LocalVariableEntry(local.Slot, local.Name, sig, 0); + } + } + return locals; + } + + /* index - 0: return type * 1: params start from this */ |