diff options
| author | 2013-01-08 16:21:01 -0800 | |
|---|---|---|
| committer | 2013-01-08 16:21:01 -0800 | |
| commit | 162fd33474038f0de0388338ca007ecf400bb3df (patch) | |
| tree | af85ca309bfb0aa36061d340ad6fa9d1a848923f | |
| parent | 54b3747f197fec38f91b1b74e81d812d8b55f1ad (diff) | |
Add update_debugger_support for x86 and fix ModBasket.
Made a constructor for struct ModBasket rather than using memset(0).
This was causing problems when setting the std::string className field
on the host.
Change-Id: Ie8fa08d0c9f01b029db88c8a309e54283b00b497
| -rw-r--r-- | src/jdwp/jdwp_event.cc | 7 | ||||
| -rw-r--r-- | src/oat/runtime/x86/oat_support_entrypoints_x86.cc | 17 | ||||
| -rw-r--r-- | src/oat/runtime/x86/runtime_support_x86.S | 20 |
3 files changed, 34 insertions, 10 deletions
diff --git a/src/jdwp/jdwp_event.cc b/src/jdwp/jdwp_event.cc index 8b3964a095..8be3451c32 100644 --- a/src/jdwp/jdwp_event.cc +++ b/src/jdwp/jdwp_event.cc @@ -107,6 +107,9 @@ namespace JDWP { * The rest will be zeroed. */ struct ModBasket { + ModBasket() : pLoc(NULL), threadId(0), classId(0), excepClassId(0), + caught(false), field(0), thisPtr(0) { } + const JdwpLocation* pLoc; /* LocationOnly */ std::string className; /* ClassMatch/ClassExclude */ ObjectId threadId; /* ThreadOnly */ @@ -720,7 +723,6 @@ bool JdwpState::PostVMStart() { bool JdwpState::PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, int eventFlags) { ModBasket basket; - memset(&basket, 0, sizeof(basket)); basket.pLoc = pLoc; basket.classId = pLoc->class_id; basket.thisPtr = thisPtr; @@ -821,7 +823,6 @@ bool JdwpState::PostThreadChange(ObjectId threadId, bool start) { } ModBasket basket; - memset(&basket, 0, sizeof(basket)); basket.threadId = threadId; ExpandBuf* pReq = NULL; @@ -898,7 +899,6 @@ bool JdwpState::PostException(const JdwpLocation* pThrowLoc, const JdwpLocation* pCatchLoc, ObjectId thisPtr) { ModBasket basket; - memset(&basket, 0, sizeof(basket)); basket.pLoc = pThrowLoc; basket.classId = pThrowLoc->class_id; basket.threadId = Dbg::GetThreadSelfId(); @@ -973,7 +973,6 @@ bool JdwpState::PostClassPrepare(JdwpTypeTag tag, RefTypeId refTypeId, const std int status) { ModBasket basket; - memset(&basket, 0, sizeof(basket)); basket.classId = refTypeId; basket.threadId = Dbg::GetThreadSelfId(); basket.className = Dbg::GetClassName(basket.classId); diff --git a/src/oat/runtime/x86/oat_support_entrypoints_x86.cc b/src/oat/runtime/x86/oat_support_entrypoints_x86.cc index a3c845e3e9..a555c3df90 100644 --- a/src/oat/runtime/x86/oat_support_entrypoints_x86.cc +++ b/src/oat/runtime/x86/oat_support_entrypoints_x86.cc @@ -34,6 +34,7 @@ extern "C" void art_check_cast_from_code(void*, void*); // Debug entrypoints. extern void DebugMe(AbstractMethod* method, uint32_t info); +extern "C" void art_update_debugger(void*, void*, int32_t, void*); // DexCache entrypoints. extern "C" void* art_initialize_static_storage_from_code(uint32_t, void*); @@ -122,6 +123,11 @@ extern "C" void art_throw_no_such_method_from_code(int32_t method_idx); extern "C" void art_throw_null_pointer_exception_from_code(); extern "C" void art_throw_stack_overflow_from_code(void*); +// Instrumentation entrypoints. +extern "C" void art_instrumentation_entry_from_code(void*); +extern "C" void art_instrumentation_exit_from_code(); +extern "C" void art_deoptimize(); + void InitEntryPoints(EntryPoints* points) { // Alloc points->pAllocArrayFromCode = art_alloc_array_from_code; @@ -229,20 +235,21 @@ void InitEntryPoints(EntryPoints* points) { points->pThrowStackOverflowFromCode = art_throw_stack_overflow_from_code; }; -void ChangeDebuggerEntryPoint(EntryPoints*, bool) { - UNIMPLEMENTED(FATAL); +void ChangeDebuggerEntryPoint(EntryPoints* points, bool enabled) { + points->pUpdateDebuggerFromCode = (enabled ? art_update_debugger : NULL); } uintptr_t GetInstrumentationExitPc() { - return 0; + return reinterpret_cast<uintptr_t>(art_instrumentation_exit_from_code); } uintptr_t GetDeoptimizationEntryPoint() { - return 0; + UNIMPLEMENTED(FATAL); + return reinterpret_cast<uintptr_t>(art_deoptimize); } void* GetInstrumentationEntryPoint() { - return NULL; + return reinterpret_cast<void*>(art_instrumentation_entry_from_code); } } // namespace art diff --git a/src/oat/runtime/x86/runtime_support_x86.S b/src/oat/runtime/x86/runtime_support_x86.S index 558500d299..1d246069ba 100644 --- a/src/oat/runtime/x86/runtime_support_x86.S +++ b/src/oat/runtime/x86/runtime_support_x86.S @@ -374,6 +374,17 @@ TWO_ARG_DOWNCALL art_initialize_static_storage_from_code, artInitializeStaticSto TWO_ARG_DOWNCALL art_initialize_type_from_code, artInitializeTypeFromCode, RETURN_IF_EAX_NOT_ZERO TWO_ARG_DOWNCALL art_initialize_type_and_verify_access_from_code, artInitializeTypeAndVerifyAccessFromCode, RETURN_IF_EAX_NOT_ZERO +DEFINE_FUNCTION art_update_debugger + mov %eax, %ebx // stash away eax so that it's saved as if it were an argument + SETUP_REF_AND_ARGS_CALLEE_SAVE_FRAME + pushl %esp // pass arg2 (sp) + pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current() + pushl %edx // pass arg0 (dex pc) + call SYMBOL(artUpdateDebuggerFromCode) // artUpdateDebuggerFromCode(int32_t, Thread*, Method**) + RESTORE_REF_AND_ARGS_CALLEE_SAVE_FRAME + mov %ebx, %eax // restore original eax + ret + DEFINE_FUNCTION art_get_and_clear_exception subl LITERAL(8), %esp // alignment padding pushl %fs:THREAD_SELF_OFFSET // pass Thread::Current() @@ -734,6 +745,14 @@ DEFINE_FUNCTION art_proxy_invoke_handler addl LITERAL(44), %esp // pop arguments RETURN_OR_DELIVER_PENDING_EXCEPTION // return or deliver exception +DEFINE_FUNCTION art_instrumentation_entry_from_code + ret +DEFINE_FUNCTION art_instrumentation_exit_from_code + ret + +DEFINE_FUNCTION art_deoptimize + ret + /* * String's indexOf. * @@ -836,5 +855,4 @@ VAR(name, 0): END_MACRO // TODO: implement these! -UNIMPLEMENTED art_update_debugger UNIMPLEMENTED art_memcmp16 |