Author: martin
Date: 2008-02-15 06:50:15 -0500 (Fri, 15 Feb 2008)
New Revision: 95733
Modified:
branches/martin/debugger-terrania/mcs/ChangeLog
branches/martin/debugger-terrania/mcs/codegen.cs
branches/martin/debugger-terrania/mcs/iterators.cs
branches/martin/debugger-terrania/mcs/statement.cs
branches/martin/debugger-terrania/mcs/symbolwriter.cs
Log:
2008-02-15 Martin Baulig <[EMAIL PROTECTED]>
* iterators.cs: Emit debugging info.
* codegen.cs
(EmitContext.Flags): Add `OmitDebuggingInfo'.
(EmitContext.OmitDebuggingInfo): New public property.
* statement.cs
(While): Override Emit() and don't emit symbol info there; do it
inside DoEmit() instead.
(Block.Emit): Omit symbol information while emitting the scope
initializers; don't ec.Mark() the `EndLocation'. Fix the lexical
block logic.
Modified: branches/martin/debugger-terrania/mcs/ChangeLog
===================================================================
--- branches/martin/debugger-terrania/mcs/ChangeLog 2008-02-15 11:46:57 UTC
(rev 95732)
+++ branches/martin/debugger-terrania/mcs/ChangeLog 2008-02-15 11:50:15 UTC
(rev 95733)
@@ -1,3 +1,18 @@
+2008-02-15 Martin Baulig <[EMAIL PROTECTED]>
+
+ * iterators.cs: Emit debugging info.
+
+ * codegen.cs
+ (EmitContext.Flags): Add `OmitDebuggingInfo'.
+ (EmitContext.OmitDebuggingInfo): New public property.
+
+ * statement.cs
+ (While): Override Emit() and don't emit symbol info there; do it
+ inside DoEmit() instead.
+ (Block.Emit): Omit symbol information while emitting the scope
+ initializers; don't ec.Mark() the `EndLocation'. Fix the lexical
+ block logic.
+
2008-02-02 Martin Baulig <[EMAIL PROTECTED]>
* codegen.cs
Modified: branches/martin/debugger-terrania/mcs/codegen.cs
===================================================================
--- branches/martin/debugger-terrania/mcs/codegen.cs 2008-02-15 11:46:57 UTC
(rev 95732)
+++ branches/martin/debugger-terrania/mcs/codegen.cs 2008-02-15 11:50:15 UTC
(rev 95733)
@@ -292,7 +292,9 @@
InferReturnType = 1 << 9,
- InCompoundAssignment = 1 << 10
+ InCompoundAssignment = 1 << 10,
+
+ OmitDebuggingInfo = 1 << 11
}
Flags flags;
@@ -599,6 +601,16 @@
get { return current_flow_branching; }
}
+ public bool OmitDebuggingInfo {
+ get { return (flags & Flags.OmitDebuggingInfo) != 0; }
+ set {
+ if (value)
+ flags |= Flags.OmitDebuggingInfo;
+ else
+ flags &= ~Flags.OmitDebuggingInfo;
+ }
+ }
+
// <summary>
// Starts a new code branching. This inherits the state of
all local
// variables and parameters from the current branching.
@@ -851,7 +863,7 @@
/// </summary>
public void Mark (Location loc, bool check_file)
{
- if ((CodeGen.SymbolWriter == null) || loc.IsNull)
+ if ((CodeGen.SymbolWriter == null) || OmitDebuggingInfo
|| loc.IsNull)
return;
if (check_file && (CurrentFile != loc.File))
@@ -915,7 +927,7 @@
ig.BeginScope();
if (CodeGen.SymbolWriter != null)
- CodeGen.SymbolWriter.OpenScope(ig);
+ CodeGen.SymbolWriter.OpenScope (ig);
}
public void EndScope ()
@@ -923,9 +935,21 @@
ig.EndScope();
if (CodeGen.SymbolWriter != null)
- CodeGen.SymbolWriter.CloseScope(ig);
+ CodeGen.SymbolWriter.CloseScope (ig);
}
+ public void BeginCompilerGeneratedBlock ()
+ {
+ if (CodeGen.SymbolWriter != null)
+ CodeGen.SymbolWriter.OpenCompilerGeneratedBlock
(ig);
+ }
+
+ public void EndCompilerGeneratedBlock ()
+ {
+ if (CodeGen.SymbolWriter != null)
+
CodeGen.SymbolWriter.CloseCompilerGeneratedBlock (ig);
+ }
+
/// <summary>
/// Returns a temporary storage for a variable of type t as
/// a local variable in the current body.
Modified: branches/martin/debugger-terrania/mcs/iterators.cs
===================================================================
--- branches/martin/debugger-terrania/mcs/iterators.cs 2008-02-15 11:46:57 UTC
(rev 95732)
+++ branches/martin/debugger-terrania/mcs/iterators.cs 2008-02-15 11:50:15 UTC
(rev 95733)
@@ -663,10 +663,18 @@
resume_points.Add (entry_point);
entry_point.Define (ig);
+ if (CodeGen.SymbolWriter != null)
+ CodeGen.SymbolWriter.StartIteratorBody (ec.ig);
+
original_block.Emit (ec);
EmitYieldBreak (ig);
+ if (CodeGen.SymbolWriter != null) {
+ CodeGen.SymbolWriter.EndIteratorBody (ec.ig);
+ CodeGen.SymbolWriter.StartIteratorDispatcher
(ec.ig);
+ }
+
ig.MarkLabel (dispatcher);
Label [] labels = new Label [resume_points.Count];
@@ -677,8 +685,14 @@
ig.Emit (OpCodes.Ldfld, IteratorHost.PC.FieldBuilder);
ig.Emit (OpCodes.Switch, labels);
+ if (CodeGen.SymbolWriter != null)
+ CodeGen.SymbolWriter.EndIteratorDispatcher
(ec.ig);
+
Label end = ig.DefineLabel ();
+ if (CodeGen.SymbolWriter != null)
+ CodeGen.SymbolWriter.StartIteratorDispatcher
(ec.ig);
+
ig.MarkLabel (move_next_error);
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Stloc, retval);
@@ -689,6 +703,9 @@
ig.Emit (OpCodes.Stloc, retval);
ig.Emit (OpCodes.Leave, end);
+ if (CodeGen.SymbolWriter != null)
+ CodeGen.SymbolWriter.EndIteratorDispatcher
(ec.ig);
+
ig.BeginFaultBlock ();
ig.Emit (OpCodes.Ldarg_0);
Modified: branches/martin/debugger-terrania/mcs/statement.cs
===================================================================
--- branches/martin/debugger-terrania/mcs/statement.cs 2008-02-15 11:46:57 UTC
(rev 95732)
+++ branches/martin/debugger-terrania/mcs/statement.cs 2008-02-15 11:50:15 UTC
(rev 95733)
@@ -521,6 +521,7 @@
Statement.Emit (ec);
ig.MarkLabel (ec.LoopBegin);
+ ec.Mark (loc, true);
expr.EmitBranchable (ec, while_loop, true);
@@ -531,6 +532,11 @@
ec.LoopEnd = old_end;
}
+ public override void Emit (EmitContext ec)
+ {
+ DoEmit (ec);
+ }
+
protected override void CloneTo (CloneContext clonectx,
Statement t)
{
While target = (While) t;
@@ -2286,24 +2292,38 @@
ec.CurrentBlock = this;
bool emit_debug_info = (CodeGen.SymbolWriter != null);
- bool is_lexical_block = this == Explicit && Parent !=
null;
+ bool is_lexical_block = (this == Explicit) && (Parent
!= null) &&
+ ((flags & Flags.IsIterator) == 0);
+ bool omit_debug_info = ec.OmitDebuggingInfo;
+
if (emit_debug_info) {
if (is_lexical_block)
ec.BeginScope ();
}
- ec.Mark (StartLocation, true);
+ if ((scope_init != null) || (scope_initializers !=
null)) {
+ ec.BeginCompilerGeneratedBlock ();
+ }
- if (scope_init != null)
+ if (scope_init != null) {
+ ec.OmitDebuggingInfo = true;
scope_init.EmitStatement (ec);
+ ec.OmitDebuggingInfo = omit_debug_info;
+ }
if (scope_initializers != null) {
+ ec.OmitDebuggingInfo = true;
foreach (StatementExpression s in
scope_initializers)
s.Emit (ec);
+ ec.OmitDebuggingInfo = omit_debug_info;
}
+ if ((scope_init != null) || (scope_initializers !=
null)) {
+ ec.EndCompilerGeneratedBlock ();
+ }
+
+ ec.Mark (StartLocation, true);
DoEmit (ec);
- ec.Mark (EndLocation, true);
if (emit_debug_info) {
EmitSymbolInfo (ec);
@@ -2382,6 +2402,10 @@
this.Explicit = this;
}
+ public bool IsIterator {
+ get { return (flags & Flags.IsIterator) != 0; }
+ }
+
HybridDictionary known_variables;
// <summary>
@@ -2456,10 +2480,6 @@
set { flags |= Flags.HasVarargs; }
}
- public bool IsIterator {
- get { return (flags & Flags.IsIterator) != 0; }
- }
-
//
// The parameters for the block.
//
@@ -2824,7 +2844,7 @@
{
flags |= Flags.IsIterator;
- Block block = new ExplicitBlock (this, StartLocation,
EndLocation);
+ Block block = new ExplicitBlock (this, flags,
StartLocation, EndLocation);
foreach (Statement stmt in statements)
block.AddStatement (stmt);
statements.Clear ();
Modified: branches/martin/debugger-terrania/mcs/symbolwriter.cs
===================================================================
--- branches/martin/debugger-terrania/mcs/symbolwriter.cs 2008-02-15
11:46:57 UTC (rev 95732)
+++ branches/martin/debugger-terrania/mcs/symbolwriter.cs 2008-02-15
11:50:15 UTC (rev 95733)
@@ -90,6 +90,42 @@
CloseScope (offset);
}
+ public void OpenCompilerGeneratedBlock (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ OpenCompilerGeneratedBlock (offset);
+ }
+
+ public void CloseCompilerGeneratedBlock (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ CloseCompilerGeneratedBlock (offset);
+ }
+
+ public void StartIteratorBody (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ StartIteratorBody (offset);
+ }
+
+ public void EndIteratorBody (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ EndIteratorBody (offset);
+ }
+
+ public void StartIteratorDispatcher (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ StartIteratorDispatcher (offset);
+ }
+
+ public void EndIteratorDispatcher (ILGenerator ig)
+ {
+ int offset = get_il_offset_func (ig);
+ EndIteratorDispatcher (offset);
+ }
+
public void MarkSequencePoint (ILGenerator ig, int row, int
column)
{
int offset = get_il_offset_func (ig);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches