Add StackVisitor, CountStackDepthVisitor, BuildStackTraceVisitor for EH.
In addition to EH, GC can use StackVisitor too.
Crawl stack in 2 passes, using CountStackDepthVisitor and
BuildStackTraceVisitor, respectively. Note that Pass 1 computes
the depth with a doubly-nested loop.
Change-Id: If1e3d3212037426b10ac5e6a01138acfab710e6b
diff --git a/src/exception_test.cc b/src/exception_test.cc
index f2701dd..259c0a4 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -144,11 +144,13 @@
fake_stack[top_of_stack++] = 3;
fake_stack[top_of_stack++] = reinterpret_cast<uintptr_t>(method_f_);
fake_stack[top_of_stack++] = 3;
+ fake_stack[top_of_stack++] = NULL;
+ fake_stack[top_of_stack++] = 0;
Thread* thread = Thread::Current();
thread->SetTopOfStack(fake_stack);
- ObjectArray<StackTraceElement>* trace_array = thread->AllocStackTrace(2);
+ ObjectArray<StackTraceElement>* trace_array = thread->AllocStackTrace();
ASSERT_TRUE(trace_array->Get(0) != NULL);
EXPECT_STREQ("java.lang.MyClass",