Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
2006-06-12 Martin Baulig <martin@ximian.com>
Browse files Browse the repository at this point in the history
	* classes/TargetVariable.cs
	(TargetVariable.IsInScope): New public abstract method.

	* classes/Method.cs
	(Method.GetVariableByName): Added `TargetAddress address' argument
	and check whether the variable is actually in scope.

	* classes/StackFrame.cs
	(StackFrame.Locals): Use `local.IsInScope()' rather than
	`local.IsAlive()'.	


svn path=/trunk/debugger/; revision=61626
  • Loading branch information
Martin Baulig committed Jun 12, 2006
1 parent 5ba9334 commit 2077f57
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
@@ -1,3 +1,16 @@
2006-06-12 Martin Baulig <martin@ximian.com>

* classes/TargetVariable.cs
(TargetVariable.IsInScope): New public abstract method.

* classes/Method.cs
(Method.GetVariableByName): Added `TargetAddress address' argument
and check whether the variable is actually in scope.

* classes/StackFrame.cs
(StackFrame.Locals): Use `local.IsInScope()' rather than
`local.IsAlive()'.

2006-06-12 Martin Baulig <martin@ximian.com>

* backends/SingleSteppingEngine.cs
Expand Down
5 changes: 5 additions & 0 deletions arch/DwarfReader.cs
Expand Up @@ -2670,6 +2670,11 @@ protected DwarfTargetVariable (DieSubprogram subprog, string name, TargetType ty
get { return type; }
}

public override bool IsInScope (TargetAddress address)
{
return true;
}

public override bool IsAlive (TargetAddress address)
{
return true;
Expand Down
4 changes: 2 additions & 2 deletions classes/Method.cs
Expand Up @@ -273,10 +273,10 @@ public static bool IsInSameMethod (Method method, TargetAddress address)
internal abstract SourceMethod GetTrampoline (TargetMemoryAccess memory,
TargetAddress address);

public TargetVariable GetVariableByName (string name)
public TargetVariable GetVariableByName (TargetAddress address, string name)
{
foreach (TargetVariable var in Locals) {
if (var.Name == name)
if ((var.Name == name) && var.IsInScope (address))
return var;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/StackFrame.cs
Expand Up @@ -283,7 +283,7 @@ internal void SetLevel (int new_level)
get {
ArrayList list = new ArrayList ();
foreach (TargetVariable local in Method.Locals) {
if (local.IsAlive (TargetAddress))
if (local.IsInScope (TargetAddress))
list.Add (local);
}
TargetVariable[] retval = new TargetVariable [list.Count];
Expand Down
3 changes: 2 additions & 1 deletion frontend/Expression.cs
Expand Up @@ -746,7 +746,8 @@ protected override Expression DoResolve (ScriptingContext context)
{
StackFrame frame = context.CurrentFrame;
if (frame.Method != null) {
TargetVariable var = frame.Method.GetVariableByName (name);
TargetVariable var = frame.Method.GetVariableByName (
frame.TargetAddress, name);
if (var != null)
return new VariableAccessExpression (var);
}
Expand Down
6 changes: 6 additions & 0 deletions languages/TargetVariable.cs
Expand Up @@ -15,6 +15,12 @@ public abstract class TargetVariable : DebuggerMarshalByRefObject
get;
}

// <summary>
// Checks whether the variable is accessible in the lexical scope around
// address @address, but without actually trying to access the variable.
// </summary>
public abstract bool IsInScope (TargetAddress address);

// <summary>
// Checks whether the variable is alive at @address, but without actually
// trying to access the variable. The implementation just checks the data
Expand Down
8 changes: 8 additions & 0 deletions languages/mono/MonoVariable.cs
Expand Up @@ -52,6 +52,9 @@ internal class MonoVariable : TargetVariable
this.info = info;
this.is_byref = is_byref;

start_scope = method.StartAddress;
end_scope = method.EndAddress;

if (info.HasLivenessInfo) {
start_liveness = method.StartAddress + info.BeginLiveness;
end_liveness = method.StartAddress + info.EndLiveness;
Expand Down Expand Up @@ -92,6 +95,11 @@ public TargetLocation GetLocation (StackFrame frame)
return null;
}

public override bool IsInScope (TargetAddress address)
{
return (address >= start_scope) && (address <= end_scope);
}

public override bool IsAlive (TargetAddress address)
{
return (address >= start_liveness) && (address <= end_liveness);
Expand Down

0 comments on commit 2077f57

Please sign in to comment.