Permalink
Browse files

Usability improvements for NIECZA_SER_TRACE, indenting

  • Loading branch information...
1 parent 7351588 commit ff557f50e15fdc3fc6fbe37123f55eb38abd7e7e @sorear committed Aug 23, 2012
Showing with 13 additions and 2 deletions.
  1. +6 −0 lib/Kernel.cs
  2. +7 −2 lib/Serialize.cs
View
@@ -1955,6 +1955,8 @@ public class UsedInScopeInfo {
private SubInfo() { }
+ public override string ToString() { return name ?? "ANON"; }
+
// This is a _shallow_ clone. The children wind up shared, as do
// a lot of immutable-ish objects that are referenced.
internal SubInfo(SubInfo o) {
@@ -2907,6 +2909,10 @@ public class Frame: P6any, IFixup {
return spacey[ix];
}
+ public override string ToString() {
+ return "frame:" + info + "/" + GetHashCode();
+ }
+
public Frame Return() {
if (on_leave != null) {
Variable ret = (Variable) caller.resultSlot;
View
@@ -427,11 +427,14 @@ public class FreezeBuffer {
// This is the main routine you should call from your Freeze
// callbacks to freeze an object
+ static int depth;
public void ObjRef(object o) {
int id;
SerUnit altunit;
- if (Config.SerTrace)
- Console.WriteLine("Saving {0} at {1}...", o, wpointer);
+ if (Config.SerTrace) {
+ Console.WriteLine("{0}Saving {1} at {2}:", new string(' ',depth), o, wpointer);
+ }
+
if (o == null) { // null pointers are special
Byte((byte)SerializationCode.Null);
return;
@@ -460,11 +463,13 @@ public class FreezeBuffer {
} else {
// must take responsibility for saving the tag
IFreeze f = o as IFreeze;
+ if (Config.SerTrace) depth++;
if (f != null) {
f.Freeze(this);
} else {
FallbackFreeze(o);
}
+ if (Config.SerTrace) depth--;
}
}

0 comments on commit ff557f5

Please sign in to comment.