Commit graph

9 commits

Author SHA1 Message Date
Jean-Baptiste Queru
5f83cf0bcf resolved conflicts for merge of a6405e9d to jb-mr1-dev
Change-Id: I2c698ec017f29c9ccc89231439cb6c8013914009
2012-08-23 07:43:47 -07:00
Jean-Baptiste Queru
db56bb4aeb Merge "libcorkscrew: avoid future name collisions." 2012-08-22 10:43:11 -07:00
Jean-Baptiste Queru
ef1945f8e9 am 417e3041: am 8124e073: Merge "Fix unused parameter warnings"
* commit '417e3041b8b6ba9582c2e4d2003cfcd77435fc21':
  Fix unused parameter warnings
2012-08-15 09:37:55 -07:00
Edwin Vane
46beebea82 Fix unused parameter warnings
-Werror is used for this project so these warnings were causing the
clang build to fail.

Change-Id: I18c447ce239645e05f59c3cf0e2b8bb17d9d3030
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Tarea A Siraj <tareq.a.siraj@intel.com>
2012-08-13 09:11:03 -04:00
David 'Digit' Turner
b4ef91b975 libcorkscrew: avoid future name collisions.
This is a forward-compatibility patch used to avoid two problems:

1/ The C library <signal.h> is going to be updated to define 'struct sigcontext'
   properly soon. Avoid redefining this structure here when it's not really needed
   to prevent a type conflict.

2/ Similarly, proper ucontext_t support is going to be added, prevent conflict by
   using a macro renaming trick. Mainly because there is a slight chance that the
   C library definition will follow a slightly different layout/naming.

For context, see details at:

  http://code.google.com/p/android/issues/detail?id=34784
  https://android-review.googlesource.com/#/c/38875/1

Change-Id: Ie94eb5d77297f8e0bafd146b65a648bd8805a551
2012-07-13 11:22:13 +02:00
Elliott Hughes
6b3bab39d1 Fix libcorkscrew for x86 targets (bionic) as well as the host (glibc).
Longer term, we might want to offer <ucontext.h> and have that be like glibc's,
but not today. (Note that POSIX says nothing about mcontext_t and glibc,
Mac OS, and the Linux kernel headers are all mutually incompatible.)

Change-Id: Ia074b51f4567cd54e06bbe29721389c8d1278614
2012-05-21 13:59:52 -07:00
Elliott Hughes
71363a8075 Support libcorkscrew on x86 hosts in binaries using glibc.
Change-Id: I1f2b7f21cc7f8227dbe7d294fed88cb691a24d09
2012-05-18 15:50:54 -07:00
Jeff Brown
f0c5872637 Improve stack unwinder robustness.
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-11-04 01:11:04 -07:00
Jeff Brown
10484a0684 Add x86 stack unwinding support to libcorkscrew.
Change-Id: I1d4f4b11b4c8bf517b1dd07afccbedc41a84fd1b
2011-10-22 16:43:00 -07:00