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

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

@ -55,7 +55,6 @@ @@ -55,7 +55,6 @@
<Compile Include="Src\Debugger\ExceptionEventArgs.cs" />
<Compile Include="Src\Debugger\Exceptions.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\ManagedCallbackProxy.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 @@ -13,22 +13,13 @@ namespace Debugger
/// Unique identifier of the state of the debugee.
/// Changes when debuggee is stepped, but not when properity is evaluated.
/// </summary>
public class DebugeeState: IExpirable, IMutable
public class DebugeeState: IExpirable
{
Process process;
bool hasExpired = false;
public event EventHandler Expired;
public event EventHandler<ProcessEventArgs> Changed {
add {
process.DebuggeeStateChanged += value;
}
remove {
process.DebuggeeStateChanged -= value;
}
}
[Debugger.Tests.Ignore]
public Process Process {
get {

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

@ -1,16 +0,0 @@ @@ -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 @@ -40,7 +40,6 @@ namespace Debugger
string.Empty,
Expression.Empty,
new IExpirable[] {process.PauseSession},
new IMutable[] {},
delegate { return corValue; } );
message = runtimeValue.GetMember("_message").AsString;

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

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

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

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

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

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

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

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

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

@ -57,7 +57,6 @@ namespace Debugger @@ -57,7 +57,6 @@ namespace Debugger
fieldInfo
),
new IExpirable[] {objectInstance},
new IMutable[] {objectInstance},
delegate { return GetFieldCorValue(objectInstance, fieldInfo); }
);
}
@ -125,7 +124,6 @@ namespace Debugger @@ -125,7 +124,6 @@ namespace Debugger
propertyInfo
),
dependencies.ToArray(),
dependencies.ToArray(),
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 @@ -69,7 +69,6 @@ namespace Debugger
} else {
CorGenericValue.Value = newValue;
}
NotifyChange();
}
}
}

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

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

Loading…
Cancel
Save