summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
Commit message (Collapse)AuthorAgeFilesLines
* Support field watchpoint in interpreterSebastien Hertz2014-04-252-6/+11
| | | | | | | | | | | | | | | | We report field read/write events to instrumentation from the interpreter. This allows it to send JDWP field access and field modification events to debugger. This completes CL https://android-review.googlesource.com/90390. We also fix the JDWP FieldOnly modifier by introducing ModBasket.fieldTypeID. We incorrectly used ModBasket.classId which is actually dedicated to ClassOnly modifier based on thread's location's class id. Finally, we now enable canWatchFieldModification and canWatchFieldAccess JDWP capabilities so a debugger can request these events to be reported. Bug: 8267708 Change-Id: I987852ad47abb27b2f7e78544a8189c7a4e2f462
* Merge "Speed up single-stepping"Sebastien Hertz2014-04-223-1/+15
|\
| * Speed up single-steppingSebastien Hertz2014-04-093-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During single-stepping sequence, we need to deoptimize everything when we register a single-step event and undeoptimize everything when it is done. This causes a slow pattern where we continuously deoptimize-undeoptimize everything for each single-step. This CL introduces a special handling of single-step undeoptimization. We now delay the undeoptimization to the next resume (one thread or all threads) or the end of the debugging session. Indeed, a single-step event registration is always followed by a resume command. At the "resume" point, we know if a single-step event is registered and if we really need to undeoptimize. At the "registration" point, we know we did not undeoptimized everything so we don't need to deoptimize everything again. Therefore, in a sequence of single-steps, we only do a full deoptimization for the first single-step and a full undeoptimization for the last single-step. We update logs at deoptimization points so we can track more precisely. Note they are verbose logs that still must be enabled with -verbose:jdwp option. We also make some improvement inside instrumentation: * updates Instrumentation::ShouldNotifyMethodEnterExitEvents to comply with its name. * compute frame id only once when looking for the corresponding instrumentation frame. * compute the OatMethod once in ClassLinker::GetPortableOatCodeFor to avoid looking for it again. Bug: 13577964 Change-Id: If6fa198a676b515cd474b8c4d7bf7ef3626f2dc7
* | Disable JDWP field watchpoint capabilitiesSebastien Hertz2014-04-161-2/+2
| | | | | | | | | | | | | | | | We do not fully support field watchpoint yet. We can only enable these capabilities when we do report these events. Bug: 8267708 Change-Id: I07ccf7ddffdd26e143b7fb0f13ebe030d75e8491
* | Merge "Allow use of instance filter for JDWP events"Sebastien Hertz2014-04-161-1/+1
|\ \
| * | Allow use of instance filter for JDWP eventsSebastien Hertz2014-04-151-1/+1
| |/ | | | | | | | | Bug: 13922844 Change-Id: Ic4e6d7af7c80928c25417db5f43049614d225c97
* | Merge "Fix JDWP count event modifier"Sebastien Hertz2014-04-161-0/+3
|\ \
| * | Fix JDWP count event modifierSebastien Hertz2014-04-151-0/+3
| |/ | | | | | | | | Bug: 14053614 Change-Id: I736f6d6802e58e7a4fb29d0558bdd2abd3b2a48e
* | Merge "Prepare field watchpoint support"Sebastien Hertz2014-04-153-19/+95
|\ \
| * | Prepare field watchpoint supportSebastien Hertz2014-04-153-19/+95
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Adds field read/write events in the instrumentation. The debugger now registers as a listener for these events so JDWP field access and field modification events can be reported. This CL will be followed by another one to report these events from the interpreter. Therefore no JDWP field access and field modification events can be sent for now. Bug: 8267708 Change-Id: If2a93eb590805567d69015c83cce9cd2ab712cbd
* | Deduplicate code starting JDWP threadSebastien Hertz2014-04-141-34/+17
|/ | | | | | | Also waits for thread_start_cond_ in a loop and removes needless mutex lock in JdwpState::Run when checking thread state. Change-Id: I6fca2151b5343b2906e9fa3b439029e6ad5b086d
* Refactor deoptimization support in debuggerSebastien Hertz2014-03-263-27/+19
| | | | | | | | | | | | | | | | | This CL prepares breakpoint support for inlined methods where we'll have to deoptimize everything. We move deoptimization-related information to Dbg class only (deoptimization request queue, full deoptimization event count and deoptimization lock). We replace MethodInstrumentionRequest by DeoptimizationRequest. This is used to know which kind of deoptimization is required for a particular event. It also simplifies lock ordering a bit during event setup: we no longer need to hold the deoptimization lock while holding the breakpoint lock. Moreover, the deoptimization lock should be held only after the event list lock. Bug: 12187616 Change-Id: Iff13f004adaeb25e5d609238bacce0b9720510e6
* Do not send JDWP data in case of error.Sebastien Hertz2014-03-184-16/+16
| | | | | | | | | | | | | | | When sending JDWP reply packet with an error, we want to ignore any data in the buffer. While we reflect that in the packet's length (first 4 bytes), we used to send all data in the buffer. This causes the receiver to read malformed JDWP packet. This CL adds "length" argument to JdwpNetStateBase::WritePacket so we control the amount of data we send. If the reply has no error, it is set to the length of the buffer. Otherwise it is the length of JDWP packet header indicating no data is available. Bug: 13366758 Change-Id: Ib72c10d5faf065fb44901c34b2732496b6667efa
* Fix debugger crash in native method frames.Sebastien Hertz2014-03-171-2/+8
| | | | | | | | | | | | | | | | | | | | | The main crash happens when we try to read (StackFrame::GetValues) or write (StackFrame::SetValues) values in native frames. We use the method's vmap to know where Dalvik registers live but native methods don't have vmap. The fix is to reply with the OPAQUE_FRAME error which indicates local values are not accessible in the frame. We prevent from dereferencing null code item which causes some crashes too. This happens when we compute the line table (Method::LineTable) and variable table (Method::VariableTable) of methods without code: native, proxy and abstract methods. We do not expect to encounter abstract methods though. We take care of these kinds of method when mangling/demangling local value slots. We also fix the location's pc of native and proxy frames where it must be -1 (as 8-byte value). We'll use this property to detect such frames in the JDWP tests. Bug: 13366758 Change-Id: I78e3263fbf2681b5573571c846390d52b9193849
* Enable annotalysis on clang ART builds.Ian Rogers2014-03-061-3/+6
| | | | | | | | | | | Fix clang build errors aswell as restructure locking/mutex code for correct thread safety analysis support. Reorder make dependencies so that host builds build first as they should provide better compilation errors than target. Remove host's use of -fno-omit-frame-pointer as it has no value with correct use of CFI, which we should have. Change-Id: I72cea8da9a3757b1a0b3acb4081feccb7c6cef90
* Fix clang to compile and run host tests.Ian Rogers2014-02-281-2/+2
| | | | | | | | | | | | | | Don't use the computed goto interpreter with clang 3.4 as it causes compilation to hang. Avoid inclusion of LLVM_(HOST|DEVICE)_BUILD_MK except for with portable as it sets clang incompatible cflags. Most fixes are self-evident, for the quick dex file method inliner the enums were being used with ostreams, so fix the enums and operator out python script to allow this. Note this change effects portable but this is untestable as portable was broken by ELF file and mc linker changes. Change-Id: Ia54348f6b1bd3f76d3b71c6e8c5f97626386b903
* Fix debugger deadlock.Sebastien Hertz2014-02-243-4/+21
| | | | | | | | | | | | | | Fixes a deadlock between the event thread lock and the processing request lock where the JDWP thread and the event thread wait for each other. We now move the call to StartProcessingRequest after the call to SetWaitForEventThread in JdwpState::ProcessRequest so locks are taken in the same order in both threads. Also adds some thread safety annotations and JDWP verbose logs for debug (only enabled if we pass the -verbose:jdwp option to the runtime). Bug: 13165103 Change-Id: I4e8b6526d973bfee56e69e8e14eddf56adfa1939
* Merge "Avoid interleaving JDWP requests and events."Sebastien Hertz2014-02-194-0/+59
|\
| * Avoid interleaving JDWP requests and events.Sebastien Hertz2014-02-194-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | To avoid bad synchronization between the debugger and the debuggee, we should not send any events while processing a request (before sending its reply). This particularly prevents from sending the VM_DEATH event (and consequently closing the JDWP connection) after receiving the VM_Resume command but before sending its reply. Bug: 12581527 Change-Id: I197cc54e980a983faae4b545f25dfe7fe812e841
* | Fix failing check during JDWP invoke.Sebastien Hertz2014-02-191-8/+0
|/ | | | | | | | | | | | | | | | | Fixes a race where the JDWP thread expects the invoke thread can be suspended (suspend_count != 0) before invoke thread actually updates its suspend count. It happens after the invoke thread signals the JDWP thread to notify invoke is completed but before incrementing its suspend count. In the meantime, the JDWP thread wakes up and checks whether invoke thread has updated its supend count. But there is no way to prevent the JDWP thread to do so before the invoke thread updates its suspend count. We now move the invoke completion code after the suspend count update. Then the JDWP thread wakes up at the right time. Bug: 11247837 Bug: 12578041 Change-Id: Ib6079c6e330671b34217838e26b1e758706d3da6
* Add root types and thread id to root visiting.Mathieu Chartier2014-02-112-4/+4
| | | | | | | Enables us to pass the root type and thread id to hprof. Bug: 12680863 Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
* Make debugger / jdwp compaction safe.Mathieu Chartier2014-02-082-54/+95
| | | | | | | | | | | | | Fixed GetInstances, GetReferringObjects, CountInstances to use VisitObjects instead of the live bitmap. We now treat the object registry as system weaks and update the objects when/if they move. Also added the recent_allocation_records_ as roots. Bug: 12936165 Change-Id: I615c289efbf2977ceab5c4ffa73d216d799e6e33
* Object model changes to support 64bit.Ian Rogers2014-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Modify mirror objects so that references between them use an ObjectReference value type rather than an Object* so that functionality to compress larger references can be captured in the ObjectRefererence implementation. ObjectReferences are 32bit and all other aspects of object layout remain as they are currently. Expand fields in objects holding pointers so they can hold 64bit pointers. Its expected the size of these will come down by improving where we hold compiler meta-data. Stub out x86_64 architecture specific runtime implementation. Modify OutputStream so that reads and writes are of unsigned quantities. Make the use of portable or quick code more explicit. Templatize AtomicInteger to support more than just int32_t as a type. Add missing, and fix issues relating to, missing annotalysis information on the mutator lock. Refactor and share implementations for array copy between System and uses elsewhere in the runtime. Fix numerous 64bit build issues. Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
* Fix multi-line hex dumping and add unit test.Ian Rogers2014-01-301-2/+3
| | | | Change-Id: I7657018fef5d9c17410a9a634db275555f180014
* 64bit friendly printf modifiers in JDWP.Ian Rogers2014-01-244-25/+32
| | | | Change-Id: I105da6393b31f5901036216fbfe19a71c46cf152
* Selective deoptimization.Sebastien Hertz2014-01-133-26/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update the instrumentation to allow selective deoptimization. Separate instrumentation listener registration from stubs configuration. A listener is now responsible for configuring the appropriate stubs. - The method tracing listener installs instrumentation entry/exit stubs or the interpreter depending on the accuracy of events we want (controlled by kDeoptimizeForAccurateMethodEntryExitListeners). - The debugger registers itself as an instrumentation listener but does not modify methods entrypoints. It only does this on demand when deoptimizing one method or all the methods. The selective deoptimization is used for breakpoint only. When a breakpoint is requested, the debugger deoptimizes this method by setting its entrypoint to the interpreter stub. As several breakpoints can be set on the same method, we deoptimize only once. When the last breakpoint on a method is removed, we reoptimize it by restoring the original entrypoints. The full deoptimization is used for method entry, method exit and single-step events. When one of these events is requested, we force eveything to run with the interpreter (except native and proxy methods). When the last of these events is removed, we restore all methods entrypoints except those which are currently deoptimized. Deoptimizing a method requires all mutator threads be suspended in order to walk each thread's stack and ensure no code is actually executing while we modify methods entrypoints. Suspending all the threads requires to not hold any lock. In the debugger, we deoptimize/undeoptimize when the JDWP event list changes (add or remove a breakpoint for instance). During the update, we need to hold the JDWP event list lock. This means we cannot suspend all the threads at this time. In order to deal with these constraints, we support a queue of deoptimization requests. When an event needs selective/full deoptimization/undeoptimization, we save its request in the queue. Once we release the JDWP event list lock, we suspend all the threads, process this queue and finally resume all the threads. This is done in Dbg::ManageDeoptimization. Note: threads already suspended before doing this remain suspended so we don't "break" debugger suspensions. When we deoptimize one method or every method, we need to browse each thread's stack to install instrumentation exit PC as return PC and save information in the instrumentation stack frame. Now we can deoptimize multiple times during the execution of an application, we need to preserve exisiting instrumentation frames (which is the result of a previous deoptimization). This require to push new instrumentation frames before existing ones so we don't corrupt the instrumentation stack frame while walking the stack. Bug: 11538162 Change-Id: I477142df17edf2dab8ac5d879daacc5c08a67c39
* Merge "Manage JDWP errors related to garbage collection."Sebastien Hertz2013-12-121-9/+3
|\
| * Manage JDWP errors related to garbage collection.Sebastien Hertz2013-12-121-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | Returns INVALID_OBJECT error in case of invalid object ID or null object ID in commands ObjectReference.DisableCollection, ObjectReference.EnableCollection and ObjectReference.IsCollected. Note: JDWP specs do not state ObjectReference.EnableCollection must return any error code. We choose to be more strict so these three commands all behave the same. Change-Id: I06fb75b75f7d33cf4d23e121d9541bfd70b778bb
* | Fix null argument handling during invoke from JDWP.Sebastien Hertz2013-12-121-0/+3
|/ | | | | | Fix a crash when passing null argument to a JDWP invoke. Change-Id: I167f93f3a411f0de8458db3ba5bed3169d557ee9
* Minor field name cleanup in debugger.Sebastien Hertz2013-11-251-5/+5
| | | | | | Use the same naming convention for all fields of DebugInvokeReq structure. Change-Id: Ieaf65eef592f96efa47975eef15334279ed4fc8a
* Add support for JDWP METHOD_EXIT_WITH_RETURN_VALUE events.Jeff Hao2013-11-192-5/+11
| | | | | Bug: 11569539 Change-Id: Ibc7a80df83470ffd726d73695a05f4938248f292
* StringPiece clean up.Ian Rogers2013-09-241-2/+2
| | | | | | | | | | | Profile guided clean up. Try to avoid creating StringPieces with the contents of a dex file where the length is known. Try to avoid RegTypeCache::FromDescriptor when there's a class available. Make ConstantType::ConstantValue inlinable. Saving of about 50ms from a 2 threaded ThinkFree compile on host. Change-Id: I47a12c3c76f46e2c9805be1c3a3e3870fe1f5d85
* Refactor java.lang.reflect implementationBrian Carlstrom2013-08-132-2/+2
| | | | | | | | | | | Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1. Move to ArtMethod/Field instead of AbstractMethod/Field and have java.lang.reflect APIs delegate to ArtMethod/ArtField. Bug: 10014286. Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
* Fix cpplint whitespace/comments issuesBrian Carlstrom2013-07-267-20/+20
| | | | Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
* am f5293527: Move JDWP to std::vector<iovec> to remove runtime/arrays warningBrian Carlstrom2013-07-194-12/+12
|\ | | | | | | | | * commit 'f52935278fca8c7aa220543eef4544e3d1105d91': Move JDWP to std::vector<iovec> to remove runtime/arrays warning
| * Move JDWP to std::vector<iovec> to remove runtime/arrays warningBrian Carlstrom2013-07-194-12/+12
| | | | | | | | Change-Id: I8494a25a65de4ebac2b1f4f41c0f5eedf117b7ac
* | am fb6996fe: Fixing cpplint runtime/arrays, runtime/int, runtime/virtual issuesBrian Carlstrom2013-07-191-1/+1
|\ \ | |/ | | | | | | * commit 'fb6996fe2b1bb28526751650441d7ac29dcdb4e6': Fixing cpplint runtime/arrays, runtime/int, runtime/virtual issues
| * Fixing cpplint runtime/arrays, runtime/int, runtime/virtual issuesBrian Carlstrom2013-07-181-1/+1
| | | | | | | | Change-Id: Ia2ff94d2fb69465df26aaf83df82614a483b26e0
* | am 4274889d: Fixing cpplint readability/check issuesBrian Carlstrom2013-07-192-4/+4
|\ \ | |/ | | | | | | * commit '4274889d48ef82369bf2c1ca70d84689b4f9e93a': Fixing cpplint readability/check issues
| * Fixing cpplint readability/check issuesBrian Carlstrom2013-07-182-4/+4
| | | | | | | | Change-Id: Ia81db7238b4a13ff2e585aaac9d5e3e91df1e3e0
* | am 2d88862f: Fixing cpplint readability/casting issuesBrian Carlstrom2013-07-191-2/+2
|\ \ | |/ | | | | | | * commit '2d88862f0752a7a0e65145b088f49dabd49d4284': Fixing cpplint readability/casting issues
| * Fixing cpplint readability/casting issuesBrian Carlstrom2013-07-181-2/+2
| | | | | | | | Change-Id: I6821da0e23737995a9b884a04e9b63fac640cd05
* | resolved conflicts for merge of 50af9793 to dalvik-devBrian Carlstrom2013-07-191-1/+1
|\ \ | |/ | | | | Change-Id: I13e7db2b4d4340d2c1a9994a4c6277f04e19d9fb
| * Fix cpplint whitespace/operators issuesBrian Carlstrom2013-07-181-1/+1
| | | | | | | | Change-Id: I730bd87b476bfa36e93b42e816ef358006b69ba5
* | am 0cd7ec2d: Fix cpplint whitespace/blank_line issuesBrian Carlstrom2013-07-181-1/+0
|\ \ | |/ | | | | | | * commit '0cd7ec2dcd8d7ba30bf3ca420b40dac52849876c': Fix cpplint whitespace/blank_line issues
| * Fix cpplint whitespace/blank_line issuesBrian Carlstrom2013-07-181-1/+0
| | | | | | | | Change-Id: Ice937e95e23dd622c17054551d4ae4cebd0ef8a2
* | am 93ba893c: Fix cpplint runtime/explicit issuesBrian Carlstrom2013-07-173-3/+3
|\ \ | |/ | | | | | | * commit '93ba893c20532990a430741e0a97212900094e8c': Fix cpplint runtime/explicit issues
| * Fix cpplint runtime/explicit issuesBrian Carlstrom2013-07-173-3/+3
| | | | | | | | Change-Id: I352ba0b427f1ff9b22887693952b180eae0839ba
* | am fc0e3219: Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-177-18/+23
|\ \ | |/ | | | | | | * commit 'fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d': Fix multiple inclusion guards to match new pathnames
| * Fix multiple inclusion guards to match new pathnamesBrian Carlstrom2013-07-177-18/+23
| | | | | | | | Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43