Stack scanning: Find RegisterMap and unit-test it. Add decoding of the map.

Tests disabled, because there is a bug in System's LoadLibrary.

Change-Id: Ied3f4a31ce454f37c4d0f9caacd4ba03c4adb493
diff --git a/test/StackWalk2/StackWalk2.java b/test/StackWalk2/StackWalk2.java
new file mode 100644
index 0000000..7d8c177
--- /dev/null
+++ b/test/StackWalk2/StackWalk2.java
@@ -0,0 +1,49 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+
+package com.example.StackWalk2;
+
+public class StackWalk2 {
+  // use v1 for this
+
+  String str = new String();  // use v0 for str in <init>
+
+  int f() {
+    g(1);  // use v0 for 1, v1 for this
+    g(2);  // use v0 for 2, v1 for this
+    strTest();  // use v1 for this
+    return 0;
+  }
+
+  void g(int num_calls) throws RuntimeException {
+    if (num_calls == 1) {  // use v0 for 1, v3 for num_calls
+      System.logI("1st call");  // use v0 for PrintStream, v1 for "1st call"
+      refmap2(24);  // use v0 for 24, v2 for this
+    } else if (num_calls == 2) {  // use v0 for 2, v3 for num_calls
+      System.logI("2nd call");  // use v0 for PrintStream, v1 for "2nd call"
+      refmap2(25);  // use v0 for 24, v2 for this
+    }
+    throw new RuntimeException();  // use v0 for new RuntimeException
+  }
+
+  void strTest() {
+    System.logI(str);  // use v1 for PrintStream, v2, v3 for str
+    str = null;  // use v1 for null, v3 for str
+    str = new String("ya");  // use v2 for "ya", v1 for new String
+    String s = str;  // use v0, v1, v3
+    System.logI(str);  // use v1 for PrintStream, v2, v3 for str
+    System.logI(s);  // use v1 for PrintStream, v0 for s
+    s = null;  // use v0
+    System.logI(s);  // use v1 for PrintStream, v0 for s
+  }
+
+  native int refmap2(int x);
+
+  static {
+    System.loadLibrary("arttest");
+  }
+
+  public static void main(String[] args) {
+    StackWalk2 st = new StackWalk2();
+    st.f();
+  }
+}