Commit graph

97 commits

Author SHA1 Message Date
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
Christopher Tate
ded2e5acfc debuggerd now notifies the Activity Manager about native crashes
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
2013-04-01 10:37:24 -07:00
Elliott Hughes
e05093b924 am 3e77b752: am 0b535558: Merge "Unwinding implementation via eh_frame sections for x86"
* commit '3e77b7521ba96fd1ff6fed0e019aff5f46a31428':
  Unwinding implementation via eh_frame sections for x86
2013-03-14 17:25:04 -07:00
Pavel Chupin
af2cb3667b Unwinding implementation via eh_frame sections for x86
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>
2013-03-14 19:11:44 +04:00
Elliott Hughes
3b7c584fe9 am 910b7a8b: am 17361134: Merge "Add a "smash-stack" option to crasher."
# Via Android Git Automerger (1) and others
* commit '910b7a8b88b29ee16c6014630b450dda56c5d578':
  Add a "smash-stack" option to crasher.
2013-02-14 16:21:04 -08:00
Elliott Hughes
df4200e8c2 Add a "smash-stack" option to crasher.
bionic's __stack_chk_fail was preventing debuggerd from dumping
stacks, which was not helpful.

Bug: 2487269
Change-Id: Idba2a274037b960dfb2ac1c21686323268c4b372
2013-02-14 14:41:57 -08:00
Elliott Hughes
e8097be24e am a82985b6: am 7cd45071: Merge "Include page protections in the debuggerd map output."
* commit 'a82985b6686f8b47119193fee2f804376a90125b':
  Include page protections in the debuggerd map output.
2013-01-03 15:21:56 -08:00
Elliott Hughes
d1420be613 Include page protections in the debuggerd map output.
Bug: 7941716
Change-Id: I3bf475425c628c06f7799340c8a6132aab741742
2013-01-03 13:39:57 -08:00
Elliott Hughes
c75cbf456e am 3de7fe9f: am 5fb042dd: Merge "Expand crasher with a "thread-" prefix to crash on another thread."
* commit '3de7fe9f40489db691407d6ebfd77cfde23d8049':
  Expand crasher with a "thread-" prefix to crash on another thread.
2012-12-10 17:36:23 -08:00
Elliott Hughes
aa4213057b Expand crasher with a "thread-" prefix to crash on another thread.
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
2012-12-10 14:15:42 -08:00
Elliott Hughes
6dc5128a81 am 435c223d: am 5144fa28: Merge "Add missing signal codes to get_sigcode."
* commit '435c223d483c5e408fdbd7b6177e881ae445a24b':
  Add missing signal codes to get_sigcode.
2012-12-10 11:43:29 -08:00
Andy McFadden
b08084850d Show pid+uid in certain failures
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
2012-12-10 10:40:28 -08:00
Elliott Hughes
8f7d4430f3 Add missing signal codes to get_sigcode.
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
2012-12-10 10:35:11 -08:00
Elliott Hughes
3427e80ef3 am a6fb0e05: Merge "Fix debuggerd\'s use of readdir_r(3)."
* commit 'a6fb0e05aa95995445c6f2b65f07db26bdbfd46c':
  Fix debuggerd's use of readdir_r(3).
2012-10-30 16:57:51 -07:00
Elliott Hughes
c463d2cf9c Fix debuggerd's use of readdir_r(3).
Change-Id: I1b178af054cefebfb774320e4b4699d6dc8bbb01
2012-10-26 16:47:09 -07:00
Kenny Root
2a36ae5608 am 7b88a90d: Merge "Remove HAVE_SELINUX guards"
* commit '7b88a90da2a27e347fc16c14fa577f4ae1ef07fd':
  Remove HAVE_SELINUX guards
2012-10-17 09:57:10 -07:00
Kenny Root
b5982bf7c6 Remove HAVE_SELINUX guards
Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
2012-10-16 23:18:18 -07:00
Ben Cheng
c47b772b67 Dump 256 bytes per chunk pointed by general-purpose registers.
Bug: 7216522
Change-Id: Iddcec8399b00ad411be6863dd866a3f74377ba03
2012-09-24 14:13:37 -07:00
Ben Cheng
d7760c1688 Print the revision number in the tombstone file.
Bug: 7168261
Change-Id: Icb412760d018e4bbb1a5d742ed7d484d5cf6b470
2012-09-19 19:19:53 -07:00
Chris Dearman
231e3c83a3 [MIPS] debuggerd and libcorkscrew support
Change-Id: I5a241dc2e470148be0ad2c138e31f1aba5ab8812
2012-08-10 18:16:20 -07:00
rpcraig
f1186f3e98 restorecon tombstone directory.
Restore the security contexts of tombstone directory
when initially created.

Change-Id: I25b53730991576eccb62ca57050decd584acc639
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2012-07-19 09:38:06 -04:00
Jeff Brown
f87d9c8698 am 9cec175c: Remove a stray newline in the backtrace output.
* commit '9cec175c66100d9edbb1054f3f2977a5c3f80af2':
  Remove a stray newline in the backtrace output.
2012-06-08 15:30:33 -07:00
Jeff Brown
536b81afed resolved conflicts for merge of 053b8654 to jb-dev-plus-aosp
Change-Id: Idfef8c26b7a9e1a1a202e21dc5d34022bbaa92cc
2012-06-08 15:27:01 -07:00
Jeff Brown
9cec175c66 Remove a stray newline in the backtrace output.
Bug: 6615693
Change-Id: I1ac1746286afb77c3f5c4042c4592333ebb08a51
2012-06-08 14:21:51 -07:00
Jeff Brown
053b865412 Enhance native stack dumps.
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
2012-06-08 13:29:23 -07:00
Jean-Baptiste Queru
5820a99f3f Fix build
Change-Id: Ie2af6aab7e236c31bb7a607659813218ef9c5400
2012-05-16 16:56:57 -07:00
Andy McFadden
424e07fcf6 Reduce suicidal tendencies
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
2012-03-08 15:42:30 -08:00
Jeff Brown
19b39f371b Improve backtrace formatting.
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
2011-11-22 12:13:46 -08:00