Stub to capture method entry/exit.
Added stubs to allow traceview to do method tracing. Currently only
outputs to logcat, and a later change will generate the proper log file.
Change-Id: Icaafc50e2eaf042ddc4d882011f7e8121bdd8b1c
diff --git a/src/thread.h b/src/thread.h
index c4c619a..d24ddca 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -23,6 +23,7 @@
#include <iosfwd>
#include <list>
#include <string>
+#include <vector>
#include "dex_file.h"
#include "globals.h"
@@ -34,6 +35,7 @@
#include "offsets.h"
#include "runtime_stats.h"
#include "stack.h"
+#include "trace.h"
#include "UniquePtr.h"
namespace art {
@@ -466,6 +468,20 @@
return debug_invoke_req_;
}
+ bool IsTraceStackEmpty() const {
+ return trace_stack_->empty();
+ }
+
+ void PushTraceStackFrame(const TraceStackFrame& frame) {
+ trace_stack_->push_back(frame);
+ }
+
+ TraceStackFrame PopTraceStackFrame() {
+ TraceStackFrame frame = trace_stack_->back();
+ trace_stack_->pop_back();
+ return frame;
+ }
+
private:
Thread();
~Thread();
@@ -604,6 +620,10 @@
// TLS key used to retrieve the VM thread object.
static pthread_key_t pthread_key_self_;
+ // Additional stack used by method tracer to store method and return pc values.
+ // Stored as a pointer since std::vector is not PACKED.
+ std::vector<TraceStackFrame>* trace_stack_;
+
DISALLOW_COPY_AND_ASSIGN(Thread);
};