Commit Graph

29 Commits

Author SHA1 Message Date
Christopher Ferris 31ef85529d Use the timeout stack dump functions.
Use the native stack dumping functions that allows time outs. If
debuggerd locks up, before a bugreport would hang forever. Now
it will timeout properly and still get all of the other information.

Bug: 18766581

(cherry picked from commit 457731f69e)

Change-Id: I39e8e9c60209e3ef9efac795fedb8e1edce2bd3e
2015-01-15 15:35:40 -08:00
Christopher Ferris 67c5a8af9e Fix message when a command times out.
The previous version printed out the nanoseconds elapsed, not seconds.

Change-Id: I10f6d7bf7b7a4647658313ed83781fda6fd744a5
2015-01-09 16:42:56 -08:00
Jeff Brown 1dc94e3156 Make dumpstate vibrate immediately.
Previously, the vibration was not performed until after stacks
were gathered which takes a long time.  Moved the vibration
to happen earlier so we provide better user feedback for the
three-button salute when collecting a bug report.

Deleted some dead code for playing begin/end sounds.

Improved the timing measurement code to help track down why
bug reports are so slow.  (They take over a minute now which
can cause us to lose valuable diagnostic information.)

Bug: 17474152
Change-Id: Iac73f7993d7dc85196aad96f459b22fd4a710f94
2014-09-11 14:19:04 -07:00
Christopher Ferris 89d4949f86 Use time() instead of clock() for timeouts.
The clock() function returns the processor time used by the process. This
is not a good timeout mechanism since the code is suspended most of the
time waiting for the forked process to finish. Replace with the time()
function.

Bug: 17154069
Change-Id: Ib383329f9db269445d71a100553b08e71fddda3f
2014-09-09 13:10:49 -07:00
Andres Morales 2e671bbdb7 Fix deadlock when killing adb bugreport
Leave default signal handler (terminate) for parent process,
add SIG_IGN as signal handler for children and let them
go down when the parent gets SIGPIPE.

Bug: 17109154
Change-Id: Id33db3e97a32f289eb2a9a1a0ca8acbe3dcd285d
2014-08-22 12:10:44 -07:00
Christopher Ferris 7dc7f3221f Add dumping of tombstones to dumpstate.
Dump only those tombstones modified within the last half an hour.

Change-Id: I8ce836b2e19eba7a9c0c31a4f312f9a382526da7
2014-07-23 19:18:07 -07:00
Colin Cross 0d6180f122 dumpstate: fix dumping traces for vm processes on 64-bit
dumpstate was not dumping any stack traces for vm processes because
it was failing the string compare for /system/bin/app_process.
64-bit devices use app_process32 and app_process64 instead of
app_process, and zygote64 alongside zygote.  Change the string
matching to be prefix matching.

(cherry picked from commit 8eb25d552b)

Change-Id: I6b1568161fae278f0e6107990e5b750cf0ca902b
2014-07-17 12:42:14 -07:00
Sreeram Ramachandran c88da7cc21 resolved conflicts for merge of 928e05b1 to master
Change-Id: I1d1e623a1f95baa4375a87242ce71ea789884649
2014-07-09 08:05:04 -07:00
Sreeram Ramachandran 928e05b12b am 0d2bee0c: Merge "Dump all the correct routing tables."
* commit '0d2bee0c0baec56ec98867d7e044602097525248':
  Dump all the correct routing tables.
2014-07-09 00:13:15 +00:00
Sreeram Ramachandran 2b3bba34ae Dump all the correct routing tables.
The list of tables is maintained in /data/misc/net/rt_tables by netd.

Change-Id: I55475c08c5e43bcf61af916210e680c47480ac32
2014-07-08 16:29:45 -07:00
Nick Vaccaro bd81c258c2 am 45fcfb48: am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging
* commit '45fcfb48ef9e65747e7a3f35e1a4da232f6e161a':
  dumpstate: increase poll timeout waiting for SIGQUIT logging
2014-04-30 23:35:03 +00:00
Nick Vaccaro 45fcfb48ef am 85453ecc: dumpstate: increase poll timeout waiting for SIGQUIT logging
* commit '85453ecc90a94564e586f0f97c9ec2c0cf831501':
  dumpstate: increase poll timeout waiting for SIGQUIT logging
2014-04-30 20:35:15 +00:00
Nick Vaccaro 85453ecc90 dumpstate: increase poll timeout waiting for SIGQUIT logging
Increased the maximum time dumpstate will wait for SIGQUIT process
to finish dumping its thread stacks to the logfile to 5 seconds.

Bug: 14057177
Change-Id: I0b43004512855d202f2fe0ea7b0e934e77a3a070
2014-04-30 11:28:31 -07:00
Nick Kralevich 165c8bdfb5 am 0e4d2885: am 2044ac43: Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API."
* commit '0e4d2885a34d31f5dbe5a08bdb654953abaf82a2':
  Convert all selinux_android_restorecon and _setfilecon calls to new API.
2014-02-13 00:16:04 +00:00
Stephen Smalley 26288202e7 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:36:11 -05:00
John Spurlock 5ecd4beef8 Dump system settings for all users
Change-Id: Ic832b19fe698da1984876b2949c3f26990ae5076
2014-01-29 14:34:24 -05:00
Geremy Condra e167d889e4 am a3d3e137: Merge "dumpstate: Add SELinux restorecon call."
* commit 'a3d3e137f473a965fefced9670e3b0c6b5f7f791':
  dumpstate: Add SELinux restorecon call.
2013-04-04 23:42:15 -07:00
Robert Craig 957983787d dumpstate: Add SELinux restorecon call.
Set the security context on the directory used
to dump Dalvik and native stack traces.

Change-Id: Iba13783f10e850485ce1a8d4aa5792d55085eb22
Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>
2013-04-04 06:33:10 -04:00
Jeff Sharkey 27f9e6d849 Support broadcast when dumpstate finishes.
Add flag that sends BUGREPORT_FINISHED broadcast when dumpstate
is finished, including the resulting filesystem paths.  Also reduces
directory creation to 0770.

Bug: 7005318
Change-Id: Id4c6b699a56f8acd859b7ab73368500e1a8f3c67
2013-03-13 16:59:27 -07:00
jp abgrall 574d6902b7 am ba8abb51: Merge "Ensure dumpstate children die"
* commit 'ba8abb517d1eddebeda62bf907fa446e3c3b81f6':
  Ensure dumpstate children die
2013-03-11 12:28:06 -07:00
John Michelau e7b6cf13f9 Ensure dumpstate children die
Use prctl(PR_SET_PDEATHSIG, SIGKILL) in each forked child to ensure
it dies when dumpstate dies.

This is important for two cases:
- dumpstate runs a timer for each child process.  On expiration, it
  sends SIGTERM to kill the process.  Sometimes SIGTERM isn't enough
  to kill a hung process, so the child lives on.
- When dumpstate is killed by the user before completing, outstanding
  children continue to run and generate output.

Change-Id: I96e0dc918c26d56c9fee53611980ba2edd238712
2013-03-11 11:44:15 -05:00
Colin Cross 1493a3974a dumpstate: fix incorrectly zeroed array
Change-Id: I55a916568baf66629b02a6d80fce34b84ffb3a34
2012-11-07 11:25:31 -08:00
Colin Cross 0c22e8b316 dumpstate: dump all threads in show_wchan
for_each_pid only finds processes and not their threads.  Add
for_each_tid and call it for show_wchan so we can see where all
threads are blocked in the kernel.

Change-Id: Iffb59f7c2933cecf51cdd358a36e19932c2f24c7
2012-11-02 23:57:43 -07:00
Elliott Hughes 5f87b31d80 Use a named constant rather than a magic number.
Change-Id: I86e8c91c6f5628df3eec38faf28598cc8cef2ea3
2012-09-17 11:43:40 -07:00
James Dong 1fc4f80fc3 Add stack dump from drmserver process to bugreports
This would be helpful tracking down ANR issues in drmserver

o related-to-bug: 7132419

Change-Id: I7eceaa0c29af26bd0092110be6bddf8f4c063545
2012-09-10 16:10:29 -07:00
Jeff Brown bf7f49238d Include stack traces for certain native processes in bugreport.
Bug: 6615693
Change-Id: I64c3b3ce0bba62d9c332a795f7d979fb753dc27b
2012-06-08 11:45:00 -07:00
Nick Kralevich d51820e8de dumpstate: don't follow symlinks when creating /data/anr/traces.txt
Make Android more robust against symlink attacks when /data/anr
is world-writable.

Bug: 5614000
Change-Id: I9a7e4c4ec9aa4300ac30a968db0dcd276f364ab6
2012-04-06 09:53:45 -07:00
Nick Kralevich c7f1fe2680 Ensure that /data/anr/traces.txt is world-writable
The umask changed for init. We have to force /data/anr to be world
readble and /data/anr/traces.txt to be world writable so dalvik
processes can write to it.

Hopefully this is a short term change while we investigate tightening
up these permissions.

Bug: 6300296
Change-Id: Iacb4c9f1bc69d2ac679697f9cf9a52694f888489
2012-04-06 09:46:10 -07:00
Colin Cross f45fa6b285 move dumpstate and dumpsys from frameworks/base to frameworks/native
Change-Id: I8a5318022ce5cd3e7c8055f21fe5da74639aa6c0
2012-03-26 12:39:26 -07:00