Give WalkStack's callback a way to terminate early.
Also combine WalkStack and WalkStackUntilUpcall.
Change-Id: Ida25665de72e5fd8e17946886a387b27cf841457
diff --git a/src/thread.h b/src/thread.h
index 94659c4..51385f9 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -92,7 +92,8 @@
class StackVisitor {
public:
virtual ~StackVisitor() {}
- virtual void VisitFrame(const Frame& frame, uintptr_t pc) = 0;
+ // Return 'true' if we should continue to visit more frames, 'false' to stop.
+ virtual bool VisitFrame(const Frame& frame, uintptr_t pc) = 0;
};
// Creates a new thread.
@@ -399,7 +400,7 @@
return ThreadOffset(OFFSETOF_MEMBER(Thread, top_sirt_));
}
- void WalkStack(StackVisitor* visitor) const;
+ void WalkStack(StackVisitor* visitor, bool include_upcalls = false) const;
DebugInvokeReq* GetInvokeReq() {
return debug_invoke_req_;
@@ -463,8 +464,6 @@
static void ThreadExitCallback(void* arg);
- void WalkStackUntilUpCall(StackVisitor* visitor, bool include_upcall) const;
-
// Thin lock thread id. This is a small integer used by the thin lock implementation.
// This is not to be confused with the native thread's tid, nor is it the value returned
// by java.lang.Thread.getId --- this is a distinct value, used only for locking. One