Author: martin
Date: 2008-02-11 03:03:27 -0500 (Mon, 11 Feb 2008)
New Revision: 95426
Modified:
branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
branches/martin/debugger-terrania/debugger/test/src/TestAnonymous.cs
branches/martin/debugger-terrania/debugger/test/testsuite/TestAnonymous.cs
Log:
Reflect latest symbol writer changes.
Modified:
branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
2008-02-11 08:02:59 UTC (rev 95425)
+++ branches/martin/debugger-terrania/debugger/languages/mono/MonoSymbolFile.cs
2008-02-11 08:03:27 UTC (rev 95426)
@@ -955,6 +955,7 @@
MonoVariable this_var;
List<TargetVariable> parameters;
List<TargetVariable> locals;
+ Dictionary<int,ScopeInfo> scopes;
bool has_variables;
bool is_loaded;
MethodAddress address;
@@ -1022,6 +1023,7 @@
locals = new List<TargetVariable> ();
parameters = new List<TargetVariable> ();
+ scopes = new Dictionary<int,ScopeInfo> ();
var captured_vars = new
Dictionary<string,CapturedVariable> ();
@@ -1030,46 +1032,43 @@
"this", decl_type, true, true,
this,
address.ThisVariableInfo);
- Dictionary<int,ScopeInfo> scopes = new
Dictionary<int,ScopeInfo> ();
+ var scope_list = new List<ScopeInfo> ();
- for (int i = 0; i < method.NumAnonymousScopes;
i++) {
- C.AnonymousScope scope =
method.AnonymousScopes [i];
+ for (int i = 0; i < method.NumScopeVariables;
i++) {
+ C.ScopeVariable sv =
method.ScopeVariables [i];
- if (scope.Parent >= 0) {
- ScopeInfo parent = scopes
[scope.Parent];
- string fname = String.Format (
- "<{0}:scope{1}>",
parent.ID, scope.ID);
-
- CapturedVariable pvar = new
CapturedVariable (
- parent, this, fname,
fname);
- scopes.Add (scope.ID, new
ScopeInfo (scope.ID, pvar));
- continue;
- }
-
VariableInfo var;
- if (scope.Index < 0)
+ if (sv.Index < 0)
var = address.ThisVariableInfo;
else
- var = address.LocalVariableInfo
[scope.Index];
+ var = address.LocalVariableInfo
[sv.Index];
TargetStructType type =
mono.ReadStructType (memory, var.MonoType);
MonoVariable scope_var = new
MonoVariable (
- "$__" + scope.ID, type, true,
type.IsByRef, this, var);
- scopes.Add (scope.ID, new ScopeInfo
(scope.ID, scope_var, type));
+ "$__" + sv.Scope, type, true,
type.IsByRef, this, var);
+
+ ScopeInfo info = new ScopeInfo
(sv.Scope, scope_var, type);
+ scopes.Add (sv.Scope, info);
+
+ scope_list.Add (info);
}
- for (int i = 0; i <
method.NumCapturedVariables; i++) {
- C.CapturedVariable captured =
method.CapturedVariables [i];
- ScopeInfo scope = scopes
[captured.Scope];
+ foreach (ScopeInfo scope in scope_list) {
+ read_scope (scope);
+ }
- CapturedVariable cv = new
CapturedVariable (
- scope, this, captured.Name,
captured.CapturedName);
- if (captured.IsLocal)
- locals.Add (cv);
- else
- parameters.Add (cv);
+ foreach (ScopeInfo scope in scopes.Values) {
+ C.AnonymousScopeEntry entry =
file.File.GetAnonymousScope (scope.ID);
+ foreach (C.CapturedVariable captured in
entry.CapturedVariables) {
+ CapturedVariable cv = new
CapturedVariable (
+ scope, this,
captured.Name, captured.CapturedName);
+ if (captured.IsLocal)
+ locals.Add (cv);
+ else
+ parameters.Add (cv);
- captured_vars.Add (captured.Name, cv);
+ captured_vars.Add
(captured.Name, cv);
+ }
}
Cecil.ParameterDefinitionCollection param_info
= mdef.Parameters;
@@ -1127,6 +1126,22 @@
});
}
+ void read_scope (ScopeInfo scope)
+ {
+ C.AnonymousScopeEntry entry =
file.File.GetAnonymousScope (scope.ID);
+ foreach (C.CapturedScope captured in
entry.CapturedScopes) {
+ if (scopes.ContainsKey (captured.Scope))
+ continue;
+
+ CapturedVariable pvar = new
CapturedVariable (
+ scope, this,
captured.CapturedName, captured.CapturedName);
+ ScopeInfo child = new ScopeInfo
(captured.Scope, pvar);
+
+ scopes.Add (captured.Scope, child);
+ read_scope (child);
+ }
+ }
+
public override TargetVariable[] GetParameters (Thread
target)
{
read_variables (target);
@@ -1398,6 +1413,11 @@
base.DumpLineNumbers ();
Console.WriteLine ();
+ Console.WriteLine ("Method: {0} - {1} {2} - {3}
{4}",
+ method.Name,
method.StartAddress, method.EndAddress,
+ method.MethodStartAddress,
method.MethodEndAddress);
+
+ Console.WriteLine ();
Console.WriteLine ("Symfile Line Numbers:");
Console.WriteLine ("---------------------");
@@ -1420,6 +1440,18 @@
lne.Address,
method.StartAddress + lne.Address);
}
Console.WriteLine ("-----------------");
+
+ Console.WriteLine ();
+ Console.WriteLine ("Generated Lines:");
+ Console.WriteLine ("----------------");
+ for (int i = 0; i < Data.Addresses.Length; i++)
{
+ LineEntry entry = (LineEntry)
Data.Addresses [i];
+
+ Console.WriteLine ("{0,4} {1,4}
{2,4:x}", i, entry.Line,
+ entry.Address);
+ }
+ Console.WriteLine ("----------------");
+
}
}
Modified: branches/martin/debugger-terrania/debugger/test/src/TestAnonymous.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/src/TestAnonymous.cs
2008-02-11 08:02:59 UTC (rev 95425)
+++ branches/martin/debugger-terrania/debugger/test/src/TestAnonymous.cs
2008-02-11 08:03:27 UTC (rev 95426)
@@ -60,6 +60,7 @@
Hello (u); // @MDB
BREAKPOINT: test2
Foo foo = delegate {
Hello (u); // @MDB
LINE: test2 foo
+ Hello (t);
};
foo (); // @MDB
BREAKPOINT: test2 after foo
Hello (u);
@@ -90,6 +91,7 @@
Hello (t); // @MDB
BREAKPOINT: test3
Foo<T> foo = delegate (T u) {
Hello (u); // @MDB
LINE: test3 foo
+ Hello (t);
};
foo (t); // @MDB
BREAKPOINT: test3 after foo
}
@@ -113,15 +115,15 @@
{
public static void Hello<S> (T t, S s)
{
- Foo<long> foo = delegate (long r) {
- Console.WriteLine (r); // @MDB
LINE: test4 foo
+ Foo<long> foo = delegate (long r) { // @MDB
LINE: test4 foo
+ Console.WriteLine (r);
Bar<T> bar = delegate (T x) {
- Console.WriteLine (r);
+ Console.WriteLine (r); // @MDB
LINE: test4 bar
Console.WriteLine (t);
Console.WriteLine (s);
Console.WriteLine (x);
};
- bar (t);
+ bar (t); // @MDB
LINE: test4 foo2
};
foo (5); // @MDB
BREAKPOINT: test4
}
Modified:
branches/martin/debugger-terrania/debugger/test/testsuite/TestAnonymous.cs
===================================================================
--- branches/martin/debugger-terrania/debugger/test/testsuite/TestAnonymous.cs
2008-02-11 08:02:59 UTC (rev 95425)
+++ branches/martin/debugger-terrania/debugger/test/testsuite/TestAnonymous.cs
2008-02-11 08:03:27 UTC (rev 95426)
@@ -94,9 +94,8 @@
"Test2.X/<>c__CompilerGenerated1`1<T>.<Test>c__7()",
GetLine ("test2 foo"));
- // FIXME
- // AssertPrint (thread, "t", "(int) 3");
- // AssertType (thread, "t", "int");
+ AssertPrint (thread, "t", "(int) 3");
+ AssertType (thread, "t", "int");
AssertPrint (thread, "u", "(int) 3");
AssertType (thread, "u", "int");
@@ -111,7 +110,12 @@
AssertType (thread, "u", "int");
AssertExecute ("continue");
+ AssertHitBreakpoint (thread, "test2 hello",
"Test2.X.Hello(U)");
+ AssertPrint (thread, "u", "(int) 3");
+ AssertType (thread, "u", "int");
+ AssertExecute ("continue");
+
//
// Test3
//
@@ -133,9 +137,8 @@
"Test3.X/<>c__CompilerGenerated2`1<T>.<Test>c__8(S)",
GetLine ("test3 foo"));
- // FIXME
- // AssertPrint (thread, "t", "(int) 3");
- // AssertType (thread, "t", "int");
+ AssertPrint (thread, "t", "(int) 3");
+ AssertType (thread, "t", "int");
AssertPrint (thread, "u", "(int) 3");
AssertType (thread, "u", "int");
@@ -145,7 +148,12 @@
AssertType (thread, "u", "int");
AssertExecute ("continue");
+ AssertHitBreakpoint (thread, "test3 hello",
"Test3.X.Hello(U)");
+ AssertPrint (thread, "u", "(int) 3");
+ AssertType (thread, "u", "int");
+ AssertExecute ("continue");
+
//
// Test4
//
@@ -156,9 +164,49 @@
AssertPrint (thread, "s", String.Format ("(double)
{0}", System.Math.PI));
AssertType (thread, "s", "double");
+ AssertExecute ("step");
+ AssertStopped (thread,
+
"Test4.Test`1/<>c__CompilerGenerated3`1<T,S>.<Hello>c__11(long)",
+ GetLine ("test4 foo"));
+ AssertExecute ("step");
+ AssertStopped (thread,
+
"Test4.Test`1/<>c__CompilerGenerated3`1<T,S>.<Hello>c__11(long)",
+ GetLine ("test4 foo") + 1);
+
+ AssertPrint (thread, "r", "(long) 5");
+ AssertType (thread, "r", "long");
+ AssertPrint (thread, "t", "(string) \"Kahalo\"");
+ AssertType (thread, "t", "string");
+ AssertPrint (thread, "s", String.Format ("(double)
{0}", System.Math.PI));
+ AssertType (thread, "s", "double");
+
+ AssertExecute ("next");
+ AssertTargetOutput ("5");
+ AssertStopped (thread,
+
"Test4.Test`1/<>c__CompilerGenerated3`1<T,S>.<Hello>c__11(long)",
+ GetLine ("test4 foo") + 2);
+
+ AssertExecute ("next");
+ AssertStopped (thread,
+
"Test4.Test`1/<>c__CompilerGenerated3`1<T,S>.<Hello>c__11(long)",
+ GetLine ("test4 foo2"));
+
+ AssertExecute ("step");
+ AssertStopped (thread,
+
"Test4.Test`1/<>c__CompilerGenerated3`1/<>c__CompilerGenerated9<T,S>.<Hello>c__10(T)",
+ GetLine ("test4 bar"));
+
+ AssertPrint (thread, "r", "(long) 5");
+ AssertType (thread, "r", "long");
+ AssertPrint (thread, "x", "(string) \"Kahalo\"");
+ AssertType (thread, "x", "string");
+ AssertPrint (thread, "t", "(string) \"Kahalo\"");
+ AssertType (thread, "t", "string");
+ AssertPrint (thread, "s", String.Format ("(double)
{0}", System.Math.PI));
+ AssertType (thread, "s", "double");
+
AssertExecute ("continue");
AssertTargetOutput ("5");
- AssertTargetOutput ("5");
AssertTargetOutput ("Kahalo");
AssertTargetOutput (System.Math.PI.ToString ());
AssertTargetOutput ("Kahalo");
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches