Commit graph

56 commits

Author SHA1 Message Date
Dan Willemsen
e2b6cd28f2 Mark crash_dump.policy as not supported on mips
The recent change to detect missing source files broke reading makefiles
for mips, since this didn't specify a source file.

Bug: 73904572
Test: lunch aosp_mips-eng; m nothing
Test: lunch aosp_arm-eng; m crash_dump.policy
Test: lunch aosp_arm64-eng; m crash_dump.policy
Test: lunch aosp_x86-eng; m crash_dump.policy
Test: lunch aosp_x86_64-eng; m crash_dump.policy
Change-Id: I28864b5af59267f1ab83084128f2c59b04039374
2018-02-27 15:35:11 -08:00
Josh Gao
e04ca2794a debuggerd: add seccomp policies and tests.
Bug: http://b/38508369
Test: debuggerd_test32/64 on walleye and aosp_x86_64
Change-Id: I7e69e37bcd1823d271b9f2b0a13b8c9cba9a8e84
2018-01-18 13:49:56 -08:00
Josh Gao
cbe70cb0a8 debuggerd: advance our amazing bet.
Remove debuggerd in favor of a helper process that gets execed by
crashing processes.

Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I9906c69473989cbf7fe5ea6cccf9a9c563d75906
2017-01-17 13:57:57 -08:00
Elliott Hughes
400628aeac Improve crasher.
Make it behave better in our typical use cases and support more of the kinds
of crash we want to document.

Bug: http://b/28746168
Test: crasher
Change-Id: Ifbc3dfb042f6055568244c921f4abe1ea554cec4
2016-12-14 17:33:46 -08:00
Richard Uhler
53fb32f05c debuggerd: Dump list of open files on process crash.
Test: Open a bunch of files, wait for the process to crash, verify dubuggerd
includes the list of open files the tombstone it generates.
Test: Added OpenFilesListTest to debuggerd_test.

Bug: 32013594

Change-Id: I6f939ae1d04dc58dc99abff0ed930da9e0ef0d1c
2016-11-21 11:40:42 +00:00
Mark Salyzyn
dafe384207 debuggerd: use __android_log_is_debuggable()
Test: compile and signal 8 to some component
Bug: 27566046
Bug: 31456426
Change-Id: I35e83679fbc40d54217850521bff23d9306d86f8
2016-10-14 11:12:16 -07:00
Elliott Hughes
36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Pirama Arumuga Nainar
6fbbc4cdfa Disable warnings triggered in Clang r271374
http://b/28149048
http://b/29823425

Disable -Wvarargs that gets triggered in
system/core/debuggerd/test/ptrace_fake.cpp:ptrace_fake.  The second bug
above tracks that this warning gets re-enabled.

Test: Tested build, boot and common usage for Arm, Arm64, x86, x86_64,
Mips images in AOSP and internal branch.

Change-Id: Ife68675a77431bcc4717b4da297c14dc486d1413
2016-07-19 20:29:05 +00:00
Colin Cross
b39e4025ae Rename Android.soong.mk to Android.mk
Soong is always on now, so we don't have to distinguish between
makefiles that should be ignored because Soong is handling them with an
Android.bp file, and makefiles that are still needed with Soong.  All
obsolete Android.mk files have been removed, rename all Android.soong.mk
files to Android.mk.

Change-Id: Iabbddcbfb2c837cfd4556241b570474452cc5d4d
2016-07-11 16:56:51 -07:00
Josh Gao
9c02dc5916 debuggerd: add libdebuggerd_client.
Bug: http://b/24414818
Change-Id: I079c534d2c952b6975bf0428eb86cc7a55525737
2016-06-17 13:11:29 -07:00
Elliott Hughes
23d1cad9e0 Add a fortify test to crasher.
Change-Id: I675dbeaa39529583be5877946fd38b94ec341315
2016-05-10 14:44:59 -07:00
Josh Gao
f5e8f0b9cd debuggerd: fork the signal sender once.
Bug: http://b/27427439
Change-Id: I6294ff68a150bc9950a300264c31d2141307ac66
2016-03-17 11:27:31 -07:00
Dan Willemsen
9bef9660fd Turn off -Wdate-time for crasher
This is an optional diagnostic tool where it's useful to know if you are
running the version that you just built. Allow the use of __TIME__
without a warning or error.

Bug: 24204119
Change-Id: I78063c2694b80ccaf5891d1cd649ea17eda978cb
2015-11-02 15:41:59 -08:00
Yabin Cui
9e402bb20c Revert "Revert "Revert "Revert "Add BacktraceOffline for offline backtracing.""""
This reverts commit 94ece83270.

Change-Id: Ie06465c89a5fc115517130f9f2904cc855973155
2015-09-22 04:46:57 +00:00
Yabin Cui
94ece83270 Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""
This reverts commit 0a411c934a.

Change-Id: Ic1824afac6c32f1087b66de9d6368a561f235d13
2015-09-22 01:38:17 +00:00
Yabin Cui
0a411c934a Revert "Revert "Add BacktraceOffline for offline backtracing.""
This reverts commit ab5e583327.

And statically link llvm libraries on host to remove dependency
on 32-bit llvm shared library which is not included in the prebuilt.

Bug: 22229391

Change-Id: I8210687655ee1809fd820ab2a6ca5dfaf3f9096d
2015-09-21 12:54:45 -07:00
Tom Cherry
20391b1de5 bundle init.rc contents with its service
Bug: 23186545
Change-Id: I52616b8ab1165fdef716f9b8f958665f2308c12e
2015-08-21 10:14:43 -07:00
Christopher Ferris
b36b592338 Replace all _LOG error calls with ALOGE.
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-07-01 13:23:19 -07:00
Christopher Ferris
862fe02919 Change the 64 bit map address format.
Previously, the map printing in tombstones for 64 bit devices uses
a variable length value. This means that the maps are not lined up.
The new format is to print the map as 00000000'00000000 in all ways.

Also fix a bug where the backtrace_map_t did not initialize all
parameters.

Add unit tests for all of the dump_all_maps function.

Bug: 20950813
Change-Id: I30901c8a0251b00d85c4c01476b033ef8db84e32
2015-06-03 10:24:21 -07:00
Christopher Ferris
e8bc77eb84 Refactor dump_memory function.
- 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
2015-05-27 17:21:38 -07:00
Christopher Ferris
a21bd93ef5 Print the build id of shared libraries if present.
For every map that has a name, and if it's a mapped in shared library,
print the build id.

Refactor the way dump_all_maps logs data.

Refactor the way stack segments are dumped.

Bug: 19371018
Change-Id: Ic08d05a4b13f128925743936fb84d8059f7cb56f
2015-03-17 15:13:35 -07:00
Douglas Leung
2ea9a32434 Add backtrace support for mips64.
Change-Id: I12ea2fcbe6780bb596f51988eae1ceafcec858df
2015-03-09 18:43:10 -07:00
Christopher Ferris
9774df6134 Move 32 bit/64 bit check into debuggerd.
On 64 bit systems, calls to dump_backtrace_to_file or dump_tombstone
try and directly contact the correct debuggerd (32 bit vs 64 bit)
by reading the elf information for the executable.
Unfortunately, system_server makes a call to dump_backtrace_to_file
and it doesn't have permissions to read the executable data, so it
defaults to always contacting the 64 bit debuggerd.
This CL changes the code so that all dump requests go to the 64 bit
debuggerd, which reads the elf information and redirects requests for
32 bit processes to the 32 bit debuggerd.

Testing:

- Forced the watchdog code in system_server to dump stacks and
  verified that all native stacks are dumped correctly.
- Verified that dumpstate and bugreport still properly dump the native
  processes on a 64 bit and 32 bit system.
- Intentionally forced the 64 bit to 32 bit redirect to write only a
  byte at a time and verified there are no errors, and no dropped data.
- Used debuggerd and debuggerd64 to dump 32 bit and 64 bit processes
  seemlessly.
- Used debuggerd on a 32 bit system to dump native stacks.

Bug: https://code.google.com/p/android/issues/detail?id=97024
Change-Id: Ie01945153bdc1c4ded696c7334b61d58575314d1
2015-01-20 17:22:07 -08:00
Elliott Hughes
c184d5655a #include <arpa/inet.h> for htonl.
Not sure why this only shows up with clang.

Change-Id: Id5603483e32f8a8d4b091dbb31b3142e3f77deac
2014-12-18 23:49:17 +00:00
Dan Albert
80b88cb5d2 Move debuggerd to libc++.
Bug: 15193147
Change-Id: I935a08e98077b688d1735fb5b84a615cb7df8810
2014-11-15 16:35:30 -08:00
Elliott Hughes
cb7aae167e Fix arm emulator "D register out of range for selected VFP version" build failure.
Change-Id: Ia37cb3f8ecb00a927fa3fc8b4131c158413646e7
2014-07-09 16:41:04 -07:00
Elliott Hughes
e7f18e14a9 Integrate vfp-crasher with crasher.
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-07-09 12:19:32 -07:00
Elliott Hughes
ddde05f3ee Merge "[MIPS64] Build debuggerd for mips64" 2014-06-03 23:26:33 +00:00
Duane Sand
a80b759857 [MIPS64] Build debuggerd for mips64
Change-Id: I361e9668baa218fc01e723c2df1a34ca6329cf47
2014-06-03 16:24:57 -07:00
Elliott Hughes
8c597684b1 Clean up the debuggerd makefile.
In particular, turn on -Wunused, which is globally off by default
thanks to build/core/config.mk.

Change-Id: Iba3ee1c0726f43eced972a53959f0e1cd97190c9
2014-06-03 15:12:07 -07:00
Mark Salyzyn
f1a8dfa0eb debuggerd: turn on -Werror
- Deal with some -Wunused / -Wunused-variable issues

Change-Id: I39849fe30170f69d1cab7d4ad2629b3a49e14ee7
2014-05-02 14:16:00 -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
Elliott Hughes
e9edf7a0ef LP64 should have debuggerd and debuggerd64.
Change-Id: I4e39c200e6867bb9a5bbcfec1c449b8864028feb
2014-01-31 17:15:10 -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
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
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
Ying Wang
083b5ccba3 Add liblog
Bug: 8580410
Change-Id: Iab3a9b4307f207c14a04a922cc7350c54e60e9ad
2013-04-09 22:03:45 -07: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
Kenny Root
b5982bf7c6 Remove HAVE_SELINUX guards
Change-Id: I8272c573b3c5dc663203bafab68fad5e94d89364
2012-10-16 23:18:18 -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
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
Jeff Brown
13e715b491 Use libcorkscrew in debuggerd.
Change-Id: I5e3645a39d96c808f87075b49111d0262a19a0c8
2011-10-22 16:43:00 -07:00
Brian Swetland
cecec9d027 remove crasher and vfp-crasher from standard builds
These are only for debuggerd testing.

Change-Id: If2d2ff85e8c182d366cc251e9446ae7fdd094e55
2011-01-23 17:51:54 -08:00
Bruce Beare
6cc4923087 debuggerd: IA version
Change-Id: I0c0d9c2d7e476b8d117aaf505a9480a47c0b5c05
Signed-off-by: Lei Li <lei.l.li@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2010-11-29 11:28:11 -08:00
Bruce Beare
849249064c debuggerd: Reorganize to facilitate IA commit
Change-Id: I22dd02daf617672fc0a8ba7e396017c57f17e26e
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2010-11-29 11:03:48 -08:00
The Android Open Source Project
75a1d218d8 merge from open-source master
Change-Id: I50b7bc6faa6d0abd4998cae8fc7dda1e8fa49407
2010-06-10 08:51:33 -07:00
Meng Hu
ae7b91b680 debuggerd: Show function names in tombstone backtraces
This change enables debuggerd to provide backtraces with function
names in tombstone files and log messages.  It does this by reading
the image file that the address is found in, and parsing the dynamic
symbol table to try to extract the symbol corresponding to the given
address.

This works best when "-Wl,-export-dynamic" is added to the LDFLAGS
of each library and executable, because this will cause all symbols
to be added to the dynamic symbol table.  If this flag is not present,
it will still work, but it will only be able to identify functions
which are part of the external API of the library/executable.

Change-Id: I618baaff9ed9143b7d1a1f302224e9f21d2b0626
2010-05-24 17:20:10 -05:00