summaryrefslogtreecommitdiff
path: root/runtime/signal_catcher.cc
AgeCommit message (Collapse)Author
2025-01-21Add support for collecting long running methods Mythri Alle
This CL extends low overhead tracing to support collecting long running methods. This feature is disabled by default and is implemented behind always_enable_profiling_code flag. Turning on the flag enables the support but doesn't start tracing. Tracing has to be started via the StartTraceLongRunningMethods interface in VMDebug. If a trace was running the collected data is included in the data generated by the SIGQUIT handlers. This would help when analyzing ANR reports. The trace can also be dumped using the API provided in VMDebug. Bug: 352518093 Test: art/test.py Change-Id: I407560c45cd31bfa06906bb2286c455eef7ceec8
2024-06-05Integrate Debug Store in Process's SIGQUIT Dump and Add Corresponding ↵ Mohamad Mahmoud
Palette Functions Add a debug store header to Sigquit's dump and add the supporting palette functions. Bug: 314735374 Test: atest && manual testing Change-Id: I44e9bfe28f98f12c994901dc41ffb4de04eac9ec
2024-01-31Add visibility attributes in runtime/s* Dmitrii Ishcheikin
Bug: 260881207 Test: presubmit Test: abtd app_compat_drm Test: abtd app_compat_top_100 Test: abtd app_compat_banking Change-Id: Ib074e7b5ab0725fea5640ed7deaac3452fc27864
2023-11-14Print the signal catcher tid when we fail to kill it. Nicolas Geoffray
Bug: 70426310 Test: test.py Change-Id: I5b7ffe9f7b93c8d0d4af3b51e1492007714be9a0
2023-11-08Report latency from receiving SIGQUIT to start of backtrace. David Srbecky
Bug: 295807081 Test: Trigger ANR on device and observe output. Change-Id: I9feb82a510550a93e55b48ab7fcb54b576dfc8bf
2021-11-25Always access Thread state and flags as 32-bit location. Vladimir Marko
Rewrite access to Thread's state and flags to use 32-bit atomic operations. Avoid `volatile` accesses that prevent compiler optimizations. Change `ThreadState` and `ThreadFlag` to `enum class`es. Golem results for art-opt-cc (higher is better): linux-ia32 before after NativeDowncallStaticNormal 28.162 35.323 (+25.43%) NativeDowncallStaticNormal6 26.447 32.951 (+24.59%) NativeDowncallStaticNormalRefs6 NativeDowncallVirtualNormal 27.972 35.027 (+25.22%) NativeDowncallVirtualNormal6 26.096 32.131 (+23.13%) NativeDowncallVirtualNormalRefs6 25.922 31.873 (+22.95%) linux-x64 before after NativeDowncallStaticNormal 26.987 34.380 (+27.40%) NativeDowncallStaticNormal6 25.424 31.096 (+22.31%) NativeDowncallStaticNormalRefs6 25.086 30.602 (+21.99%) NativeDowncallVirtualNormal 26.812 33.234 (+23.95%) NativeDowncallVirtualNormal6 25.086 30.617 (+22.05%) NativeDowncallVirtualNormalRefs6 25.086 30.602 (+21.99%) linux-armv7 before after NativeDowncallStaticNormal 7.2394 7.9523 (+9.848%) NativeDowncallStaticNormal6 6.8527 7.4888 (+9.283%) NativeDowncallStaticNormalRefs6 6.3976 6.9444 (+8.547%) NativeDowncallVirtualNormal 7.2081 7.9130 (+9.779%) NativeDowncallVirtualNormal6 6.8527 7.4888 (+9.283%) NativeDowncallVirtualNormalRefs6 6.3168 6.8527 (+8.483%) linux-armv8 before after NativeDowncallStaticNormal 7.0389 7.5973 (+7.933%) NativeDowncallStaticNormal6 6.8527 7.3783 (+7.670%) NativeDowncallStaticNormalRefs6 6.2924 6.8226 (+8.427%) NativeDowncallVirtualNormal 6.8527 7.3783 (+7.670%) NativeDowncallVirtualNormal6 6.5604 7.0423 (+7.344%) NativeDowncallVirtualNormalRefs6 6.1408 6.5329 (+6.386%) Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Test: run-gtests.sh Test: testrunner.py --target --optimizing --interpreter Bug: 172332525 Bug: 143299880 Change-Id: Ib55d457ad8f5d9e1159b681dfd279d1f9cfb2af7
2021-02-06libartpalette: Use fixed width typedef rather than enum for status Orion Hodson
As the NDK guidelines note, the size of an enum is a compiler choice so an enum of unqualifed width cannot be considered stable ABI. Bug: 122824298 Test: TH Change-Id: I63d42fdb5a989aab15ec995529781b1b8c3ddb7a
2019-05-16ART: Remove file_utils' ReadFileToString Andreas Gampe
Replace with libbase. Test: mmma art Change-Id: Id042f4879485e743e3dc7548434be1634370ee66
2019-05-09Move stack logging entirely into palette library Orion Hodson
Make SignalCatcher::Output the same on host and target. Apply same logic of when to log stacks to system logger as prior to PaletteTombstonedMessage introduction. Add PaletteStatus::kFailedCheckLog Bug: 130025619 Test: art/tools/buildbot-build.sh --host -j100 && art/test.py --host -j32 Test: adb shell killall -QUIT system_server and check /data/anr Test: Fill /data using 'dd', again send SIGQUIT to system and \ check logcat for stack traces. Test: adb bugreport; check the produced report Change-Id: I1b3b6780622b9799d61fb12ad11a28085729c5e9
2019-05-02Only write stacks traces to tombstoned Joe Onorato
When writing to tombstoned fails, do not write stack traces to the log. The failure is a likely symptom of a more fundamental issue. (cherry picked from commit 6cca24104ae06c7cd948e466af127bf1bc620f81) Test: make Bug: 130025619 Change-Id: I3c7e895dff7d9df5f8d14c1b1235c1c943d32295 Merged-In: I3c7e895dff7d9df5f8d14c1b1235c1c943d32295
2019-04-16Clean up error messages in the previous CL. Martin Stjernholm
TIL PLOG already logs the errno message, so it got logged twice SignalCatcher::Output. Switch to PLOG for the corresponding messages in palette_android.cc for brevity, and switch to LOG in the caller since the errno message already has been logged by then. Test: adb shell killall -QUIT system_server with a nearly full data partition; check logcat output. Bug: 130025619 Change-Id: I973b04461de3492e3cb3e5855fc06e99efe32c0a
2019-04-15Plumb tombstoned connections through PALette. Martin Stjernholm
This removes APEX internal dependencies on libtombstoned_client and libcutils. Test: art/build/apex/runtests.sh Test: adb shell killall -QUIT system_server; check tombstoned report in /data/anr Test: Make /data nearly full; adb shell killall -QUIT system_server; check that the report in /data/anr has zero length and that the stack traces are sent to logcat instead Bug: 130025619 Change-Id: I93dae3729c0e4de9e32b942e6c85915b56d8114a
2018-10-23ART: Refactor for bugprone-argument-comment Andreas Gampe
Handles runtime. Bug: 116054210 Test: WITH_TIDY=1 mmma art Change-Id: Ibc0d5086809d647f0ce4df5452eb84442d27ecf0
2018-05-04ART: Remove tombstoned parameters Andreas Gampe
These are no longer supported. Always try to use tombstoned when on a device. Bug: 77288304 Test: m test-art-host Test: Device boots Test: manual ANR dumps work Change-Id: Iffd3287432becfc7982cdcb9a0cfe44f0c5b5143
2018-03-05Move most of runtime/base to libartbase/base David Sehr
Enforce the layering that code in runtime/base should not depend on runtime by separating it into libartbase. Some of the code in runtime/base depends on the Runtime class, so it cannot be moved yet. Also, some of the tests depend on CommonRuntimeTest, which itself needs to be factored (in a subsequent CL). Bug: 22322814 Test: make -j 50 checkbuild make -j 50 test-art-host Change-Id: I8b096c1e2542f829eb456b4b057c71421b77d7e2
2018-02-27Small documentation and stylistic changes. Roland Levillain
Test: art/test.py Change-Id: Ibc74ee4783314266bf1d027811715058626c57c8
2017-12-07ART: Factor out gAborting Andreas Gampe
Cut dependencies on base/logging.h by moving gAborting to its own header. Leave the static storage in logging.cc. Test: m Change-Id: Ib2ca880e15f9cb50cb9aab803784826bb46efb5e
2017-11-01Separate file utilities from utils.cc David Sehr
Reduce the dependencies from utils.cc to arch/ subdirectories, etc. Bug: 22322814 Test: make test-art-host Change-Id: I4decd15ff4ec460735bfb58cebb1c6a1bf32b68f
2017-10-16signal_catcher: print errno when tombstoned_notify_completion fails. Josh Gao
Failure here could either be someone internal closing our FD (EBADF) or tombstoned closing its end of the socket (EPIPE). Print the error to disambiguate the cases. Bug: 67805174 Test: treehugger Change-Id: Ie35cb31218b5bb08757e61360c6539d39eece08b
2017-10-03signal_catcher: reformat includes. Josh Gao
Test: treehugger Change-Id: I03daad9749bd6be7267a2e416507d6869867d0b4
2017-07-11signal_catcher: Only notify tombstoned when we're using it. Narayan Kamath
This would otherwise cause a benign warning message when tombstoned based stack dumping was turned off. The notify would fail immediately with an EPERM due to SELinux restrictions. Bug: 62779030 Test: test-art-host Change-Id: Icc92cf0ebf146091317bb48b9968e20e9ab99da5
2017-05-31signal_catcher: track tombstoned API changes. Narayan Kamath
tombstoned_connect now has an enum parameter that specifies the dump type. Test: make Bug: 32064548 Change-Id: I96d85240679dd1bab962ab7a1f5fe20ee02c876b
2017-05-24ART: Use file descriptors handed out by tombstoned for traces. Narayan Kamath
There no longer needs to be any logic in ART to generate file names and create files. The test of file creation logic has therefore been deleted. Test: manual, tests in other components. Bug: 32064548 Change-Id: I9bce6ddf3270839c40060d1287e79f9bd57d75aa
2017-04-27SignalCatcher: Minor tweaks to log message. Narayan Kamath
We were logging the wrong field. Also fix the exemplar path name in the documentation. Test: make, manual Bug: 32064548 Change-Id: Ic4670087dc1cfbe874349f064634682d93537ceb
2017-04-25ART: Support per PID stack trace files. Narayan Kamath
Introduce an -Xstacktracedir argument that supplies a directory under which stack traces are written, with a unique file created per trace. The location of the actual directory in a production system is still not decided, and follow up changes might be introduced to supply a per process override. Bug: 32064548 Test: test-art-host, test-art-target Change-Id: If377ce6a2abe8b325f6441d8de222b1ea3f40ec9
2017-04-06Force save profiles for SIGUSR1 Mathieu Chartier
Force save profiles from signal catcher for SIGUSR1. Saving the profiles is expensive but we already do a GC which is also expensive for this signal. Test: adb shell ls -l /data/misc/profiles/cur/1000/system_server/ Test: adb shell kill -s SIGUSR1 `pid system_server` Test: adb shell ls -l /data/misc/profiles/cur/1000/system_server/ Bug: 36457259 Bug: 34927277 (cherry picked from commit 8f23d97af3b10ae56fb16d63fd2932098dac45c0) Change-Id: I810b66a7fe4b06efc7468d65ac737d74c5669abe
2016-09-29Clean up ScopedThreadStateChange to use ObjPtr Mathieu Chartier
Also fixed inclusion of -inl.h files in .h files by adding scoped_object_access-inl.h and scoped_fast_natvie_object_access-inl.h Changed AddLocalReference / Decode to use ObjPtr. Changed libartbenchmark to be debug to avoid linkage errors. Bug: 31113334 Test: test-art-host Change-Id: I4d2e160483a29d21e1e0e440585ed328b9811483
2016-09-26ART: Use libbase logging Andreas Gampe
Move most of our logging infrastructure over to system/core/base. Retain VLOG. Using unified Android infrastructure has two main advantages. First, it reduces the complexity/maintenance burden in ART. Second, it allows to detach logging for the cases where we do not want or need a runtime, e.g., dexdump, the disassembler, etc. As a part of the latter, libbase is also supported for all hosts (including Windows). From a developer viewpoint, there are minor behavior changes for the LOG statements (see above), but otherwise usage is the same. Explicit severity enum items are in the android::base namespace now. Bug: 31338270 Test: m test-art-host Change-Id: I5abcb2f45f5b03d49951874c48544f72a283a91b
2015-07-24ART: Change the stack dump format to be in line with debuggerd Andreas Gampe
Make offsets 16 digits on 64-bit platforms. Add the ability to provide the build fingerprint, and print it in the traces output. Bug: 22693991 (cherry picked from commit 242ae94dc39be53e519a6163ea1db494ceb75954) Change-Id: Ibd3d3b3bd65dce84acfb97a487807d6f280a9508
2015-05-26ART: Clean up arm64 kNumberOfXRegisters usage. Vladimir Marko
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 Change-Id: I704884dab15b41ecf7a1c47d397ab1c3fc7ee0f7
2015-04-22Replace NULL with nullptr Mathieu Chartier
Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
2015-02-24Revert "Revert "Add JIT"" Mathieu Chartier
Added missing EntryPointToCodePointer. This reverts commit a5ca888d715cd0c6c421313211caa1928be3e399. Change-Id: Ia74df0ef3a7babbdcb0466fd24da28e304e3f5af
2015-02-24Revert "Add JIT" Nicolas Geoffray
Sorry, run-test crashes on target: 0-05 12:15:51.633 I/DEBUG (27995): Abort message: 'art/runtime/mirror/art_method.cc:349] Check failed: PcIsWithinQuickCode(reinterpret_cast<uintptr_t>(code), pc) java.lang.Throwable java.lang.Throwable.fillInStackTrace() pc=71e3366b code=0x71e3362d size=ad000000' 10-05 12:15:51.633 I/DEBUG (27995): r0 00000000 r1 0000542b r2 00000006 r3 00000000 10-05 12:15:51.633 I/DEBUG (27995): r4 00000006 r5 b6f9addc r6 00000002 r7 0000010c 10-05 12:15:51.633 I/DEBUG (27995): r8 b63fe1e8 r9 be8e1418 sl b6427400 fp b63fcce0 10-05 12:15:51.633 I/DEBUG (27995): ip 0000542b sp be8e1358 lr b6e9a27b pc b6e9c280 cpsr 40070010 10-05 12:15:51.633 I/DEBUG (27995): Bug: 17950037 This reverts commit 2535abe7d1fcdd0e6aca782b1f1932a703ed50a4. Change-Id: I6f88849bc6f2befed0c0aaa0b7b2a08c967a83c3
2015-02-23Add JIT Mathieu Chartier
Currently disabled by default unless -Xjit is passed in. The proposed JIT is a method JIT which works by utilizing interpreter instrumentation to request compilation of hot methods async during runtime. JIT options: -Xjit / -Xnojit -Xjitcodecachesize:N -Xjitthreshold:integervalue The JIT has a shared copy of a compiler driver which is accessed by worker threads to compile individual methods. Added JIT code cache and data cache, currently sized at 2 MB capacity by default. Most apps will only fill a small fraction of this cache however. Added support to the compiler for compiling interpreter quickened byte codes. Added test target ART_TEST_JIT=TRUE and --jit for run-test. TODO: Clean up code cache. Delete compiled methods after they are added to code cache. Add more optimizations related to runtime checks e.g. direct pointers for invokes. Add method recompilation. Move instrumentation to DexFile to improve performance and reduce memory usage. Bug: 17950037 Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
2014-11-18ART: Track Flush & Close in FdFile Andreas Gampe
Implement a check that aborts when a file hasn't been explicitly flushed and closed when it is destructed. Add WARN_UNUSED to FdFile methods. Update dex2oat, patchoat, scoped_flock and some gtests to pass with this. (cherry picked from commit 9433ec60b325b708b9fa87e699ab4a6565741494) Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
2014-11-13Instruction set features for ARM64, MIPS and X86. Ian Rogers
Also, refactor how feature strings are handled so they are additive or subtractive. Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler rather than #ifdefs that wouldn't have worked in cross-compilation. Add SIMD features for x86/x86-64 proposed in: https://android-review.googlesource.com/#/c/112370/ Bug: 18056890 Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
2014-10-22C++11 related clean-up of DISALLOW_.. Ian Rogers
Move DISALLOW_COPY_AND_ASSIGN to delete functions. By no having declarations with no definitions this prompts better warning messages so deal with these by correcting the code. Add a DISALLOW_ALLOCATION and use for ValueObject and mirror::Object. Make X86 assembly operand types ValueObjects to fix compilation errors. Tidy the use of iostream and ostream. Avoid making cutils a dependency via mutex-inl.h for tests that link against libart. Push tracing dependencies into appropriate files and mutex.cc. x86 32-bit host symbols size is increased for libarttest, avoid copying this in run-test 115 by using symlinks and remove this test's higher than normal ulimit. Fix the RunningOnValgrind test in RosAllocSpace to not use GetHeap as it returns NULL when the heap is under construction by Runtime. Change-Id: Ia246f7ac0c11f73072b30d70566a196e9b78472b
2014-10-22Tidy up logging. Ian Rogers
Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to dex2oat rather than runtime argument "-verbose-methods:". Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc except for a forward declaration. Remove ConstDumpable as Dump methods are all const (and make this so if not currently true). Make LogSeverity an enum and improve compile time assertions and type checking. Remove log_severity.h that's only used in logging.h. With system headers gone from logging.h, go add to .cc files missing system header includes. Also, make operator new in ValueObject private for compile time instantiation checking. Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
2014-09-12Compile time performance improvements focusing on interpret-only. Ian Rogers
Reduce virtual method dispatch in the method verifier and make more code inline-able. Add a StringPiece with const char* equality operator to avoid redundant StringPieces and strlens. Remove back link from register line to verifier and pass as argument to reduce size of RegisterLine. Remove instruction length from instruction flags and compute from the instruction, again to reduce size. Add suspend checks to resolve and verify to allow for more easy monitor inflation and reduce contention on Locks::thread_list_suspend_thread_lock_. Change ThrowEarlierClassFailure to throw pre-allocated exception. Avoid calls to Thread::Current() by passing self. Template specialize IsValidClassName. Make ANR reporting with SIGQUIT run using checkpoints rather than suspending all threads. This makes the stack/lock analysis less lock error prone. Extra Barrier assertions and condition variable time out is now returned as a boolean both from Barrier and ConditionVariable::Wait. 2 threaded host x86-64 interpret-only numbers from 341 samples: Before change: Avg 176.137ms 99% CI 3.468ms to 1060.770ms After change: Avg 139.163% 99% CI 3.027ms to 838.257ms Reduction in average compile time after change is 20.9%. Slow-down without change is 26.5%. Bug: 17471626 - Fix bug where RegTypeCache::JavaLangObject/String/Class/Throwable could return unresolved type when class loading is disabled. Bug: 17398101 Change-Id: Id59ce3cc520701c6ecf612f7152498107bc40684
2014-09-11Print the command line and ABI in stack dumps like debuggerd. Jeff Brown
Ensure the heading is "Cmd line:" just like debuggerd and as it used to be in Dalvik. Fix a missing newline. Trim all training nulls from the command line. Don't bother printing the original command line if unset. Add the ABI to the dump to help the native stack symbol tool. Bug: 17474152 (cherry picked from commit 09865b8aa2d85f2824fbdac8034cab01629e8adc) Change-Id: I52d55660276092ed73b61d5e0708460ec39f1a4a
2014-05-19Now we have a proper C++ library, use std::unique_ptr. Ian Rogers
Also remove the Android.libcxx.mk and other bits of stlport compatibility mechanics. Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
2014-01-15Run checkpoints after resuming threads in signal catcher SIGQUIT. Mathieu Chartier
Previously we were running checkpoints after restoring the thread state, but before resuming the threads. This caused an issue with profiler checkpoints since these use a ScopedObjectAccess. Since we had with exclusive access to the mutator lock when we ran the checkpoints, it caused deadlocks when we tried to gain shared access to the mutator lock in the ScopedThreadStateChange if the old_state was any state other than kRunnable. Bug: 12490061 Change-Id: I5f922693a4bf5d18cf9d22f1f28a7a04b6bfc077
2013-10-02Inflate contended lock word by suspending owner. Ian Rogers
Bug 6961405. Don't inflate monitors for Notify and NotifyAll. Tidy lock word, handle recursive lock case alongside unlocked case and move assembly out of line (except for ARM quick). Also handle null in out-of-line assembly as the test is quick and the enter/exit code is already a safepoint. To gain ownership of a monitor on behalf of another thread, monitor contenders must not hold the monitor_lock_, so they wait on a condition variable. Reduce size of per mutex contention log. Be consistent in calling thin lock thread ids just thread ids. Fix potential thread death races caused by the use of FindThreadByThreadId, make it invariant that returned threads are either self or suspended now. Code size reduction on ARM boot.oat 0.2%. Old nexus 7 speedup 0.25%, new nexus 7 speedup 1.4%, nexus 10 speedup 2.24%, nexus 4 speedup 2.09% on DeltaBlue. Change-Id: Id52558b914f160d9c8578fdd7fc8199a9598576a
2013-07-26Fix cpplint whitespace/comments issues Brian Carlstrom
Change-Id: Iae286862c85fb8fd8901eae1204cd6d271d69496
2013-07-12Create separate Android.mk for main build targets Brian Carlstrom
The runtime, compiler, dex2oat, and oatdump now are in seperate trees to prevent dependency creep. They can now be individually built without rebuilding the rest of the art projects. dalvikvm and jdwpspy were already this way. Builds in the art directory should behave as before, building everything including tests. Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81