summaryrefslogtreecommitdiffstats
path: root/runtime/jdwp
Commit message (Collapse)AuthorAgeFilesLines
* JDWP: asynchronous invoke command handlingSebastien Hertz2015-06-125-105/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The JDWP thread used to wait for the result of a method invocation running in an event thread. But doing that prevents the JDWP thread from processing incoming commands from the debugger if the event thread gets suspended by a debug event occurring in another thread. In Android Studio (or another IDE), this leads to the debugger being blocked (with the famous message "Waiting until last debugger command completes" of Android Studio / IntelliJ) because it is actually waiting for the reply of its latest command while the JDWP thread cannot process it. This CL changes the way invoke commands (ClassType.InvokeCommand, ClassType.NewInstance and ObjectReference.InvokeCommand) are handled in the ART runtime. The JDWP thread no longer waits for the event thread to complete the method invocation. It now simply waits for the next JDWP command to process. This means it does not send any reply for invoke commands, except if the information given by the debugger is wrong. In this case, it still sends a reply with the appropriate error code. The event thread is now responsible for sending the reply (containing the result and the exception object of the invoked method) before going back to the suspended state. In other words, we add special handling for invoke commands so they are handled asynchronously while other commands remained handled synchronously. In the future, we may want to handle all commands asynchronously (using a queue of reply/event for instance) to remove the special handling code this CL is adding. Now the JDWP thread can process commands while a thread is invoking a method, it is possible for the debugger to detach (by sending a VirtualMachine.Dispose command) before the invocation completes. In that situation, we must not suspend threads again (including the event thread that executed the method) because they would all remain suspended forever. Also minor cleanup of the use of JDWP constants and update comments. Bug: 21515842 Bug: 18899981 (cherry picked from commit cbc5064ff05179b97b416f00ca579c55e38cd7d9) Change-Id: I8d31006043468913ee8453212e6d16e11fcfe4ea
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-022-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 (cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33) Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d Fix some ArtMethod related bugs Added root visiting for runtime methods, not currently required since the GcRoots in these methods are null. Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes --trace run-tests 005, 044. Fixed optimizing compiler bug where we used a normal stack location instead of double on ARM64, this fixes the debuggable tests. TODO: Fix JDWP tests. Bug: 19264997 Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3 ART: Fix casts for 64-bit pointers on 32-bit compiler. Bug: 19264997 Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457 Fix JDWP tests after ArtMethod change Fixes Throwable::GetStackDepth for exception event detection after internal stack trace representation change. Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of proxy method. Bug: 19264997 Change-Id: I363e293796848c3ec491c963813f62d868da44d2 Fix accidental IMT and root marking regression Was always using the conflict trampoline. Also included fix for regression in GC time caused by extra roots. Most of the regression was IMT. Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to detached thread. EvaluateAndApplyChanges: From ~2500 -> ~1980 GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots Bug: 19264997 Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0 Fix bogus image test assert Previously we were comparing the size of the non moving space to size of the image file. Now we properly compare the size of the image space against the size of the image file. Bug: 19264997 Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a [MIPS64] Fix art_quick_invoke_stub argument offsets. ArtMethod reference's size got bigger, so we need to move other args and leave enough space for ArtMethod* and 'this' pointer. This fixes mips64 boot. Bug: 19264997 Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
* ART: Clean up arm64 kNumberOfXRegisters usage.Vladimir Marko2015-05-262-0/+2
| | | | | | | | | | | | | | | | | | | | | Avoid undefined behavior for arm64 stemming from 1u << 32 in loops with upper bound kNumberOfXRegisters. Create iterators for enumerating bits in an integer either from high to low or from low to high and use them for <arch>Context::FillCalleeSaves() on all architectures. Refactor runtime/utils.{h,cc} by moving all bit-fiddling functions to runtime/base/bit_utils.{h,cc} (together with the new bit iterators) and all time-related functions to runtime/base/time_utils.{h,cc}. Improve test coverage and fix some corner cases for the bit-fiddling functions. Bug: 13925192 (cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0) Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
* JDWP: more GC safetySebastien Hertz2015-05-183-49/+95
| | | | | | | | | | | | Ensures GC safety when keeping references that may be moved by GC: - SingleStepControl: stores ArtMethod* in a GcRoot - ModBasket: stores references in a StackHandleScope Bug: 18166750 (cherry picked from commit 261bc044a3575512869586593e99e97cd8b1c321) Change-Id: I35971a901537956739d1f089d61cb4ea9dc6c93d
* JDWP: properly combine location eventsSebastien Hertz2015-05-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL properly groups JDWP events at the same location: Breakpoint, Single-step, Method Entry and Method Exit. This is necessary if the debugger is not the only instrumentation listener. This matches the behavior of Dalvik, especially for methods with a single return instruction. The interpreter was tuned so the instrumentation callbacks were called to satisfy the debugger with the idea the debugger was the only instrumentation listener. This is not true when method tracing is enabled at the same time. When tracing is enabled, there is always a listener for MethodEntry and MethodExit events (art::Trace class). However, if the debugger is only listening to DexPcMoved event (to manage JDWP Breakpoint event), it will not be notified of this event. We now properly call all the instrumentation callbacks in the interpreter and move the logic specific to debugging into the class DebugInstrumentationListener. This allows to properly group JDWP location events together depending on the sequence of instrumentation callbacks. We add Thread::tls_32bit_sized_values::debug_method_entry_ flag to remember we just entered a method. It replaces the local variable notified_method_entry_event in the interpreter and simplifies the code. Bump oat version to force recompilation because the layout of the Thread class is modified. Bug: 19829329 Bug: 20205350 (cherry picked from commit 9d6bf69ad3012a9d843268fdd5325b6719b6d5f2) Change-Id: I204af9112e37d2eebc86661fb7c961a41c74e598
* Replace NULL with nullptrMathieu Chartier2015-04-223-3/+3
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Fix DCHECK failures from Class::VisitFieldRootsMathieu Chartier2015-04-134-15/+15
| | | | | | | | | | | | | | We now use GetDeclaringClassUnchecked when marking roots to fix flaky test failures. Fixed a race condition in root marking where we could have non zero field array length with a null pointer. Fixed a race condition where we could be marking roots before FixupTemporaryDeclaringClass had finished. The solution is to only do the declaring class CHECK if we are at least resolved. Fixed JDWP tests by changing FieldId / MethodId to be 64 bits. Also some cleanup. Change-Id: Ibac09519860d93c3f68a5cc964bbc91dc10a279a
* Merge "JDWP: fix thread_list deadlock"Sebastien Hertz2015-04-132-3/+13
|\
| * JDWP: fix thread_list deadlockSebastien Hertz2015-04-082-3/+13
| | | | | | | | | | | | | | | | | | Limits the scope of Locks::thread_list_lock_ locking in the debugger so we do not try to lock it twice when creating a JDWP id (because calling Object::IdentityHashCode may need to take the lock). Bug: 20048099 Change-Id: I305dd72ccc4d2d007d1603b0d52bcfa94b6842a7
* | Move ArtField to nativeMathieu Chartier2015-04-102-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add linear alloc. Moved ArtField to be native object. Changed image writer to put ArtFields after the mirror section. Savings: 2MB on low ram devices 4MB on normal devices Total PSS measurements before (normal N5, 95s after shell start): Image size: 7729152 bytes 23112 kB: .NonMoving 23212 kB: .NonMoving 22868 kB: .NonMoving 23072 kB: .NonMoving 22836 kB: .NonMoving 19618 kB: .Zygote 19850 kB: .Zygote 19623 kB: .Zygote 19924 kB: .Zygote 19612 kB: .Zygote Avg: 42745.4 kB After: Image size: 7462912 bytes 17440 kB: .NonMoving 16776 kB: .NonMoving 16804 kB: .NonMoving 17812 kB: .NonMoving 16820 kB: .NonMoving 18788 kB: .Zygote 18856 kB: .Zygote 19064 kB: .Zygote 18841 kB: .Zygote 18629 kB: .Zygote 3499 kB: .LinearAlloc 3408 kB: .LinearAlloc 3424 kB: .LinearAlloc 3600 kB: .LinearAlloc 3436 kB: .LinearAlloc Avg: 39439.4 kB No reflection performance changes. Bug: 19264997 Bug: 17643507 Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
* | Merge "Fix JDWP race at runtime shutdown"Sebastien Hertz2015-04-083-6/+40
|\ \
| * | Fix JDWP race at runtime shutdownSebastien Hertz2015-04-013-6/+40
| |/ | | | | | | | | | | | | | | | | | | When the runtime shuts down, it closes the JDWP connection with the debugger. However, if a JDWP command is still being processed by the JDWP handler thread when we close the connection, we won't be able to send its reply. Bug: 19628620 Change-Id: I20301325a347d66f3b9ef95ebe8f156abafb1f76
* / JDWP: clear exception when allocation failsSebastien Hertz2015-04-021-10/+6
|/ | | | | | | | | | | Clears pending exception if an allocation (requested by the debugger) fails and logs an error message about the failure. Checks we never leave a pending exception after processing a JDWP request. Bug: 20037531 Change-Id: I63239034a3c1ab368b0e19c2f5f756d9e2ec6a29
* JDWP: Optimized single step during debuggingDaniel Mihalyi2015-03-243-16/+1
| | | | | | | | | | | | | | | | | | | | | | | For single stepping full deoptimization and undeoptimizations were performed with significant overhead, because every code will be executed in interpreted mode during a single step, even if it is not strictly required. For example, if we have a computation heavy method call and we would like to step over it, that method (and all the methods called from it) will run in interpreter mode. This can take so long in some cases (e.g. multiple minutes) that it makes debugging process unusable. The solution for this limitation is not using full deoptimizations for single steps and force interpreter only for those methods that we are about to step into, and require stack deoptimization before step outs. Bug: 17750566 Bug: 18094282 Bug: https://code.google.com/p/android/issues/detail?id=77984 Change-Id: I683c52465883146c4c84ec47bf96f8efd920527f Signed-off-by: Daniel Mihalyi <daniel.mihalyi@mattakis.com>
* JDWP: allocate DebugInvokeReq only when requestedSebastien Hertz2015-03-092-43/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only allocates thread-local DebugInvokeReq when the debugger requests a thread to invoke a method. The JDWP thread allocates that structure then attaches it to the target thread. When the thread is resumed, it executes the method. Once the invocation completes, the thread detaches the DebugInvokeReq, signals the JDWP thread then suspends. Finally, the JDWP thread wakes up, prepares the reply with the invoke result (or exception) and deallocates the DebugInvokeReq. Also ensures GC safety for object returned by the invoke. We add the object to the JDWP object registry right after the invoke. We now reference that object with a JDWP ObjectID instead of an Object* in the DebugInvokeReq struct. This prevent from accessing a stale reference if the GC runs and moves the Object*. This CL includes the following changes: - Move former DebugInvokeReq::ready flag to Thread::tls_32bit_sized_values::ready_for_debug_invoke. It's needed to know whether a thread has been suspended by an event, thus ready to invoke a method from the debugger. - Remove DebugInvokeReq::invoke_needed: we now test if we attached a DebugInvokeReq* to the thread. - Rename misleading FinishMethod function to RequestMethod. Bug: 19142632 Bug: 18166750 Change-Id: I351fb4eb94bfe69fcafb544d21d55ff35a033000
* Fix some incorrect IsCompiler instead of IsAotCompilerMathieu Chartier2015-03-051-1/+1
| | | | | | | Fixes jdwp related issues (DDMS) when JIT is enabled. Bug: 19623297 Change-Id: I36139c70a97b529135febcf01b227e7ab9affacc
* Merge "JDWP: fix thread state on event suspension"Sebastien Hertz2015-02-261-1/+5
|\
| * JDWP: fix thread state on event suspensionSebastien Hertz2015-02-251-1/+5
| | | | | | | | | | | | | | | | Before suspending event thread, we ensure its state is kSuspended so the debugger sees it as RUNNING instead of WAIT. Bug: 19103406 Change-Id: I58b4141a958bf6a3c360f6994967fad0078ea373
* | JDWP: assert no pending exception when using JNISebastien Hertz2015-02-241-0/+2
|/ | | | | | | | | Checks there is no pending exception when creating new JDWP ids using JNI routines. We can create JDWP ids when executing code and report an event like a breakpoint. Bug: 17491155 Change-Id: I4e5851bf2261510b7776a709a2388e7ff586a77c
* JDWP: update thread synchronizationSebastien Hertz2015-02-064-136/+105
| | | | | | | | | | | | | | | | | | | | | | This CL ensures only one thread can do JDWP stuff at a time: either processing a command coming from the debugger (JDWP thread) or sending an event (breakpoint, class prepare, etc) to the debugger before suspending. The JDWP thread now uses AcquireJdwpTokenForCommand and ReleaseJdwpTokenForCommand, respectively acquiring and releasing the token used for synchronization. On the other hand, the event threads now use AcquireJdwpTokenForEvent and ReleaseJdwpTokenForEvent. During an invoke, the target thread needs to take the JDWP token to execute the method while it's already held by the JDWP handler thread waiting for the invocation to complete. To avoid both threads from waiting for each other (deadlock), the JDWP thread releases the token and acquires it again after the invocation is complete, so the target thread can run safely and prevents other threads from sending events. Bug: 19120467 Change-Id: Ie3208fb940a60573769d494128cf22f0fa30fa61
* Read JDWP options from runtimeSebastien Hertz2015-02-051-5/+5
| | | | | | | | | | | | Allocates JDWP::JdwpOptions on the heap and copies parsed options to avoid the need to include jdwp/jdwp.h into runtime.h file. Also does some minor cleanup and removes the old JDWP options parsing code that became dead code after we move it to the new command-line parser. Bug: 19275792 Change-Id: I71901c89fbf2cc3c1901a089e2a98b4326c6ee70
* art: Refactor RuntimeOptions/ParsedOptionsIgor Murashkin2015-02-042-0/+14
| | | | | | | | | | | | | Refactor the RuntimeOptions to be a type-safe map (VariantMap, see runtime_options.h) and the ParsedOptions to delegate the parsing to CmdlineParser (see cmdline/cmdline_parser.h). This is the start of a command line parsing refactor, and may include more in the future (dex2oat, patchoat, etc). For more details of the command line parsing generator usage see cmdline/README.md Change-Id: Ic67c6bca5e1f33bf2ec60e2e3ff8c366bab91563
* Merge "JDWP: fix deadlock with GC"Sebastien Hertz2015-01-141-1/+14
|\
| * JDWP: fix deadlock with GCSebastien Hertz2015-01-131-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL fixes a deadlock where JDWP thread and running GC thread are waiting for each other. Here is the sequence of the deadlock: 1. GC thread disables access to weak global references, then releases mutator lock. 2. JDWP thread takes mutator lock exclusively after suspending all threads. 3. GC thread waits for shared mutator lock which is held by JDWP thread. 4. JDWP thread clears weak global references but need to wait for GC thread to re-enable access to them. To avoid that situation, we ensure the JDWP thread does not attempt to delete weak global references while holding the mutator exclusively so GC thread is not blocked. Bug: 18995321 Change-Id: Ia7e82f463c27ffdcfd730c3117337a6a33d111e7
* | Fix bootclasspath string initializationSebastien Hertz2015-01-131-4/+4
|/ | | | | | | | | | | | | When running the runtime with an image without explicitly specifying the bootclasspath (with the -Xbootclasspath option), we construct it from the location of DEX files loaded from the image. This allows to fix the JDWP test ClassPathsTest#testClassPaths001 on the host where the bootclasspath is not explicitly specified on the command line. Bug: 18812378 Change-Id: I726eafd8b9e59dc9513beeb7082cf086fe89c4b1
* Change hprof to use streamingMathieu Chartier2015-01-094-9/+30
| | | | | | | | | | | | | | | Previously, we compute the whole hprof dump in memory resulting in > 50MB of memory usage for some apps (such as maps). This could cause the app to get killed by the low memory killer. The solution works by doing the dump in 2 passes. The first pass calculates the size of the dump. The second pass starts by sending the DDMS header with the correct size, then does the rest of the hprof dump by streaming and sending data one HprofRecord at a time. Bug: 18921793 Change-Id: I7dd9f5cfe49799ba268095c994a8c2eb1fe493df
* JDWP: do not report start/end events for thread without peerSebastien Hertz2014-12-181-0/+8
| | | | | | | | | | | | To report start/end thread events, we need the JDWP id of the thread. To create a JDWP id, we need its java.lang.Thread peer. In the case there is no Java peer, we can't report the event. Follow-up https://android-review.googlesource.com/118548 where the runtime attaches the current thread without Java peer when shutting down. Change-Id: Icc2d50f3d2eedd1e0e3c5a21affd2261aaf7a862
* Cleanup JDWP event matchingSebastien Hertz2014-12-178-441/+376
| | | | | | | | * Use std::vector for the event match list. * Make event reporting methods void since result is never used. * Use nullptr keyword instead of NULL. Change-Id: Icd6f47e46cefc2cc63325df00037cd4b6a475259
* JDWP: avoid crash on unsupported modifierSebastien Hertz2014-12-091-2/+4
| | | | | | | | | | Returns NOT_IMPLEMENTED error if we receive an event request with an unsupported modifier. Bug: https://code.google.com/p/android/issues/detail?id=81037 Bug: 18617787 (cherry picked from commit 0fb33e7b7b0b86fb9c7b556e4a052874ec269bb0) Change-Id: I97729e2f98af3a75d24604926a89860255d4acae
* JDWP: only deoptimize when it is requiredSebastien Hertz2014-11-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to deoptimize anything when we forced the use of the interpreter (-Xint). In this case, no compiled code is executed (except native methods which are not concerned by deoptimization). Therefore we even don't need to enable/disable deoptimization support in instrumentation. We also don't need to deoptimize a method that hasn't been compiled. Since it will run with interpreter, there is no point deoptimizing it. However this method may be inlined in a compiled caller method so we still need to deoptimize everything in this case. This CL updates breakpoint support by storing the required kind of deoptimization for a particular method. There are 3 cases: - kNothing: the method does not require deoptimization. - kSelectiveDeoptimization: the method needs to be deoptimized. - kFullDeoptimization: we must deoptimize everythinig. When uninstalling a breakpoint, we need to do the reverse operation. Also fixes the SanityCheckExistingBreakpoints function to control breakpoints related to the given method only and adds extra verbose logs when choosing the appropriate deoptimization kind. Bug: 18407046 Change-Id: I5212c1fd2f72e06c79e7871db15696824d37dc0b
* kill HAVE_GETHOSTBYNAME_RYabin Cui2014-11-131-1/+1
| | | | | Bug: 18363225 Change-Id: I71a62235db14412d2471f20ea663beb7df7326cd
* ART: More warningsAndreas Gampe2014-11-045-17/+17
| | | | | | | Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-032-0/+2
| | | | | | | | | | | Fix associated errors about unused paramenters and implict sign conversions. For sign conversion this was largely in the area of enums, so add ostream operators for the effected enums and fix tools/generate-operator-out.py. Tidy arena allocation code and arena allocated data types, rather than fixing new and delete operators. Remove dead code. Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
* Merge "Make ObjectRegistry::InternalAdd GC safe"Sebastien Hertz2014-10-242-22/+10
|\
| * Make ObjectRegistry::InternalAdd GC safeSebastien Hertz2014-10-232-22/+10
| | | | | | | | | | | | | | | | | | | | | | Because a call to IdentityHashCode may cause GC, the object pointer may become invalid (if the object has been moved) on next uses. We now access the object through a Handle to be GC safe. Also remove unused methods. Bug: 18098424 Change-Id: I38fb55c3a6be62c4d98d4c94272a9cfeba327598
* | Make ART compile with GCC -O0 again.Ian Rogers2014-10-161-2/+2
|/ | | | | | | | | | | | | Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on architecture. Add to instruction_set_test to warn when InstructionSetFeatures don't agree with ones from system properties, AT_HWCAP and /proc/cpuinfo. Clean-up class linker entry point logic to not return entry points but to test whether the passed code is the particular entrypoint. This works around image trampolines that replicate entrypoints. Bug: 17993736 Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
* Only watch location for BREAKPOINT eventSebastien Hertz2014-10-091-4/+12
| | | | | | | | | | | | This CL ensures we watch a location for BREAKPOINT event only. Other events (single-step, method entry/exit, ...) are handled differently and LocationOnly modifier is used as an event filter in this case. This prevents from failing a check when we need to deoptimize for non-breakpoint event. Bug: 17908144 Change-Id: Ib413d62fa31480fec8d750543c0605ba52188350
* Merge "Optimize JDWP stack local values access"Sebastien Hertz2014-09-221-38/+2
|\
| * Optimize JDWP stack local values accessSebastien Hertz2014-09-221-38/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The StackFrame.GetValues and StackFrame.SetValues JDWP commands can refer to multiple variables at the same time in a given frame. However we used to walk the stack until getting to the requested frame for each variable. Now, we walk the stack only once until getting to the frame so the context is initialized. Then we read/write value for each variable from this context. Bug: 17343501 Bug: 15680615 Change-Id: I2a4128f29a3c5856b994e280037c0a09eb48c5c8
* | Fix JDWP crash when reporting exceptionSebastien Hertz2014-09-221-3/+10
|/ | | | | | | | | | The exception's throw location may be null so we need to handle that case. Also fixes a memset issue. Bug: 17571297 (cherry picked from commit bbb63897d7f2d99219cb50721fe530521e08ddff) Change-Id: Iedebb58f9460c5f04913c269200e51161bda1ba9
* Merge "Move spammy logs to JDWP verbose mode"Sebastien Hertz2014-09-191-4/+5
|\
| * Move spammy logs to JDWP verbose modeSebastien Hertz2014-09-181-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are spammed by warning messages when debugging, especially each time we suspend/resume all threads (to update instrumentation or collect monitor info). It's common to get into the cases where these warnings are logged so they shouldn't be warning but debug messages. This CL moves these LOG(WARNING) to VLOG(jdwp) to not disturb developers when debugging their app (especially when looking for specific messages in logcat). We keep them in JDWP verbose mode because they help knowing when we initiate these sequences of "suspend/resume all threads". Also adds debug suspend count in the log message for more context. Bug: 17524544 Bug: 17170697 Change-Id: Ic87985ac6913151d15fd89849e41bde61092c3dd
* | Update JDWP event filtering to avoid useless idsSebastien Hertz2014-09-182-169/+264
|/ | | | | | | | | | | | | | | To reduce the number of JDWP ids in the debugger, we update the event filtering support to work with runtime objects (Thread, Class, Object, ...) instead of JDWP ids (ThreadId, RefTypeId, ObjectId, ...). We used to create useless JDWP ids for events even if they were not reported because of event filtering (thread only, class only, instance only, ...). Now we only create JDWP ids when we know we're going to report an event. Bug: 17343664 (cherry picked from commit d539167b7f11136fe570a77aff2ee4935842007a) Change-Id: I8619e219733fc2fa3569f473b7bd8d9af4181f2b
* Avoid crash in StringReference.Value JDWP commandSebastien Hertz2014-09-171-2/+11
| | | | | | | | | | | | Checks for null or invalid object id. Also checks whether the corresponding object is a java.lang.String. Bug: 17492221 Bug: 15005460 (cherry picked from commit 29259fa6b0514866d2d4bf57d58c1557b26abbb7) Change-Id: I52673bdef6912a4cccf5a6eeecb6e1e817b9dd6b
* Check for errors in ThreadGroupReference JDWP commandsSebastien Hertz2014-09-161-26/+4
| | | | | | | | | | Returns INVALID_OBJECT error for null or invalid object. Also returns INVALID_THREAD_GROUP error when the object is not a java.lang.ThreadGroup. Removes unused Dbg::GetMainThreadGroupId method. Bug: 17503230 Change-Id: Ifae39b0280633836655b22fc212018cb06b65c6c
* Fix deadlock in VirtualMachine.AllThreadsSebastien Hertz2014-09-111-1/+2
| | | | | | | | | | | | We cannot add any object in the JDWP object registry while holding the Locks::thread_list_lock. Indeed we may need to suspend a thread and take it, causing a deadlock by waiting for ourself on this lock. Bug: 17343664 (cherry picked from commit d35776413901a6a9d478e06dc354ea4f7d962e04) Change-Id: I07d150b95a6d2b62c913bf2ca2ac217911b2f19d
* Don't hold any lock when visiting classes from JDWPSebastien Hertz2014-09-111-8/+23
| | | | | | | | | | | | | | | | Computes reference type ids of all loaded classes without holding the class linker lock. Because computing the JDWP reference type id can cause thread suspension, we can't hold any lock. This is detected in debug build (using libartd.so) and causes an abort. Also adds missing thread safety annotations related to ObjectRegistry::lock_. Bug: 17305632 Bug: 16720689 (cherry picked from commit 95795e286145a4aece5c4a095fa2e7e88ee2115a) Change-Id: If4fb069790a0a3358ad49da8f75c62a54c0f0b56
* Remove abuse of mirror::Object* to reference special values.Ian Rogers2014-09-036-260/+261
| | | | | | | | | | | | | Remove kInvalidIndirectRefObject, kClearedJniWeakGlobal and ObjectRegistry::kInvalidObject. Handle error conditions by passing in or returning an error value. GetObjectRefType is simplified to be faster and not return invalid references that are not expected according to the spec. Adjust check JNI and jni_internal_test appropriately. Fix cases in the debugger/JDWP of out arguments being passed by reference. Bug: 17376993 Change-Id: I3ce8a28c01827e163f4dc288449959464da788b1
* Reduce and speed-up class def searches.Ian Rogers2014-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | Use the class linker for descriptor lookups from the compile driver so that dex caches are populated. Reduce the scope of functions for scanning class paths to just the class linker where they are performed. If we see more than a threshold number of find class def misses on a dex file lazily compute an index, so that future lookups are constant time (part of the collection code is taken from https://android-review.googlesource.com/#/c/103865/3). Note that we take a lazy approach so that we don't serialize on loading dex files, this avoids the reason the index was removed in 8b2c0b9abc3f520495f4387ea040132ba85cae69. Remove an implicit and unnecessary std::string creation for PrintableString. Single threaded interpret-only dex2oat performance is improved by roughly 10%. Bug: 16853450 Change-Id: Icf72df76b0a4328f2a24075e81f4ff267b9401f4
* Avoid null pointer dereference when sending JDWP packetsSebastien Hertz2014-08-281-2/+2
| | | | | | Bug: 16218394 Change-Id: Id0ab09401b01f3041ea36013330a000d7702d8fa