path: root/debuggerd/arm
AgeCommit message (Collapse)Author
2015-07-01Replace all _LOG error calls with ALOGE.Christopher Ferris
The debuggerd code sometimes calls _LOG(..., logtype::ERROR, ...) and sometimes ALOGE(). Standardize on ALOGE since the _LOG message will wind up in the tombstone in weird places, but using ALOGE will wind up in the logcat portion of the tombstone. Bug: 21467089 Change-Id: Ie893f5e91d45b48ef3f5864c3a714e60ac848fb3
2015-05-27Refactor dump_memory function.Christopher Ferris
- Add dumping memory around registers for x86/x86_64. - Add unit tests for new dump_memory function. - Cleanup all of the machine.cpp files. - Increase the high address check for 32 bit, and decrease the high address allowed for 64 bit slightly to match mips64. Bug: 21206576 Change-Id: I6f75141f3282db48b10f7c695a1cf2eb75a08351
2014-07-14Add missing arm64 registers.Elliott Hughes
Also fix dumping of arm64's vector registers, which are actually 128 bits wide. Also move the arm/arm64 FP registers to the tombstone. (We've never dumped them at all for the other architectures.) Change-Id: I239a86dd225b47fa90109bc824b7610df67ad812
2014-07-09Fix arm emulator "D register out of range for selected VFP version" build ↵Elliott Hughes
failure. Change-Id: Ia37cb3f8ecb00a927fa3fc8b4131c158413646e7
2014-07-09Integrate vfp-crasher with crasher.Elliott Hughes
There's no good reason to separate "fill the integer registers with recognizable patterns and crash" from "fill the FP registers with recognizable patterns and crash". Also remove the incorrect use of ARCH_ARM_HAVE_VFP_D32 rather than try to fix it. Change-Id: I3a4a3aca1575de5489314027ae52168997404d79
2014-06-16Changing how debuggerd filters log messages to different locations.Brigid Smith
The system by which debuggerd filters its output to different locations is now based on an enum called logtype with easy to understand categories for log messages (like THREAD, MEMORY, etc.) instead of the old, fairly esoteric scope_flags variable. Now much of the output that previously went to logcat does not show up on the screen, but all output can be found in the tombstone file. In addition, the tombstone's location is now printed so it can be located easily. Bug: 15341747 Change-Id: Ia2f2051d1dfdea934d0e6ed220f24345e35ba6a2
2014-01-30AArch64: Port debuggerdKévin PETIT
Change-Id: Ib18f76f375a1d70c84e0a09d221e17ac43144b96 Signed-off-by: Kévin PETIT <>
2014-01-30debuggerd: a few generic improvementsKévin PETIT
This one makes dump_memory reasonably architecture-agnostic so it is possible to share the code between architectures. It also includes a few small improvements in tombstone.cpp. Change-Id: Ib8a9599bfa420b41e80207988e87aee1b9d79541 Signed-off-by: Kévin PETIT <>
2014-01-13Next phase of the move, reformat use C++ features.Christopher Ferris
Use the libbacktrace C++ interface instead of the C interface in debuggerd. Reformat the debuggerd code to be closer to Google C++ style. Fix all debuggerd casts to be C++ casts. Add a frame number to the frame data structure for ease of formatting and add another FormatFrameData function. Change the format_test to use the new FormatFrameData function. Modify all of the backtrace_test to use the C++ interface. Change-Id: I10e1610861acf7f4a3ad53276b74971cfbfda464
2014-01-10Move to C++ for debuggerd.Christopher Ferris
This is part 1, only including the bare minimum changes because our diff tool doesn't easily show differences when a file moves. This also breaks it into a small chunk in case some other changes break things, as unlikely as I think that will be. Change-Id: Ib7a3e7a2cc1ac574d15b65fda23813ebcf5d31af
2013-11-26Switch ARM debuggerd over to <sys/user.h>.Elliott Hughes
Change-Id: I106d4e80a2e819f1d47ca81893340f567bb8b4d9
2013-10-03Update debuggerd to use libbacktrace.Christopher Ferris
Remove all of the code in debuggerd that uses libcorkscrew directly and replace with libbacktrace. Also do a bit of refactoring to clean up some functions that were passing around variables that weren't used. Bug: 8410085 Change-Id: I27da4fbe3f12ce38a85b4432fc1119984c9c391b
2013-04-05Uploaded native crash dumps do not include memory contentsChristopher Tate
Also fixed the LOG() macro to actually write to the log again, tracking the change in _LOG() argument semantics. Bug 8322568 Change-Id: I79330c85c26d3ffb734315b6d0f2c0bb80bd234a
2012-09-24Dump 256 bytes per chunk pointed by general-purpose registers.Ben Cheng
Bug: 7216522 Change-Id: Iddcec8399b00ad411be6863dd866a3f74377ba03
2012-06-08Enhance native stack dumps.Jeff Brown
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
2011-11-04Improve stack unwinder robustness.Jeff Brown
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
2011-10-25Add support for explicitly dumping native stacks.Jeff Brown
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
2011-10-22Use libcorkscrew in debuggerd.Jeff Brown
Change-Id: I5e3645a39d96c808f87075b49111d0262a19a0c8
2011-10-19Enable verbose register memory dumpsAndy McFadden
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
2011-10-18Add log summary to tombstonesAndy McFadden
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
2011-10-18Enhance debuggerd memory dumpsAndy McFadden
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
2011-10-13Show maps near native fault addressAndy McFadden
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/ 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
2011-02-24Fix overflow prevention code in memory dump.Ben Cheng
The delta between start and end pointers in memory dump has to be multiples of 4 or 16. Bug: 3486787 Change-Id: Ie34aa79ffb704ca647805dbc6a16f2c35adf849c
2011-02-01debuggerd: Fix missing include.David 'Digit' Turner
The structure user_vfp is incorrectly defined in bionic/libc/kernel/arch-arm/asm/ptrace.h at the moment, while it should be under bionic/libc/kernel/arch-arm/asm/user.h instead. Before moving its definition in the corresponding source files, we need to fix its users. It happens that debuggerd is the only one for now, so fix this by including <linux/user.h> instead (which will include <asm/user.h> and <asm/ptrace.h>). Also, make the debug output less chatty by specifying all symbols to be listed through XLOG2 instead of XLOG. Change-Id: I16e0fa700945d86efd44ee885a84ad609c0a9b58
2010-12-14Prevent rollover when dumping data around PC, SP, etc.Paul Eastham
Change-Id: Ifc5f0e8eb5fed191c39f0878869e04b4d4f3b9ca
2010-11-29debuggerd: IA versionBruce Beare
Change-Id: I0c0d9c2d7e476b8d117aaf505a9480a47c0b5c05 Signed-off-by: Lei Li <> Signed-off-by: Bruce Beare <>
2010-11-29debuggerd: Reorganize to facilitate IA commitBruce Beare
Change-Id: I22dd02daf617672fc0a8ba7e396017c57f17e26e Signed-off-by: Bruce Beare <>