summaryrefslogtreecommitdiffstats
path: root/debuggerd
Commit message (Collapse)AuthorAgeFilesLines
* Move liblog headers to system/core/include/logColin Cross2013-07-243-4/+5
| | | | | | | | | Move the liblog headers to log/ instead of cutils/ to complete the separation of libcutils and liblog. cutils/log.h still exists and includes log/log.h in order to support the many existing modules that use cutils/log.h. Change-Id: I2758c9f4aedcb809ca7ba8383d0f55041dd44345
* am a570312a: am f265426f: am 596ee9ea: Merge "Improve the crasher ↵Elliott Hughes2013-07-161-2/+4
|\ | | | | | | | | | | | | stack-overflow command." * commit 'a570312a56938f6ebfcadc3ec9830ab8a2407654': Improve the crasher stack-overflow command.
| * am 596ee9ea: Merge "Improve the crasher stack-overflow command."Elliott Hughes2013-07-161-2/+4
| |\ | | | | | | | | | | | | * commit '596ee9ea8ae37b17fbdff91508f55250d528f1d2': Improve the crasher stack-overflow command.
| | * Improve the crasher stack-overflow command.Elliott Hughes2013-07-151-2/+4
| | | | | | | | | | | | | | | | | | Runs a lot quicker, with no intermediate noise. Change-Id: Icd911ff305da2e0889029dc78d5c2b39f32111c5
* | | debuggerd: Ignore SIGPIPENick Kralevich2013-06-181-1/+3
|/ / | | | | | | | | | | | | | | | | The system server may prematurely close the connection to /data/system/ndebugsocket if it's not interested in the data from debuggerd. If it does so, we don't want to die due to a SIGPIPE. Change-Id: Iaef1f497bcd630144e6df6a06644a3293b85b6e0
* | am 6ef0dfec: Merge "Add a new test to crasher to upset dlmalloc."Elliott Hughes2013-06-121-25/+34
|\ \ | |/ | | | | | | * commit '6ef0dfecca9fde5abe15ceea30e0615897d7b374': Add a new test to crasher to upset dlmalloc.
| * Add a new test to crasher to upset dlmalloc.Elliott Hughes2013-06-121-25/+34
| | | | | | | | | | | | | | | | We should also add a test for heap corruption, but I failed to come up with a kind of corruption that dlmalloc actually detects (rather than just crashing accidentally). Change-Id: I7457e732729635b171ffc44517c3de71f55608e6
* | am cb6a842c: Merge "Add a stack overflow test to crasher, and document all ↵Elliott Hughes2013-04-231-27/+38
|\ \ | |/ | | | | | | | | | | the options." * commit 'cb6a842c6e2048e6cd3c5a2d478113347c75d7aa': Add a stack overflow test to crasher, and document all the options.
| * Add a stack overflow test to crasher, and document all the options.Elliott Hughes2013-04-231-27/+38
| | | | | | | | Change-Id: Iebe80c24ef43f08d258881e7847516d414436931
| * Modify debuggerd to cope with the abort message.Elliott Hughes2013-04-043-11/+53
| | | | | | | | | | Bug: 8531731 Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
* | Fix regression: log mem maps around native fault addressChristopher Tate2013-04-181-10/+11
| | | | | | | | | | | | | | | | | | | | | | Restore the logging of the mem maps around the fault address along with the rest of the faulting thread's information. (It was still being written to the tombstone file, but the logging got dropped on the floor in the refactoring around AM report integration). Bug 8654694 Change-Id: Id8851fa765dfe6b6ce41ccfc39e85eaac0acc629
* | Add liblogYing Wang2013-04-091-2/+3
| | | | | | | | | | Bug: 8580410 Change-Id: Iab3a9b4307f207c14a04a922cc7350c54e60e9ad
* | Uploaded native crash dumps do not include memory contentsChristopher Tate2013-04-057-98/+114
| | | | | | | | | | | | | | | | | | Also fixed the LOG() macro to actually write to the log again, tracking the change in _LOG() argument semantics. Bug 8322568 Change-Id: I79330c85c26d3ffb734315b6d0f2c0bb80bd234a
* | Modify debuggerd to cope with the abort message.Elliott Hughes2013-04-053-11/+53
| | | | | | | | | | | | | | (cherry picked from commit 707b8bbe1800dbebd932f54e86347563ee86c36e) Bug: 8531731 Change-Id: I2785a07ef83e085f338d3094f9972de23117807c
* | debuggerd now notifies the Activity Manager about native crashesChristopher Tate2013-04-016-7/+106
| | | | | | | | | | | | | | | | | | | | | | The Activity Manager sets up a permission-guarded domain socket, which debuggerd connects to when a crash happens. If this is successful, the daemon then mirrors the logged crash report to that socket, then closes it. Bug 8322568 Change-Id: Ife0c772a628ef82e8457094e511ce1edbfe57460
* | am 3e77b752: am 0b535558: Merge "Unwinding implementation via eh_frame ↵Elliott Hughes2013-03-141-0/+16
|\ \ | |/ | | | | | | | | | | sections for x86" * commit '3e77b7521ba96fd1ff6fed0e019aff5f46a31428': Unwinding implementation via eh_frame sections for x86
| * Unwinding implementation via eh_frame sections for x86Pavel Chupin2013-03-141-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backtracing through eh_frame section is more effective allowing to reuse ebp register for other purposes within routine. GCC with turned on optimizations (-O1 and above) implicitly defines -fomit-frame-pointer anyway. eh_frame sections are generated by default with GCC on any optimization level. This change implements remote unwinding (separate process unwinding). Local unwinding is already implemented through _Unwind_Backtrace call which is implemented in libgcc. Change-Id: I1aea1ecd19c21710f9cf5f05dc272fc51b67b7aa Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
* | am 910b7a8b: am 17361134: Merge "Add a "smash-stack" option to crasher."Elliott Hughes2013-02-142-0/+14
|\ \ | |/ | | | | | | | | # Via Android Git Automerger (1) and others * commit '910b7a8b88b29ee16c6014630b450dda56c5d578': Add a "smash-stack" option to crasher.
| * Add a "smash-stack" option to crasher.Elliott Hughes2013-02-142-0/+14
| | | | | | | | | | | | | | | | bionic's __stack_chk_fail was preventing debuggerd from dumping stacks, which was not helpful. Bug: 2487269 Change-Id: Idba2a274037b960dfb2ac1c21686323268c4b372
* | am a82985b6: am 7cd45071: Merge "Include page protections in the debuggerd ↵Elliott Hughes2013-01-031-15/+15
|\ \ | |/ | | | | | | | | | | map output." * commit 'a82985b6686f8b47119193fee2f804376a90125b': Include page protections in the debuggerd map output.
| * Include page protections in the debuggerd map output.Elliott Hughes2013-01-031-15/+15
| | | | | | | | | | Bug: 7941716 Change-Id: I3bf475425c628c06f7799340c8a6132aab741742
* | am 3de7fe9f: am 5fb042dd: Merge "Expand crasher with a "thread-" prefix to ↵Elliott Hughes2012-12-101-11/+34
|\ \ | |/ | | | | | | | | | | crash on another thread." * commit '3de7fe9f40489db691407d6ebfd77cfde23d8049': Expand crasher with a "thread-" prefix to crash on another thread.
| * Expand crasher with a "thread-" prefix to crash on another thread.Elliott Hughes2012-12-101-11/+34
| | | | | | | | | | | | | | | | So "thread-nostack" runs the "nostack" code on a new thread, and "thread-abort" runs the "abort" code on a new thread, and so on. Bug: http://code.google.com/p/android/issues/detail?id=16672 Change-Id: I026a0e43eea147f1a7a74243846954599bcf4238
* | am 435c223d: am 5144fa28: Merge "Add missing signal codes to get_sigcode."Elliott Hughes2012-12-101-0/+25
|\ \ | |/ | | | | | | * commit '435c223d483c5e408fdbd7b6177e881ae445a24b': Add missing signal codes to get_sigcode.
| * Add missing signal codes to get_sigcode.Elliott Hughes2012-12-101-0/+25
| | | | | | | | | | | | | | The only common one we were missing is SI_TKILL, but we've had the full set on the dalvik-dev branch for some time now. Change-Id: I7cf52d352b8624e0adb17a2ed440e7a10f490dfd
* | Show pid+uid in certain failuresAndy McFadden2012-12-101-4/+6
|/ | | | | | | | | | If somebody sends debuggerd bad data, it logs a complaint but doesn't give any indication of the source. Now we show the pid and uid we get from SO_PEERCRED. Bug 7704699 Change-Id: I2738eb972932cc868ad969b60e16dd0b623212a1
* am a6fb0e05: Merge "Fix debuggerd\'s use of readdir_r(3)."Elliott Hughes2012-10-302-7/+5
|\ | | | | | | | | * commit 'a6fb0e05aa95995445c6f2b65f07db26bdbfd46c': Fix debuggerd's use of readdir_r(3).
| * Fix debuggerd's use of readdir_r(3).Elliott Hughes2012-10-262-7/+5
| | | | | | | | Change-Id: I1b178af054cefebfb774320e4b4699d6dc8bbb01
* | am 7b88a90d: Merge "Remove HAVE_SELINUX guards"Kenny Root2012-10-172-11/+5
|\ \ | |/ | | | | | | * commit '7b88a90da2a27e347fc16c14fa577f4ae1ef07fd': Remove HAVE_SELINUX guards
| * Remove HAVE_SELINUX guardsKenny Root2012-10-162-11/+5
| | | | | | | | Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
* | Dump 256 bytes per chunk pointed by general-purpose registers.Ben Cheng2012-09-241-1/+5
| | | | | | | | | | Bug: 7216522 Change-Id: Iddcec8399b00ad411be6863dd866a3f74377ba03
* | Print the revision number in the tombstone file.Ben Cheng2012-09-191-0/+10
|/ | | | | Bug: 7168261 Change-Id: Icb412760d018e4bbb1a5d742ed7d484d5cf6b470
* [MIPS] debuggerd and libcorkscrew supportChris Dearman2012-08-105-2/+235
| | | | Change-Id: I5a241dc2e470148be0ad2c138e31f1aba5ab8812
* restorecon tombstone directory.rpcraig2012-07-192-0/+17
| | | | | | | | Restore the security contexts of tombstone directory when initially created. Change-Id: I25b53730991576eccb62ca57050decd584acc639 Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
* am 9cec175c: Remove a stray newline in the backtrace output.Jeff Brown2012-06-081-1/+1
|\ | | | | | | | | * commit '9cec175c66100d9edbb1054f3f2977a5c3f80af2': Remove a stray newline in the backtrace output.
| * Remove a stray newline in the backtrace output.Jeff Brown2012-06-081-1/+1
| | | | | | | | | | Bug: 6615693 Change-Id: I1ac1746286afb77c3f5c4042c4592333ebb08a51
* | resolved conflicts for merge of 053b8654 to jb-dev-plus-aospJeff Brown2012-06-0811-890/+1170
|\ \ | |/ | | | | Change-Id: Idfef8c26b7a9e1a1a202e21dc5d34022bbaa92cc
| * Enhance native stack dumps.Jeff Brown2012-06-0811-892/+1172
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides a new mechanism for dumpstate (while running as root) to request that debuggerd dump the stacks of native processes that we care about in bug reports. In this mode, the backtrace is formatted to look similar to a Dalvik backtrace. Moved the tombstone generating code into a separate file to make it easier to maintain. Fixed a bug where sometimes the stack traces would be incomplete because we were not waiting for each thread to stop after issuing PTRACE_ATTACH, only the main thread. So sometimes we were missing traces for some threads. Refactored the logging code to prevent accidentally writing data to logcat when explicitly dumping a tombstone or backtrace from the console. Only root or system server can request to dump backtraces but only root can dump tombstones. Bug: 6615693 Change-Id: Ib3edcc16f9f3a687e414e3f2d250d9500566123b
* | Fix buildJean-Baptiste Queru2012-05-161-2/+0
|/ | | | Change-Id: Ie2af6aab7e236c31bb7a607659813218ef9c5400
* Reduce suicidal tendenciesAndy McFadden2012-03-081-2/+12
| | | | | | | | | | | | | | | | | | Some changes to debuggerd: (1) Send a SIGSTOP to the target process before doing any of the PTRACE_ATTACH work. This causes the threads that weren't hit by the signal to stop moving, which seems to get rid of the "ptrace detach failed: No such process" problems that result in missed stack traces and debuggerd self-immolation. (2) SIGPIPE was in the list of "interesting" signals caught by debugger_signal_handler(), but debuggerd didn't recognize it, and you'd get "unexpected signal 13" complaints. It's now in the list. (3) Fixed a bit-rotted XLOG. Change-Id: I33297ea6b09ce450671c07dc25846f684afbf480
* Improve backtrace formatting.Jeff Brown2011-11-221-14/+19
| | | | | | | | | | | | | | | | | | | | Show the symbol offset, when available. Centralized formatting of native stack traces in libcorkscrew. It's handy for automated tools if all stacks look the same. Since we already made them all look them same, we might as well do the formatting in just one place. Do not strip the Thumb bit on ARM. This fixes an off-by-one issue that could happen when resolving a PC that was at the very beginning of a Thumb function, since the symbol table would have the Thumb bit set but since we stripped the bit from our PC, we would be looking for an address one byte before the one listed in the symbol table. It's also quite useful to see whether a given function is executing in Thumb mode just by glancing at the PC. Change-Id: Icaa29add85ce0bcafe24d5ce2098e138d809e2ab
* Print the tombstone path.Jeff Brown2011-11-081-25/+55
| | | | | | | When explicitly requesting a dump, show the user the path of the tombstone file that was generated. Change-Id: I7fff7dea606872a61687ca087e99f604107b70c4
* Improve stack unwinder robustness.Jeff Brown2011-11-046-24/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep track of whether memory maps are readable. Use the information in try_get_word to try to avoid accidentally dereferencing an invalid pointer within the current process. (Note that I haven't ever seen that happen during normal unwinding, but it pays to be a little more careful.) Refactored try_get_word a little to make it easier to pass it the needed state for validation checks by way of a little memory_t struct. Improved how the memory map for the current process is cached. This is important because we need up to date information about readable maps. Use a 5 second cache expiration. Improved the PC -> LR fallback logic in the unwinder so we can eke out an extra frame sometimes. Fixed a bug reading ELF program headers. The phnum & phentsize fields are half-words. We were incorrectly interpreting phnum as a whole word. Used android_atomic_* operations carefully in the unwinder to prevent possible memory races between the dumper and the dumpee. This was highly unlikely (or even impossible due to the presence of other barriers along the way) but the code is clearer now about its invariants. Fixed a bug in debuggerd where the pid was being passed to have its stack dump taken instead of the tid, resulting in short stacks because ptrace couldn't read the data if pid != tid. Did a full sweep to ensure that we use pid / tid correctly everywhere. Ported old code from debuggerd to rewind the program counter back one instruction so that it points to the branch instruction itself instead of the return address. Change-Id: Icc4eb08320052975a4ae7f0f5f0ac9308a2d33d7
* Add support for explicitly dumping native stacks.Jeff Brown2011-10-252-206/+317
| | | | | | | | | | | | | | | | | | | | | | | | | This change modifies debuggerd so that it can be used to grab the native stacks of a process that has hung and not just crashed. Note that only the root user can do this (for now). adb shell debuggerd <tid> Then use logcat to find the tombstone file that was generated which will have the native stacks of all threads in the requested process. The specified thread will be shown first and will also appear in the main log. Also made some minor tweaks to libcorkscrew so that we could handle statically compiled executables in the future if we compiled the library statically. Improved the "wait_for_user_action" function to support volume down as an alternative for devices that do not have home keys. Removed a mess of gotos. Change-Id: Ic149653986b0c2f503c7f0e8b7cb1f3be7c84d1e
* Use libcorkscrew in debuggerd.Jeff Brown2011-10-2215-2111/+543
| | | | Change-Id: I5e3645a39d96c808f87075b49111d0262a19a0c8
* Enable verbose register memory dumpsAndy McFadden2011-10-191-1/+1
| | | | | | | | | | | | Dump some memory at addresses for all registers that look like they might have valid addresses. Previously this was only done for PC and LR. (This is expected to be disabled before ship.) Bug 5484924 Change-Id: I9802eaa396783e1286ae0c53eaf2473892c38a02
* Add log summary to tombstonesAndy McFadden2011-10-182-26/+103
| | | | | | | | | | | | | | | | | | | | | When the tombstones are uploaded to APR, they're truncated at 64KB. This causes the log data, which is at the end, to be lost if the process has more than about 12 threads (which many do). This change adds the last few lines of the log right below the report for the crashing thread, where we should be guaranteed to keep it. Also, clean up trailing newlines on log messages (which end up in the tombstone), and don't print a "------- log" banner if there aren't any messages in that log file (e.g. slog). Also also, don't try to show_nearby_maps unless this is the crashing thread. Bug 5471955 Change-Id: Iaa4fd2fafbaeda2f20bb95f202177d7744a91f9d
* Enhance debuggerd memory dumpsAndy McFadden2011-10-181-54/+103
| | | | | | | | | | | | | | | | | | | | | | | | | This makes two changes: (1) Display ASCII values next to the memory dumps. For example: I DEBUG: 00008ac4 706f6f4c 20676e69 74206425 73656d69 Looping %d times I DEBUG: 00008ad4 7453000a 6e69726f 6f742067 0a702520 ..Storing to %p. I DEBUG: 00008ae4 65642f00 657a2f76 55006f72 6c62616e ./dev/zero.Unabl (The hex values are still displayed as little-endian word values, while the ASCII part is byte oriented.) (2) Optionally display memory dumps for all registers, not just LR and PC, for the crashing thread. This is meant for situations where we crash dereferencing foo->bar and want to see what the memory near "foo" looks like -- could be handy if it got stomped by MUTF-16 text or something recognizable. Change #2 is currently disabled, via a compile-time setting. Bug 5471955 Change-Id: Iacfd01c314055bad81db2f43b7d239f10086fcfb
* Append log data to tombstonesAndy McFadden2011-10-131-0/+103
| | | | | | | | | | | | | | | | | | | The Android Problem Report site shows tombstones uploaded from devices. We can see the native stack traces for every thread, but sometimes there's a very important bit of information sitting in the log, and without it we can't analyze the failure. This change modifies debuggerd so that the log contents for the crashing process are appended to the tombstone. The format matches the output of "logcat -v threadtime". Both "system" and "main" logs are included (but not interleaved -- we're not that fancy). This feature is only enabled when the "ro.debuggable" system property is set to 1 (indicating a development device). Bug 5456676 Change-Id: I3be1df59813ccf1058cec496a906f6d31fbc7b04
* Show maps near native fault addressAndy McFadden2011-10-134-7/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds some additional output to native crashes. For example, if something tried to access a bit of mmap(/dev/zero) memory that had been mprotect()ed, you might see output like this: I DEBUG : memory map around addr 4015a00c: I DEBUG : 40159000-4015a000 /system/lib/libstdc++.so I DEBUG : 4015a000-40162000 /dev/zero I DEBUG : b0001000-b0009000 /system/bin/linker The idea is to see what's in and around the fault address to make it easier to identify bus errors due to file truncation and segmentation faults caused by buffer over/underruns. No output is generated for accesses below 0x1000 (which are likely NULL pointer dereferences) or for signals that don't set si_addr. Also, suppress the fault address for signals that don't set si_addr: I DEBUG : signal 6 (SIGABRT), code 0 (?), fault addr -------- We still print "fault addr" followed by 8 characters for anything that is parsing the contents. The "address" shown for signals like SIGABRT was meaningless and possibly confusing. Bug 5358516 Change-Id: Icae8ef309ea2d89b129f68d30f96b2ca8a69cc6c