Commit graph

124 commits

Author SHA1 Message Date
Elliott Hughes
855fcc3114 Use the si_code value bionic passes us.
Bionic needs to re-raise various signals, which means the si_code
debuggerd sees has been clobbered. If bionic sends us the original
si_code value, we can use that instead of the one we see when the
ptrace the crashed process' siginfo.

Change-Id: If116a6bc667d55a6fb39b74f96673292af4e4c8c
2014-04-25 20:20:39 -07:00
Elliott Hughes
bd395b9a14 Add missing si_code values to debuggerd.
Also add static_asserts so we'll be notified if any more new ones show up.

Change-Id: I3a502dd4da35354e1ac65865191d31ccdacef298
2014-04-24 13:53:22 -07:00
Elliott Hughes
da6b2e2fd7 Improve liblog's fatal logging.
This makes LOG_ALWAYS_FATAL and LOG_ALWAYS_FATAL_IF as good as regular
assert(3).

Change-Id: I0666684d30cae7baf23c64b33d35c1e43f81acf0
2014-04-24 13:28:24 -07:00
Mark Salyzyn
99f47a9e7c logd: liblog: logcat: debuggerd: Add LOG_ID_CRASH
Change-Id: Iea453764a1a4fc1661f461f10c641c30150e4d20
2014-04-16 15:38:50 -07:00
Colin Cross
87a6b1d799 debuggerd: use LOCAL_MULTILIB
Use LOCAL_MULTILIB to build multiple versions of executables
instead of manually creating two build rules.

Change-Id: I1a993ff7b5f527a88735f46eec9822bb97d16490
2014-03-26 15:16:23 -07:00
Colin Cross
579c9bc8a4 build debuggerd and debuggerd64 on 64-bit architectures
Change-Id: I1518d45ae0c5e0fed31d071fdaf19a67bad1bdfc
2014-02-12 22:32:26 -08:00
Nick Kralevich
2e7347d617 Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API." 2014-02-12 23:09:28 +00:00
Christopher Ferris
4207df11c5 Merge "Use stat structure to keep oldest mtime." 2014-02-08 02:13:58 +00:00
Christopher Ferris
68bd59f6d2 Use stat structure to keep oldest mtime.
Change-Id: If9496127db28d2dcd09bc5b3144632a43afb8d55
2014-02-07 18:08:38 -08:00
Elliott Hughes
0df8e4f86c Use socklen_t instead of int in debuggerd.
Also other trivial C++ cleanup.

Change-Id: I9b5278c5205e0ea4f9dcbbe3e7b99921dd2436dc
2014-02-07 12:13:30 -08:00
Stephen Smalley
27a93650c0 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:38:32 -05:00
Elliott Hughes
5d9fe779c8 system/core LP64 cleanup.
Fixes -Wint-to-pointer and -Wpointer-to-int warnings, plus various -Wformat
warnings.

Change-Id: I6c5eea6b4273d82d28b8e5d2925f3e5457511b17
2014-02-05 18:02:11 -08:00
Elliott Hughes
f7b4b519e4 Fix debuggerd's symbol offset output.
Before:
  00007fff33e489d8  00007ff286e4ad94  /system/lib64/libc.so (__libc_init+54u)

After:
  00007fff45c6c158  00007f61bc36fd94  /system/lib64/libc.so (__libc_init+84)

Change-Id: I36796c99843a41583824a96793a5a4c81ddb666e
2014-01-31 23:13:55 -08:00
Elliott Hughes
e9edf7a0ef LP64 should have debuggerd and debuggerd64.
Change-Id: I4e39c200e6867bb9a5bbcfec1c449b8864028feb
2014-01-31 17:15:10 -08:00
Elliott Hughes
6694d3e3d5 Remove dead code that looked like part of debuggerd.
Note that these were two different functions. The definition was unused,
and the declaration was undefined.

Change-Id: I2edd10a0ab9422cd5252bdb9ccdd726dc5fad531
2014-01-31 10:37:18 -08:00
Kévin PETIT
abc60c26b7 AArch64: Port debuggerd
Change-Id: Ib18f76f375a1d70c84e0a09d221e17ac43144b96
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-01-30 18:05:03 -08:00
Pavel Chupin
c6c194ced0 LP64: Enable debuggerd/libbacktrace/libunwind.
Change-Id: I2e432839f86c33c2adbaac8cc12ca8961956044b
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-01-30 17:15:24 -08:00
Kévin PETIT
4bb477205a debuggerd: a few generic improvements
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 <kevin.petit@arm.com>
2014-01-30 15:55:33 -08:00
Christopher Ferris
d391c9b4ac Merge "Re-enable libunwind for arm." 2014-01-28 21:23:50 +00:00
Christopher Ferris
df2906186b Re-enable libunwind for arm.
Update to handle the new optimized way that libunwind works.

In addition, a small refactor of the BacktraceMap code.

A few new tests of for good measure.

Change-Id: I2f9b4f5ad5a0dfe907b31febee76e4b9b94fb76f
2014-01-28 12:03:36 -08:00
Mark Salyzyn
fca0bd1a38 debuggerd: Support newline split in log messages
(cherry picked from commit 706fad2b5f)

Change-Id: I2c19f12ef027ab1e1455ce78824537da1b03edcd
2014-01-27 15:17:13 -08:00
Mark Salyzyn
22b5cef127 debuggerd: Incorporate liblog reading API
(cherry picked from commit a63f927ce1)

Change-Id: Ic26e9dba3b45c827d122b03e34cc4a5bd48f7deb
2014-01-27 15:11:10 -08:00
Christopher Ferris
46756821c4 Rewrite libbacktrace to be all C++.
This includes removing the map_info.c source and replacing it with the
BacktraceMap class to handle all map related code.

Change all callers of libbacktrace map functionality.

Also modify the corkscrew thread code so that it doesn't need to build
the map twice (once in the corkscrew format and once in the libbacktrace
format).

Change-Id: I32865a39f83a3dd6f958fc03c2759ba47d12382e
2014-01-16 16:12:29 -08:00
Christopher Ferris
20303f856f Next phase of the move, reformat use C++ features.
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-13 14:21:52 -08:00
Christopher Ferris
d607495b89 Move to C++ for debuggerd.
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
2014-01-10 16:05:12 -08:00
Elliott Hughes
cac5d8c223 Use the more portable <elf.h> instead of <sys/exec_elf.h>.
Bug: 12476126
Change-Id: I08684987e867371d5537dadf1acb3408b420ad0c
2014-01-10 14:40:53 -08:00
Christopher Ferris
9846497f79 Refactor to share map_info amongst threads.
Allow the use of the same map info to be shared when getting information on
multiple threads from the same pid.

Change-Id: I2e460e20154a10f4894ae563331fb32179e4551f
2014-01-08 15:32:28 -08:00
Elliott Hughes
9e7d2180c7 Switch ARM debuggerd over to <sys/user.h>.
Change-Id: I106d4e80a2e819f1d47ca81893340f567bb8b4d9
2013-11-26 18:01:29 -08:00
The Android Open Source Project
66ed50af68 Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
2013-11-22 13:44:43 -08:00
Elliott Hughes
76e7f5e508 Switch MIPS over to <sys/user.h>.
Bug: 11559337
Change-Id: I47ce51ec2d45d9cfdfbb6cccce93a66b0f02d967
2013-11-20 11:31:29 -08:00
Elliott Hughes
18ddd42092 Remove x86 debuggerd dependencies on non-uapi headers and corkscrew.
Also remove a hack that claims to be "just like ARM", but which was
different from the ARM and MIPS behavior.

Change-Id: I9b16da9a56430998ded27d304ce52c7cc8bfedfc
2013-11-14 17:06:46 -08:00
Christopher Ferris
17e91d44ed Rewrite libbacktrace using C++.
The old code was essentially trying to be C++ in C and was awkward. This
change makes it all objects with a thin layer that C code can use.

There is a C++ backtrace object that is not very useful, this code will
replace it.

This change also includes moving the backtrace test to a gtest, and adding
coverage of all major functionality.

Bug: 8410085
Change-Id: Iae0f1b09b3dd60395f71ed66010c1ea5cdd37841
2013-10-28 17:55:25 -07:00
Christopher Ferris
f84f7fa4d2 am 9492b6e7: am 2de8102d: Merge "Fix bug in abort message processing."
* commit '9492b6e72cef71422ba624e3cd11f07156cfb34a':
  Fix bug in abort message processing.
2013-10-09 23:08:59 -07:00
Christopher Ferris
dbd2ab4dca Fix bug in abort message processing.
Bug: 11156592
Change-Id: I4b82e7be5d7fccd167f6c52f78a5af3d3a553779
2013-10-09 18:31:40 -07:00
Christopher Ferris
816c9a64f9 am fa135f5c: am 7dbe9660: Merge "Update debuggerd to use libbacktrace."
* commit 'fa135f5ce95a8eff2ff51c03ad2e9d9b2a8b2274':
  Update debuggerd to use libbacktrace.
2013-10-04 15:42:14 -07:00
Christopher Ferris
365e4ae745 Update debuggerd to use libbacktrace.
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-10-03 11:07:56 -07:00
Colin Cross
9227bd3855 Move liblog headers to system/core/include/log
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
2013-07-24 12:32:39 -07:00
Elliott Hughes
0246f8f6f6 am a570312a: am f265426f: am 596ee9ea: Merge "Improve the crasher stack-overflow command."
* commit 'a570312a56938f6ebfcadc3ec9830ab8a2407654':
  Improve the crasher stack-overflow command.
2013-07-16 10:24:44 -07:00
Elliott Hughes
f265426f02 am 596ee9ea: Merge "Improve the crasher stack-overflow command."
* commit '596ee9ea8ae37b17fbdff91508f55250d528f1d2':
  Improve the crasher stack-overflow command.
2013-07-16 10:21:22 -07:00
Elliott Hughes
b1be27e29b Improve the crasher stack-overflow command.
Runs a lot quicker, with no intermediate noise.

Change-Id: Icd911ff305da2e0889029dc78d5c2b39f32111c5
2013-07-15 17:19:02 -07:00
Nick Kralevich
96bcd488c2 debuggerd: Ignore SIGPIPE
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
2013-06-18 17:57:08 -07:00
Elliott Hughes
65d8ec099d am 6ef0dfec: Merge "Add a new test to crasher to upset dlmalloc."
* commit '6ef0dfecca9fde5abe15ceea30e0615897d7b374':
  Add a new test to crasher to upset dlmalloc.
2013-06-12 14:23:29 -07:00
Elliott Hughes
6f40cafd9f Add a new test to crasher to upset dlmalloc.
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
2013-06-12 14:04:34 -07:00
Elliott Hughes
82081f71f6 am cb6a842c: Merge "Add a stack overflow test to crasher, and document all the options."
* commit 'cb6a842c6e2048e6cd3c5a2d478113347c75d7aa':
  Add a stack overflow test to crasher, and document all the options.
2013-04-23 19:29:40 -07:00
Elliott Hughes
3808c4ecb4 Add a stack overflow test to crasher, and document all the options.
Change-Id: Iebe80c24ef43f08d258881e7847516d414436931
2013-04-23 17:14:56 -07:00
Christopher Tate
300fd6fdbc Fix regression: log mem maps around native fault address
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
2013-04-18 14:12:31 -07:00
Ying Wang
083b5ccba3 Add liblog
Bug: 8580410
Change-Id: Iab3a9b4307f207c14a04a922cc7350c54e60e9ad
2013-04-09 22:03:45 -07:00
Christopher Tate
7716aef138 Uploaded native crash dumps do not include memory contents
Also fixed the LOG() macro to actually write to the log again, tracking
the change in _LOG() argument semantics.

Bug 8322568

Change-Id: I79330c85c26d3ffb734315b6d0f2c0bb80bd234a
2013-04-05 16:30:15 -07:00
Elliott Hughes
e5f8a692e4 Modify debuggerd to cope with the abort message.
(cherry picked from commit 707b8bbe18)

Bug: 8531731
Change-Id: I2785a07ef83e085f338d3094f9972de23117807c
2013-04-05 15:59:17 -07:00
Elliott Hughes
707b8bbe18 Modify debuggerd to cope with the abort message.
Bug: 8531731
Change-Id: I416ec1da38a8a1b0d0a582ccd7c8aaa681ed4a29
2013-04-04 13:52:01 -07:00