Browse Source

Removed the IMutable interface which propagated notifications about value changes.

It do not provide 100% guarantee of notification.  For example:
 - If the user obtained a reference to same value from two places (eg classA.someInt and classB.someInt where classA == classB) then change in one place did not trigger notification in the other.  
 - Changing of the backing value for a property would not change the property.

Idea for better system (if it is needed in the future):
Each value refers to some memory range (eg reference it is 4 byte pointer in memory;  string is value on heap).
Whenever a debugger is resumed all bets are off and anything could have changed.  
Other then that value changes if and only if its memory range is modified by the user.
Expression as a whole changes whenever any of the values involved changes;  if method call or property is involved then the whole expression may change when any memory is modified.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2772 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
cb3e8cc8fb
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs
  2. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj
  3. 11
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebugeeState.cs
  4. 16
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/IMutable.cs
  5. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs
  6. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  7. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs
  8. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs
  9. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs
  10. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs
  11. 1
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Primitive.cs
  12. 31
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Variables/ValueItem.cs

@ -138,8 +138,6 @@ namespace Debugger
public ValueItem(Value val) public ValueItem(Value val)
{ {
this.val = val; this.val = val;
val.Changed += delegate { OnChanged(new ListItemEventArgs(this)); };
} }
public override bool SetText(string newValue) public override bool SetText(string newValue)

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj

@ -55,7 +55,6 @@
<Compile Include="Src\Debugger\ExceptionEventArgs.cs" /> <Compile Include="Src\Debugger\ExceptionEventArgs.cs" />
<Compile Include="Src\Debugger\Exceptions.cs" /> <Compile Include="Src\Debugger\Exceptions.cs" />
<Compile Include="Src\Debugger\IExpirable.cs" /> <Compile Include="Src\Debugger\IExpirable.cs" />
<Compile Include="Src\Debugger\IMutable.cs" />
<Compile Include="Src\Debugger\Internal\ManagedCallback.cs" /> <Compile Include="Src\Debugger\Internal\ManagedCallback.cs" />
<Compile Include="Src\Debugger\Internal\ManagedCallbackProxy.cs" /> <Compile Include="Src\Debugger\Internal\ManagedCallbackProxy.cs" />
<Compile Include="Src\Debugger\Internal\ManagedCallbackSwitch.cs" /> <Compile Include="Src\Debugger\Internal\ManagedCallbackSwitch.cs" />

11
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/DebugeeState.cs

@ -13,22 +13,13 @@ namespace Debugger
/// Unique identifier of the state of the debugee. /// Unique identifier of the state of the debugee.
/// Changes when debuggee is stepped, but not when properity is evaluated. /// Changes when debuggee is stepped, but not when properity is evaluated.
/// </summary> /// </summary>
public class DebugeeState: IExpirable, IMutable public class DebugeeState: IExpirable
{ {
Process process; Process process;
bool hasExpired = false; bool hasExpired = false;
public event EventHandler Expired; public event EventHandler Expired;
public event EventHandler<ProcessEventArgs> Changed {
add {
process.DebuggeeStateChanged += value;
}
remove {
process.DebuggeeStateChanged -= value;
}
}
[Debugger.Tests.Ignore] [Debugger.Tests.Ignore]
public Process Process { public Process Process {
get { get {

16
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/IMutable.cs

@ -1,16 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
// <version>$Revision$</version>
// </file>
using System;
namespace Debugger
{
public interface IMutable
{
event EventHandler<ProcessEventArgs> Changed;
}
}

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Exception.cs

@ -40,7 +40,6 @@ namespace Debugger
string.Empty, string.Empty,
Expression.Empty, Expression.Empty,
new IExpirable[] {process.PauseSession}, new IExpirable[] {process.PauseSession},
new IMutable[] {},
delegate { return corValue; } ); delegate { return corValue; } );
message = runtimeValue.GetMember("_message").AsString; message = runtimeValue.GetMember("_message").AsString;

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -442,7 +442,6 @@ namespace Debugger
"this", "this",
new Ast.ThisReferenceExpression(), new Ast.ThisReferenceExpression(),
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {},
delegate { return ThisCorValue; } delegate { return ThisCorValue; }
); );
} }
@ -512,7 +511,6 @@ namespace Debugger
name, name,
new Ast.ParameterIdentifierExpression(index, name), new Ast.ParameterIdentifierExpression(index, name),
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {process.DebugeeState},
delegate { return GetArgumentCorValue(index); } delegate { return GetArgumentCorValue(index); }
); );
} }
@ -604,7 +602,6 @@ namespace Debugger
symVar.Name, symVar.Name,
new Ast.LocalVariableIdentifierExpression(symVar), new Ast.LocalVariableIdentifierExpression(symVar),
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {process.DebugeeState},
delegate { return GetCorValueOfLocalVariable(symVar); } delegate { return GetCorValueOfLocalVariable(symVar); }
); );
} }

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Thread.cs

@ -169,7 +169,6 @@ namespace Debugger
string.Empty, string.Empty,
Expression.Empty, Expression.Empty,
new IExpirable[] {process.PauseSession}, new IExpirable[] {process.PauseSession},
new IMutable[] {},
delegate { return CorThread.Object;} delegate { return CorThread.Object;}
); );
} }

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Evals/Eval.cs

@ -236,7 +236,6 @@ namespace Debugger
string.Empty, string.Empty,
Expression.Empty, Expression.Empty,
new IExpirable[] {}, new IExpirable[] {},
new IMutable[] {},
delegate { return corEval.Result; }); delegate { return corEval.Result; });
} }
} }

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Array.cs

@ -81,7 +81,6 @@ namespace Debugger
GetNameFromIndices(indices), GetNameFromIndices(indices),
GetExpressionFromIndices(indices), GetExpressionFromIndices(indices),
new IExpirable[] {this}, new IExpirable[] {this},
new IMutable[] {this},
delegate { return GetCorValueOfArrayElement(indices); } delegate { return GetCorValueOfArrayElement(indices); }
); );
} }

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Object.cs

@ -57,7 +57,6 @@ namespace Debugger
fieldInfo fieldInfo
), ),
new IExpirable[] {objectInstance}, new IExpirable[] {objectInstance},
new IMutable[] {objectInstance},
delegate { return GetFieldCorValue(objectInstance, fieldInfo); } delegate { return GetFieldCorValue(objectInstance, fieldInfo); }
); );
} }
@ -125,7 +124,6 @@ namespace Debugger
propertyInfo propertyInfo
), ),
dependencies.ToArray(), dependencies.ToArray(),
dependencies.ToArray(),
delegate { return Value.InvokeMethod(objectInstance, propertyInfo.GetMethod, arguments).RawCorValue; } delegate { return Value.InvokeMethod(objectInstance, propertyInfo.GetMethod, arguments).RawCorValue; }
); );
} }

1
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.Primitive.cs

@ -69,7 +69,6 @@ namespace Debugger
} else { } else {
CorGenericValue.Value = newValue; CorGenericValue.Value = newValue;
} }
NotifyChange();
} }
} }
} }

31
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Values/Value.cs

@ -34,7 +34,7 @@ namespace Debugger
/// called and internal value is neutred, new copy will be obatined) /// called and internal value is neutred, new copy will be obatined)
/// </para> /// </para>
/// </remarks> /// </remarks>
public partial class Value: DebuggerObject, IExpirable, IMutable public partial class Value: DebuggerObject, IExpirable
{ {
string name; string name;
Process process; Process process;
@ -45,9 +45,6 @@ namespace Debugger
/// <summary> Occurs when the Value can not be used anymore </summary> /// <summary> Occurs when the Value can not be used anymore </summary>
public event EventHandler Expired; public event EventHandler Expired;
/// <summary> Occurs when the Value have potentialy changed </summary>
public event EventHandler<ProcessEventArgs> Changed;
bool isExpired = false; bool isExpired = false;
ValueCache cache; ValueCache cache;
@ -181,7 +178,6 @@ namespace Debugger
string name, string name,
Expression expression, Expression expression,
IExpirable[] expireDependencies, IExpirable[] expireDependencies,
IMutable[] mutateDependencies,
CorValueGetter corValueGetter) CorValueGetter corValueGetter)
{ {
this.name = name; this.name = name;
@ -202,10 +198,6 @@ namespace Debugger
AddExpireDependency(exp); AddExpireDependency(exp);
} }
foreach(IMutable mut in mutateDependencies) {
AddMutateDependency(mut);
}
this.corValueGetter = corValueGetter; this.corValueGetter = corValueGetter;
} }
@ -226,27 +218,6 @@ namespace Debugger
} }
} }
void AddMutateDependency(IMutable dependency)
{
dependency.Changed += delegate { NotifyChange(); };
}
internal void NotifyChange()
{
cache = null;
if (!isExpired) {
OnChanged(new ValueEventArgs(this));
}
}
/// <summary> Is called when the value changes </summary>
protected virtual void OnChanged(ProcessEventArgs e)
{
if (Changed != null) {
Changed(this, e);
}
}
/// <summary> Is called when the value expires and can not be /// <summary> Is called when the value expires and can not be
/// used anymore </summary> /// used anymore </summary>
protected virtual void OnExpired(EventArgs e) protected virtual void OnExpired(EventArgs e)

Loading…
Cancel
Save