Merge "Fixed tracer to stub additional classes as they're loaded." into dalvik-dev
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 4226ea5..5ff2293 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -1288,7 +1288,16 @@
if (method->IsNative()) {
// unregistering restores the dlsym lookup stub
method->UnregisterNative();
- return;
+ }
+
+ if (Runtime::Current()->IsMethodTracingActive()) {
+#if defined(__arm__)
+ Trace* tracer = Runtime::Current()->GetTracer();
+ void* trace_stub = reinterpret_cast<void*>(art_trace_entry_from_code);
+ tracer->SaveAndUpdateCode(method.get(), trace_stub);
+#else
+ UNIMPLEMENTED(WARNING);
+#endif
}
}
diff --git a/src/object.cc b/src/object.cc
index f43bec9..bf32913 100644
--- a/src/object.cc
+++ b/src/object.cc
@@ -447,7 +447,13 @@
return DexFile::kDexNoIndex; // Special no mapping case
}
size_t mapping_table_length = GetMappingTableLength();
- const void* code_offset = Runtime::Current()->IsMethodTracingActive() ? Runtime::Current()->GetTracer()->GetSavedCodeFromMap(this) : GetCode();
+ const void* code_offset;
+ if (Runtime::Current()->IsMethodTracingActive() &&
+ Runtime::Current()->GetTracer()->GetSavedCodeFromMap(this) != NULL) {
+ code_offset = Runtime::Current()->GetTracer()->GetSavedCodeFromMap(this);
+ } else {
+ code_offset = GetCode();
+ }
uint32_t sought_offset = pc - reinterpret_cast<uintptr_t>(code_offset);
uint32_t best_offset = 0;
uint32_t best_dex_offset = 0;
diff --git a/src/thread.cc b/src/thread.cc
index b065533..a1df41b 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -1119,6 +1119,7 @@
uintptr_t trace_exit = reinterpret_cast<uintptr_t>(art_trace_exit_from_code);
if (ManglePc(trace_exit) == pc) {
TraceStackFrame trace_frame = GetTraceStackFrame(trace_stack_depth++);
+ CHECK(trace_frame.method_ == frame.GetMethod());
pc = ManglePc(trace_frame.return_pc_);
}
#endif