Commit graph

348 commits

Author SHA1 Message Date
Christopher Ferris
600017332c Display the map offset for each frame.
The dlopen of a shared library in an apk results in large map offsets.
Unfortunately, the current way that the frame data is printed, it's
impossible to tell what the relative pc is relative to. With the
addition of the offset, it's possible to figure out what the relative
pc actually references.

Bug: 23348999
(cherry picked from commit e0ab23223a)

Change-Id: I950f92c1cb29ee05eed777f47453efa03318cf3e
2015-08-20 14:07:30 -07:00
Christopher Ferris
e0ab23223a Display the map offset for each frame.
The dlopen of a shared library in an apk results in large map offsets.
Unfortunately, the current way that the frame data is printed, it's
impossible to tell what the relative pc is relative to. With the
addition of the offset, it's possible to figure out what the relative
pc actually references.

Bug: 23348999
Change-Id: Ia51b669ea3f810158cfd0d71d9ae89bf9a3170d3
2015-08-20 11:16:54 -07:00
Pirama Arumuga Nainar
837eff22c8 Use delete[] to de-allocate pointers from new[]
Upstream clang has a new diagnostic, '-Wmismatched-new-delete' to
generate a warning (that becomes an error with -Werror) when delete is
used to deallocate pointers created with 'new[]'.  This patch fixes
'delete's that trigger this warning/error.

Change-Id: I7551e856b4b13bfae4cb78b5664d8652322683cf
2015-07-09 10:50:04 -07:00
Calin Juravle
28042b5627 Add static versions for libbacktrace and libnativebridge. Bug fixes.
Change-Id: Ic68ac15b2676e4f475330c8e7bb34e0d48783686
2015-07-02 02:09:20 +01:00
Christopher Ferris
5c57518b6f Remove PtraceRead error message.
This error message has no meaning and makes it look like an unwinding
failure occurred. These messages are showing up more often now
that a lot more of debuggerd is using the ReadWord and Read calls.

If a higher level function wants to indicate there is an error, then
it can add a more meaningful error.

Bug: 21818730
(cherry picked from commit 35c8136d96)

Change-Id: Ie6e20fbc18702fde935f2cf8cbf1b297fda43282
2015-06-12 23:32:20 -07:00
Christopher Ferris
35c8136d96 Remove PtraceRead error message.
This error message has no meaning and makes it look like an unwinding
failure occurred. These messages are showing up more often now
that a lot more of debuggerd is using the ReadWord and Read calls.

If a higher level function wants to indicate there is an error, then
it can add a more meaningful error.

Bug: 21818730
Change-Id: I83aca9cf241aee99e7425059b1b6e0d229c08a5e
2015-06-12 23:03:22 -07:00
Christopher Ferris
7e2cb84e9c Modify the code to avoid potential deadlocks.
If the signal to dump a thread is never delivered, then it's
possible for a deadlock. The signal handler is responsible for
unlocking and deleting the ThreadEntry created for the pid/tid
combination. This means if the signal is lost, the ThreadEntry
gets stuck locked and never deleted. If a second attempt to get
a backtrace of this thread occurs, there is a deadlock.

Also, decrease the timeout from 10 seconds to 5 seconds. The original
10 seconds was because the unwind was actually done in the signal
handler. Now the signal handler does nothing but copy the ucontext
structure and let the caller do the unwind.

Bug: 21086132
(cherry picked from commit 2d09171758)

Change-Id: I414c500eb08983a5017caf3fce4f499465575a9d
2015-06-01 14:10:17 -07:00
Christopher Ferris
2d09171758 Modify the code to avoid potential deadlocks.
If the signal to dump a thread is never delivered, then it's
possible for a deadlock. The signal handler is responsible for
unlocking and deleting the ThreadEntry created for the pid/tid
combination. This means if the signal is lost, the ThreadEntry
gets stuck locked and never deleted. If a second attempt to get
a backtrace of this thread occurs, there is a deadlock.

Also, decrease the timeout from 10 seconds to 5 seconds. The original
10 seconds was because the unwind was actually done in the signal
handler. Now the signal handler does nothing but copy the ucontext
structure and let the caller do the unwind.

Bug: 21086132
Change-Id: Idc735dbf6147ec879d35bd4f034c5d227e26a98d
2015-06-01 13:51:51 -07:00
Christopher Ferris
eb19e76632 Prevent crashes if a map cannot be created.
Under some conditions, /proc/<pid>/maps might return nothing. If we
try and unwind in this case, we'll crash. Check this case and fail
the unwind.

Add checks that no other functions try and use map_ without
checking for nullptr.

Add logging when an unwind fails so it's clear what happened.

Bug: 21162746
Change-Id: I56ce51dda0cfc9db20475a441f118108196aa07c
(cherry picked from commit 30c942cf10)
2015-05-15 11:32:53 -07:00
Christopher Ferris
30c942cf10 Prevent crashes if a map cannot be created.
Under some conditions, /proc/<pid>/maps might return nothing. If we
try and unwind in this case, we'll crash. Check this case and fail
the unwind.

Add checks that no other functions try and use map_ without
checking for nullptr.

Add logging when an unwind fails so it's clear what happened.

Bug: 21162746
Change-Id: I56ce51dda0cfc9db20475a441f118108196aa07c
2015-05-14 17:56:41 -07:00
Christopher Ferris
684fb77c82 Add tests for elf unwinding in memory.
Bug: 19517541
(cherry picked from commit 67aba6881d)

Change-Id: I914636ccd814e041475b6b2d81119cac1745a9ff
2015-05-13 13:44:47 -07:00
Dan Albert
428fad97a0 Remove libbacktrace definition of gettid.
Also simplifies the Darwin implementation of gettid, because
apparently libbacktrace had a better way of doing it.

Bug: 19517541

(cherry picked from commit 23f750b068)

Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
2015-05-13 13:44:34 -07:00
Christopher Ferris
67aba6881d Add tests for elf unwinding in memory.
Bug: 19517541
Change-Id: Ib42360a82934ff7103e2ccb64c1105c59aa3fdea
2015-05-12 16:11:47 -07:00
Christopher Ferris
8bd4a4ecdc Fix small ptrace reads.
The BacktracePtrace::Read function crashes if the number of bytes to
read is less than the number of bytes needed to align the read to
a word_t boundary.

Fix this and add a test for this case.

Change-Id: I50808849ece44928f65dba1d25309e3885c829a2
(cherry picked from commit 944f417ccb)
2015-05-06 19:08:52 -07:00
Christopher Ferris
944f417ccb Fix small ptrace reads.
The BacktracePtrace::Read function crashes if the number of bytes to
read is less than the number of bytes needed to align the read to
a word_t boundary.

Fix this and add a test for this case.

Change-Id: I50808849ece44928f65dba1d25309e3885c829a2
2015-05-06 16:39:17 -07:00
Christopher Ferris
af67fb2475 Add offset to map data.
Also, print the offset in the maps section.

Bug: 20864928
Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61
(cherry picked from commit 5c8856854d)
2015-05-06 16:35:50 -07:00
Christopher Ferris
5c8856854d Add offset to map data.
Also, print the offset in the maps section.

Bug: 20864928
Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61
2015-05-06 12:50:09 -07:00
Christopher Ferris
2106f4ba95 Add load base to map for relocation packing.
The new linker relocation packing support uses non-zero load bases,
so we better handle them properly.

Also print out the load base for a map if it's non-zero.

Bug: 20687795
(cherry picked from commit 329ed7dae4)

Change-Id: Ibc37d8c8bb032820dca4e7531184349ba6d402d2
2015-05-01 17:09:49 -07:00
Christopher Ferris
329ed7dae4 Add load base to map for relocation packing.
The new linker relocation packing support uses non-zero load bases,
so we better handle them properly.

Also print out the load base for a map if it's non-zero.

Bug: 20687795
Change-Id: Iec2d1db2051e7b4a278c1dfa57d745128a7f2974
2015-05-01 16:04:24 -07:00
Colin Cross
5b439eaf93 Fix unused argument error on darwin
Change-Id: Ie90f7f32b5bd1496bd663c969d729ea3f96d2588
2015-04-30 15:11:34 -07:00
Colin Cross
db134ca20c Remove libbacktrace dependency on libcutils
libbacktrace doesn't use libcutils, it uses liblog.

Change-Id: Ie1328b18a9f189c081891ba3b9a28487e830e579
2015-04-30 14:25:57 -07:00
Dan Albert
23f750b068 Remove libbacktrace definition of gettid.
Also simplifies the Darwin implementation of gettid, because
apparently libbacktrace had a better way of doing it.

Change-Id: I9e14f9176b167405a5aaa5b8a0db0327c7126271
2015-04-30 12:52:21 -07:00
Christopher Ferris
3b9d14ac4b Remove libunwind-ptrace dependency.
Change-Id: Iae4a73546f672c208ffe1b224e8d9a9e693f95f0
2015-04-15 14:50:39 -07:00
Christopher Ferris
97e00bb25a Update the test for better output on error.
Change-Id: Id3b0b96a33441ce5d908aac38e639ac3598a7a89
2015-04-02 15:36:09 -07:00
Christopher Ferris
ca09ce902c Discards frames for code within library.
When doing a local unwind, do not include the frames that come
from either libunwind or libbacktrace.

Bug: 11518609
Change-Id: I0ec8d823aebbfa0903e61b16b7e5663f3fd65e78
2015-04-01 15:58:20 -07:00
Christopher Ferris
9dc41d5d34 Merge "Refactor the code." 2015-03-31 21:11:36 +00:00
Stephen Hines
9c01c44bd6 Merge "Add -Wno-inline-asm to Clang flags." 2015-03-31 20:56:06 +00:00
Christopher Ferris
2c43cff01d Refactor the code.
The object hierarchy was confusing and convoluted. This removes
a lot of unnecessary code, and consolidates the BacktraceCurrent
and BacktraceThread code into BacktraceCurrent.

Change-Id: I01c8407d493712a48169df49dd3ff46db4a7c3ae
2015-03-31 10:51:44 -07:00
Stephen Hines
035e9ba97e Add -Wno-inline-asm to Clang flags.
The latest clang (r230699) does not allow SP/PC to be declared in inline asm
lists. This is a problem for libraries that are attempting to save all
register state.

Change-Id: I1ce80530f8be85fd74e949d0c65b60080e0aaf2a
2015-03-31 09:41:24 -07:00
Dan Albert
d0a793dca3 Remove uses of libcxx.mk.
This is a no-op.

Change-Id: Iecbcd5f6d818abbf98767a2e996c10f454b652e4
2015-03-27 11:24:04 -07:00
Andreas Gampe
dce8f2923d Libbacktrace: Use frame-pointer on host
Otherwise it may have problems unwinding over itself.

Change-Id: I9b0d108018ae3f5d98b9ae6fb62d0af83a77d18e
2015-03-26 16:21:13 -07:00
Christopher Ferris
2b4a63fc6a Add variable length read to Backtrace.
Included tests for this new feature.

Changed the NULLs to nullptr in backtrace_test.

Changed UniquePtr to std::unique_ptr in backtrace_test.

Change-Id: I92375465b8f8ba84589834cc162db5915bf1be81
2015-03-17 14:56:02 -07:00
Christopher Ferris
12385e3ad0 Move map data into backtrace data proper.
The backtrace structure used to include a pointer to a backtrace_map_t
that represented the map data for a particular pc. This introduced a
race condition where the pointer could be discarded, but the backtrace
structure still contained a pointer to garbage memory. Now all of the map
information is right in the structure.

Bug: 19028453
Change-Id: If7088a73f3c6bf1f3bc8cdd2bb4b62e7cab831c0
2015-02-06 15:00:09 -08:00
Christopher Ferris
2a176a89c2 Remove link to gccdemangle.
Bug: 18930951
Change-Id: Ib7fd332b6e02241c0676ef33d2fa210a72efe1b1
2015-02-05 19:33:11 -08:00
Trevor Drake
5e4d0a5ec8 Cleanup libbacktrace Android.mk
Removed unnecessary libbacktrace_c_includes variable

Change-Id: I2ef29dc9810f7d9a7dcf5c232e9e85d2fc2fd5e8
2014-12-12 04:40:06 +00:00
Christopher Ferris
3cdbfdce6a Convert futex to cond wait.
Switch to the better supported pthread_cond to handle the Wait/Wake
functions.

Also, increase the number of simultaneous threads in the thread tests.

Bug: 18381207

(cherry picked from commit db44538387)

Change-Id: Id326a7a7b92cb61573def3f761597c40f3ef2f4b
2014-11-14 10:46:39 -08:00
Dan Albert
5570c9b174 Add LOCAL_MULTILIB := both to Darwin libbacktrace.
This was previously set for libbacktrace_libc++, but apparently never
was for libbacktrace.

Change-Id: I85dc44b356710c6367f5cea3bc0a4d6c817ca202
2014-11-13 14:55:06 -08:00
Dan Albert
0d7164d4dd Remove the stlport linked libbacktrace.
Rename the libc++ linked libbacktrace to the normal name.

Bug: 15193147
Change-Id: I75caf1ee527e3703825e0db757497fb8fa3dd122
2014-11-11 15:57:38 -08:00
Brian Carlstrom
34f9b1e9f2 am 2ea89b63: am 936a236b: Merge "Add uncached argument to BacktraceMap::Create on darwin"
* commit '2ea89b631d58ecd8edd7165ed8840d1e1047aa72':
  Add uncached argument to BacktraceMap::Create on darwin
2014-08-05 13:11:42 +00:00
Christopher Ferris
1cbdb2f773 am f02593b0: Allow getting an uncached process map.
* commit 'f02593b0e61f8108449770094caa7bb39a646ec1':
  Allow getting an uncached process map.
2014-08-05 02:28:01 +00:00
Brian Carlstrom
b978a329ef Add uncached argument to BacktraceMap::Create on darwin
Change-Id: I247a98fc3b98879a0c34a975f9914ccec95d1a04
2014-08-05 00:15:49 -07:00
Christopher Ferris
dda47b7868 Allow getting an uncached process map.
(cherry picked from commit f02593b0e6)

Change-Id: I2012bf2dc553ebc663345b9eac6d794e80df9c00
2014-08-04 19:21:23 -07:00
Christopher Ferris
f02593b0e6 Allow getting an uncached process map.
Change-Id: I58d7e90a7b5c4476a4b9f51640c54d13748ac220
2014-08-04 17:17:57 -07:00
Tim Murray
650f43d0d5 am 83ddddaa: am 4795ce06: Merge "Update makefiles for host clang."
* commit '83ddddaaba0fea8a1c0dcc64e795112bed67815f':
  Update makefiles for host clang.
2014-07-25 01:03:31 +00:00
Tim Murray
06fce9db05 Update makefiles for host clang.
bug 16172793

Change-Id: If7484c5dbcccce7d925bec97bff0a3e4c30e9434
2014-07-24 12:18:22 -07:00
Ian Rogers
91c73f6c51 am 38dda3b8: am c309b97e: am e4022279: Merge "libbacktrace_libc++ needs to be multilib on the Mac too."
* commit '38dda3b8887286c44964dda0ce1c96425d9744f0':
  libbacktrace_libc++ needs to be multilib on the Mac too.
2014-06-25 10:15:34 +00:00
Ian Rogers
c132aaf0c3 libbacktrace_libc++ needs to be multilib on the Mac too.
Change-Id: I2053345253c1d57c3485b790163ba0b4b10cc326
2014-06-24 21:57:55 -07:00
Ian Rogers
9db200f7ad am 44367492: am 4ac17e3b: am 4dfe6faa: Merge "Enable host multilib for ART testing."
* commit '4436749284dc2b74e6e0f430d0f803d1b7862d19':
  Enable host multilib for ART testing.
2014-06-17 18:58:34 +00:00
Ian Rogers
5af80aa119 Enable host multilib for ART testing.
Change-Id: Ic3ae5122eba13565fb5a4cb1bd0e7e465fb2140c
2014-06-17 01:50:25 -07:00
Ian Rogers
8396e75192 am 2b958116: am a31dab8a: am a9aa0f2c: Merge "Build the libc++ variant of libbacktrace on the host for Mac."
* commit '2b95811601b05db7894359f037005a008274a973':
  Build the libc++ variant of libbacktrace on the host for Mac.
2014-06-11 21:48:41 +00:00
Ian Rogers
deebae596b Build the libc++ variant of libbacktrace on the host for Mac.
Bug: 13751317
Change-Id: Iefadec1cd9b3ca109ac436bd5eb7c096c2dcbe40
2014-06-11 12:55:50 -07:00
Christopher Ferris
5a19885641 am 012090e5: am a0962b68: am d917d64f: Merge "Only copy mcontext data from sigcontext."
* commit '012090e57b697133ad6f7d989e103d71302749f8':
  Only copy mcontext data from sigcontext.
2014-05-23 22:40:58 +00:00
Christopher Ferris
e484607622 Only copy mcontext data from sigcontext.
The ucontext_t data structure could be bigger than the kernel data
structure. Since the unwinder only cares about the mcontext data, only
copy that out of the structure. The mcontext data is the same size in
the kernel and in the ucontext_t structure.

Bug: 15189014
Change-Id: I5978169c4425b8212e11db85a57eb319cd0e264b
2014-05-23 15:11:26 -07:00
Dan Albert
425ed96a38 am 633a2e3b: am 3ab1d61b: am 3b5cd911: Merge "Remove libstdc++ dependency from host libbacktrace"
* commit '633a2e3b6a1d00257965a5772a5467a6df9911a5':
  Remove libstdc++ dependency from host libbacktrace
2014-05-22 18:28:01 +00:00
Dan Albert
3b5cd9117d Merge "Remove libstdc++ dependency from host libbacktrace" 2014-05-22 17:21:52 +00:00
Dan Albert
e2a3d37c8f am 219e867f: am 7f8ebb81: am 30291f21: Merge "Add missing headers"
* commit '219e867f61755720af3cddb5e8d2fe0e198a27ab':
  Add missing headers
2014-05-22 13:32:56 +00:00
Dan Albert
a3a8f6d2ab Remove libstdc++ dependency from host libbacktrace
The libc++ version of libbacktrace on the host was still linking against
libstdc++, and this was causing problems in art.

Change-Id: I1d14fb9e18abd074affcf46c8044407041970669
2014-05-21 20:10:02 -07:00
Dan Albert
ac2fe7eb81 Add missing headers
These headers are needed for pid_t and free when using libc++ headers (POSIX
does not require that the symbols be exposed with the previous includes).

Change-Id: Ia51a4fdfdbae7377130a43c401c2d8d241671d1e
2014-05-21 20:08:35 -07:00
Dan Albert
fbc5ca28c9 am c6112ca4: am 5b654f15: am 201bf676: Merge "Really fixes the ub branches"
* commit 'c6112ca4b8d0712fdd4c0ab3258d3ceaf2f8064e':
  Really fixes the ub branches
2014-05-20 00:23:03 +00:00
Dan Albert
ad51136267 Really fixes the ub branches
Change-Id: I1d78f4e6c1d8086c2895f6739c3202e9ef74fee2
2014-05-19 14:49:13 -07:00
Dan Albert
917152b8cc am 3f01965b: am 121f209d: am e1efe23f: Merge "Fix unbundled branches"
* commit '3f01965b3d1335ffff57e15fd47e5d99400dad3f':
  Fix unbundled branches
2014-05-19 19:31:17 +00:00
Dan Albert
a8b8460220 Fix unbundled branches
Change-Id: Ic8a58a6cf55221ec361bbb80c7c9636fe1349943
2014-05-19 11:40:27 -07:00
Dan Albert
7ce29b5826 am e9b36f1a: am 888f95e2: am f03bd953: Merge "Adds libc++ versions of libbacktrace"
* commit 'e9b36f1a9a280877cb130452c50af6a51360a203':
  Adds libc++ versions of libbacktrace
2014-05-19 18:33:51 +00:00
Dan Albert
40a46dde9c Adds libc++ versions of libbacktrace
Change-Id: I4a1ce30e7c2166ac1846cc90de0252beee542ee6
2014-05-19 10:23:16 -07:00
Christopher Ferris
d8698d739f am 413001aa: am 3a49aa7b: am 9428a289: Merge "Only include ucontext.h when necessary."
* commit '413001aa6cd4addcf544348020f992ebc6d3e2d4':
  Only include ucontext.h when necessary.
2014-05-10 00:27:42 +00:00
Christopher Ferris
c58287d601 Only include ucontext.h when necessary.
Change-Id: I29014f6c6b82e0a9797e5d76147b3c4e3d82a7f5
2014-05-09 16:59:06 -07:00
Christopher Ferris
e49e43d4aa am 3adbe79d: am 66e31dc5: am 3a088524: Merge "Rewrite unwind thread handling."
* commit '3adbe79d2f14665ff55a9b0db245abebc105658d':
  Rewrite unwind thread handling.
2014-05-09 16:45:35 +00:00
Christopher Ferris
3a088524cb Merge "Rewrite unwind thread handling." 2014-05-09 16:33:12 +00:00
Christopher Ferris
a2efd3ac7a Rewrite unwind thread handling.
This new version doesn't require any specialized thread
implementation, it uses the Current implementation to do its job.
In addition, it runs much faster when multiple threads are trying
to unwind at the same time since the global signal lock is held for
only a small amount of time. Even running through the threads one at
a time should be faster since it no longer requires two passes through
the unwound stacks.

The new code now allows multiple simultaneous unwinds of the
same thread.

Finally, add the ability to unwind from a ucontext_t passed in. This
functionality doesn't work for remote unwinds yet.

Change-Id: I4d181d7ca5ffd2acfd1686e668e6d21e36b425cb
2014-05-08 14:42:16 -07:00
Ying Wang
da6a0aa0df am b18da571: am 1e6cd741: am 803fb62b: Merge "Remove unused LOCAL_LDLIBS."
* commit 'b18da571f90eebedd99fe5607a6b0d7ae4e91893':
  Remove unused LOCAL_LDLIBS.
2014-05-08 18:23:57 +00:00
Ying Wang
9f437d7181 Remove unused LOCAL_LDLIBS.
Change-Id: I42aeb7668183e7a06207ee063f6eee4d37d66c6e
2014-05-07 15:36:05 -07:00
Christopher Ferris
68831f852e am 7e250b00: am fbd2a506: am 9ed86eff: Merge "Use real time signal for threads instead of SIGURG."
* commit '7e250b002b5a28a3919bc704e9bc6610b3a4096f':
  Use real time signal for threads instead of SIGURG.
2014-05-01 00:24:30 +00:00
Christopher Ferris
aa63d9f980 Use real time signal for threads instead of SIGURG.
This guarantees that any application is not also using this signal
for some other purpose.

Change-Id: I7c9bbb0ec8bb4e13322ecda951bcd43c6bf6ee1a
2014-04-30 16:32:47 -07:00
Christopher Ferris
873dc35b74 am c79e511d: am 481b551a: am 0b0e0eae: Merge "Small cleanup of duplicated test values."
* commit 'c79e511d828cd3dfdd79af40ce5be556a4c2ff9b':
  Small cleanup of duplicated test values.
2014-04-29 16:09:06 +00:00
Christopher Ferris
11b5fcb9f1 Small cleanup of duplicated test values.
A few flags were duplicates of flags already passed when using the TEST
targets.

Change-Id: I8f0d09915f5b830050fe25635a0852e8536e3aca
2014-04-28 21:06:31 -07:00
Christopher Ferris
8439e3249e am 2d3bccde: am 61af820e: am 2317287d: Merge "Remove libcorkscrew."
* commit '2d3bccdedc058e2f9e10d507c43e1da51d32260f':
  Remove libcorkscrew.
2014-04-25 22:38:21 +00:00
Christopher Ferris
8f36be3cdb am e3615230: am 8c526578: am 4a5966b9: Merge "Change sprintf to snprintf calls."
* commit 'e36152308da6b1e67b05ad790081bc7e4424ae4e':
  Change sprintf to snprintf calls.
2014-04-25 22:38:10 +00:00
Christopher Ferris
688a8a7232 Remove libcorkscrew.
All unwinding is now done through libunwind.

Change-Id: I93ba6f5bd5ad41eeb5f6a93113b7894f842cc8e0
2014-04-25 11:25:56 -07:00
Christopher Ferris
b8c72957f0 Change sprintf to snprintf calls.
Change-Id: I8893246fcd541d97b02a1a4cac81c53c6cd2e394
2014-04-24 16:20:50 -07:00
Christopher Ferris
04c5192ff5 am 3af88bc6: am e87dab14: am 07fa0433: Merge "Remove the arm64 special case."
* commit '3af88bc6377f50904ad3172b06f76d95ceda9cda':
  Remove the arm64 special case.
2014-04-22 13:37:44 +00:00
Christopher Ferris
04fd4389fb Remove the arm64 special case.
The stack-protector option is handled by the global makefiles.

Change-Id: I99c4a1624e72ad91ac10eef27c0e3758fe9af8ba
2014-04-21 17:57:56 -07:00
Christopher Ferris
17224d57fb Avoid logging functions from signal handler.
(cherry picked from commit 9007677fcb)

Change-Id: Ic0163f43308c6a281ab3757d90933e5127843fed
2014-04-15 12:18:44 -07:00
Christopher Ferris
9007677fcb Avoid logging functions from signal handler.
Change-Id: Ic61f7054ced223631f95efb519fa1825fb3e1010
2014-04-11 13:05:07 -07:00
Christopher Ferris
7962e4acc7 am 6a8c3164: am e35cba9a: am a97798af: Merge "Create an UnwindMapLocal object."
* commit '6a8c316438032c72ffdd2988cc1eb2717f477254':
  Create an UnwindMapLocal object.
2014-04-04 03:19:39 +00:00
Christopher Ferris
e296091060 Create an UnwindMapLocal object.
The way libunwind handles local unwinds is different from remote unwinds,
so create a new map object to handle the differences.

Add new test to verify the map data is being generated correctly.

Add new tests to check for leaks.

Refactor the BACK_LOGW code into a single header file.

Change-Id: I01f3cbfc4b927646174ea1b614fa25d23b9b3427
2014-04-03 14:19:24 -07:00
Christopher Ferris
dc6d9241de am a6631bb3: am 3bcefc66: am 62f12bd9: Merge "Enable libunwind for mips."
* commit 'a6631bb38fbf77415592c10734710df8afa0deab':
  Enable libunwind for mips.
2014-02-26 22:39:08 +00:00
Christopher Ferris
c29a1345a0 Enable libunwind for mips.
Change-Id: Ib1d7bea0cb7ac09a9e15c7f429ecfd944649fc87
2014-02-26 13:41:32 -08:00
Colin Cross
c89210e3a8 am ec04a8d4: am d90b11b6: am 13274a26: Merge "Fix logging errors inside ALOGV"
* commit 'ec04a8d45bc6b01c3c2cd4a3064d194f7beeb386':
  Fix logging errors inside ALOGV
2014-02-10 12:51:26 +00:00
Colin Cross
f4b0b7971c Fix logging errors inside ALOGV
Fix errors exposed by adding checking to disabled ALOGVs.

Change-Id: I36b77bb0ad8dc7661b0f834f20d1179b86134d57
2014-02-07 13:26:04 -08:00
Christopher Ferris
a3fe7a7927 am 10c2607c: am 77b23023: am 3faf86c0: Merge "Call a specialized local map set."
* commit '10c2607c3cc4903ca8dcbe2245f66d21af199865':
  Call a specialized local map set.
2014-02-03 17:00:01 +00:00
Christopher Ferris
73dc1cc3fb Call a specialized local map set.
Bug: 12852152
Change-Id: I8a0c558bc218805b0e06371af0af055e4aa6e0bb
2014-02-01 11:53:33 -08:00
Christopher Ferris
936fa72620 am 5127626b: am 3133a4a2: am 0fdf0dc7: Merge "Refactor makefile."
* commit '5127626b4a7d998a75d366bf1128be91c6047dc0':
  Refactor makefile.
2014-01-31 23:11:20 +00:00
Elliott Hughes
9361b58330 am fe0d5d42: am 5434bf66: Merge "LP64: Enable debuggerd/libbacktrace/libunwind."
* commit 'fe0d5d42e4ca8b77d6a0657be1b8b6343c21d689':
  LP64: Enable debuggerd/libbacktrace/libunwind.
2014-01-31 22:38:29 +00:00
Christopher Ferris
04b1e8c812 Refactor makefile.
With this change allow the creation of host backtrace libraries using
libunwind.

Change-Id: Ie48bb36cf0d2eccf94cb8ff516d829d8032f11f2
2014-01-31 10:16:52 -08:00
Elliott Hughes
daea762e03 am e5734557: am caefe564: Merge "x86: Enable libunwind"
* commit 'e5734557d962c801375eeee600e89c98d65dd976':
  x86: Enable libunwind
2014-01-31 16:41:14 +00:00
Christopher Ferris
6334485f16 am cbe55724: am 7957529d: Merge "Clean up UnwindCurrent.cpp\'s use of ucontext.h."
* commit 'cbe55724c8211c9c06362cebff0a262197dbc351':
  Clean up UnwindCurrent.cpp's use of ucontext.h.
2014-01-31 16:41:13 +00:00
Ian Rogers
f312814060 am c9869057: am 1ca10eab: Merge "Avoid redefinition of __STDC_FORMAT_MACROS."
* commit 'c98690576ab6d7d13e5c0d3387db8149de71d9de':
  Avoid redefinition of  __STDC_FORMAT_MACROS.
2014-01-31 16:41:11 +00: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
Pavel Chupin
c124402f39 x86: Enable libunwind
Change-Id: I098787f57801f68d0419732d5fd475c7e916c92c
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
2014-01-30 11:00:38 -08:00
Christopher Ferris
5c40019a92 Clean up UnwindCurrent.cpp's use of ucontext.h.
Change-Id: I9eff7486b9fe89eac57b5555649b871bc6f1cc77
2014-01-30 10:37:39 -08:00
Ian Rogers
ddeb7cc164 Avoid redefinition of __STDC_FORMAT_MACROS.
Change-Id: I5c65ea196bb9a197a74899ceb53543f289f6d494
2014-01-29 17:53:50 -08:00
Christopher Ferris
cc98fd7eb2 am ab2de415: am 773c9ab7: am c96c2954: am a152ed73: Merge "Fix global pointing to local variable."
* commit 'ab2de41574d15bac8c3ef8f49cfba493ea501a0a':
  Fix global pointing to local variable.
2014-01-29 12:49:39 +00:00
Christopher Ferris
96a0bf1e94 am 36a4e408: am aaf89887: am 6fe31b2f: am d391c9b4: Merge "Re-enable libunwind for arm."
* commit '36a4e4085e55048ee2a78c7d5b50f7395e547fa2':
  Re-enable libunwind for arm.
2014-01-29 12:19:59 +00:00
Christopher Ferris
2b4ae52a56 Fix global pointing to local variable.
Change-Id: I933cbb680ca6310c13634f09a9827077c8dbd568
2014-01-28 22:21:14 -08: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
Christopher Ferris
56e7335902 am 8d12b4a0: am 4fe48966: am 57c9b95b: am 39baa829: Merge "Get arm64 to compile."
* commit '8d12b4a0901df4ab708243b4cd36c19ac2002a50':
  Get arm64 to compile.
2014-01-27 22:23:41 +00:00
Christopher Ferris
edbe3b4b56 Get arm64 to compile.
Change-Id: Ica021aa134388fe7069a5de5df8036ecf0d570f8
2014-01-27 10:52:08 -08:00
Colin Cross
892af2303f am 9222d911: am c8518616: am 02f68c4b: am 4800e20e: Merge "system/core: rename aarch64 target to arm64"
* commit '9222d911a89d30a9b0537e8cdb95401be3a4999e':
  system/core: rename aarch64 target to arm64
2014-01-24 21:24:52 +00:00
Colin Cross
d4146e6091 system/core: rename aarch64 target to arm64
Rename aarch64 build targets to arm64.  The gcc toolchain is still
aarch64.

Change-Id: Ia92d8a50824e5329cf00fd6f4f92eae112b7f3a3
2014-01-23 18:01:14 -08:00
Christopher Ferris
10c51a3875 am f95d880f: am 884116c8: am 719b0198: am 1db584b8: Merge "Attempt to fix Mac build"
* commit 'f95d880fe7e9a8860038a5c8391b89cfbeb0ce76':
  Attempt to fix Mac build
2014-01-18 23:56:34 +00:00
Brian Carlstrom
db5911a08a Attempt to fix Mac build
Change-Id: I1364255bfed7788a35531962508bad804b8d5b7f
2014-01-18 13:55:54 -08:00
Christopher Ferris
6c625f6717 resolved conflicts for merge of 47fa9064 to master
Change-Id: I53fb8ff2dfbefe6246385e624c5c3525cc6f4253
2014-01-17 11:56:04 -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
Elliott Hughes
ef53917406 am 7dee721e: am 42e82f80: am 4a8996fb: am 3352c503: Merge "Copy the bionic -fstack-protector hack into libbacktrace."
* commit '7dee721eb3387fff695e5b5a3480428bccb3cf70':
  Copy the bionic -fstack-protector hack into libbacktrace.
2014-01-15 01:00:47 +00:00
Elliott Hughes
1380ddcab2 Copy the bionic -fstack-protector hack into libbacktrace.
aarch64 doesn't support -fstack-protector yet.

Change-Id: Id1e589742ba074f59d3390d059248c9b371aff58
2014-01-14 16:44:31 -08:00
Christopher Ferris
475377b68a am 117e93a7: am 2c3b9a44: am d9cb2964: am 91e2019f: Merge "Create a bare bones host libbacktrace on mac."
* commit '117e93a7208d028ccbc444aad8bd5ad250459c67':
  Create a bare bones host libbacktrace on mac.
2014-01-14 18:13:24 +00:00
Christopher Ferris
f67c6410d1 Create a bare bones host libbacktrace on mac.
This allows the libbacktrace library to compile for host on mac.

Bug: 12474939
Change-Id: I32cbcf996e6fe9057e5065ba21f89086343704a0
2014-01-13 23:57:35 -08:00
Christopher Ferris
4167d7e5c2 resolved conflicts for merge of 8791ee5c to master
Change-Id: I107bb055941809331c451c1d903f231f07a86ece
2014-01-13 18:14:11 -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
bc12d6329e Move BACKTRACE_NO_TID to BACKTRACE_CURRENT_THREAD.
Use a bit better name for this. The other name was a bit confusing.

Change-Id: I1261f2ee3854a9c8b82133ad0bfbbbe48b43c9ac

(cherry picked from commit 242b1a8c7a)

Conflicts:
	libbacktrace/Backtrace.cpp
2014-01-09 15:49:39 -08:00
Christopher Ferris
a74ead0fd6 resolved conflicts for merge of 72f204de to master
Change-Id: I7345014d00c669aea5e27ea50b2ac658145b068b
2014-01-08 16:20:50 -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
Christopher Ferris
ae998c7117 am 0298da56: am 492b0ca4: am 1e424d8e: am 0afaf7f4: Merge "Fix the ucontext for mips/x86."
* commit '0298da56f410ba0f6a1f1f44deb8e2224f9fc49d':
  Fix the ucontext for mips/x86.
2014-01-07 23:53:18 +00:00
Christopher Ferris
ddc4f093f7 Fix the ucontext for mips/x86.
Remove the mips ucontext definition, there is no need for it any more.

Fix the mips/x86 ucontext copy code to copy the entire uc_mcontext data
across.

Fix a potential memory leak too.

Change-Id: I4272022da5281ed881e2d59a3e19e7f33c01aceb
2014-01-07 14:36:03 -08:00
Elliott Hughes
d0dfd00270 am 3e30f6af: am 090928b1: am a345b253: am dfc48139: Merge "Switch ARM back to libcorkscrew temporarily."
* commit '3e30f6afa042f3bba4822dc5d1ef267ed4b9d722':
  Switch ARM back to libcorkscrew temporarily.
2014-01-02 23:39:38 +00:00
Elliott Hughes
3c67fe9039 Switch ARM back to libcorkscrew temporarily.
We're seeing major stack trace generation performance
regression and want to find out whether it's libunwind.

Bug: 12181612
Change-Id: I3866ea956859f5cbdfe4f1ee6f20a2b6d39962c4
2014-01-02 15:25:21 -08:00
Christopher Ferris
242b1a8c7a Move BACKTRACE_NO_TID to BACKTRACE_CURRENT_THREAD.
Use a bit better name for this. The other name was a bit confusing.

Change-Id: I1261f2ee3854a9c8b82133ad0bfbbbe48b43c9ac
2013-11-12 12:14:51 -08:00
Christopher Ferris
e70f95f349 am 90e67bcd: am d36bfc30: am e6279294: Merge "Revert "Revert enabling libunwind.""
* commit '90e67bcdc383d552dc5325039c86b5bef5429b05':
  Revert "Revert enabling libunwind."
2013-11-07 21:30:34 -08:00
Christopher Ferris
e6feaeeda1 Revert "Revert enabling libunwind."
This reverts commit db2309e3d1.

Change-Id: I1626442f029473066ce20921667a406f1a1ea865
2013-11-08 02:59:52 +00:00
Elliott Hughes
d283d93489 am 8ddd08b1: am 4ae94541: am 62ea993a: Merge "Revert enabling libunwind."
* commit '8ddd08b1f24d361ace9cd78198664db4bf7e1325':
  Revert enabling libunwind.
2013-11-07 09:44:32 -08:00
Christopher Ferris
3c8b229f60 am c3920dee: am 11d04d04: am 351b0123: Merge "Enable libunwind on arm platforms."
* commit 'c3920dee104856025f9416670efd7f05d1acd3a0':
  Enable libunwind on arm platforms.
2013-11-07 09:01:24 -08:00
Christopher Ferris
db2309e3d1 Revert enabling libunwind.
It appears that some branches might not have libunwind set up properly.

Change-Id: Ia72889e115bc2791c7a9e67563c5f4a62197cafd
2013-11-07 08:12:10 -08:00
Christopher Ferris
22f91cb3a1 Enable libunwind on arm platforms.
Bug: 8410085
Change-Id: I8a645ec0e04b38fc186bbc0f0cc597e31b05cc55
2013-11-06 15:40:23 -08:00
Christopher Ferris
62a70df064 am dee1842d: am adbb3352: am a2d1469c: Merge "Use new defines in test code."
* commit 'dee1842d2f6861dd4cb2d622992ec2c75f19ab3e':
  Use new defines in test code.
2013-11-05 14:22:25 -08:00
Christopher Ferris
0186edee58 am 2e47c8ac: am 1e1bae1b: am c2945850: Merge "Add some clarifying defines."
* commit '2e47c8ac74e070d62cfb46355c7c04797657c594':
  Add some clarifying defines.
2013-11-05 14:22:20 -08:00
Christopher Ferris
d709ad3da0 am 4ddea7f4: am d5a7c371: am 408b3acf: Merge "Add corkscrew support for finding static symbols."
* commit '4ddea7f44c6362e7c34939302729e4508aa665c5':
  Add corkscrew support for finding static symbols.
2013-11-05 13:00:47 -08:00
Christopher Ferris
7f081ec079 Use new defines in test code.
In addition, fix up the warnings and remove the -fpermissive when
compiling.

Change-Id: Ia27b902499b34ff3d881acb9057120af390baf2c
2013-11-05 12:13:05 -08:00
Christopher Ferris
cbfc7302fb Add some clarifying defines.
In order to be explicit in the Backtrace::Create() calls, adding a couple
of defines and some comments to describe what they mean.

Change-Id: I6ad08c529791821496a95fa33cea1c95b0a7eada
2013-11-05 11:05:32 -08:00
Christopher Ferris
923b536920 Add corkscrew support for finding static symbols.
Change-Id: Ie557a9b0efadece75e1accaa7e214fb559eb19e1
2013-11-04 14:50:36 -08:00
Christopher Ferris
74160cb775 am 6b7b6541: am b5c24e09: am 8c58086c: Merge "More libbacktrace fixes."
* commit '6b7b65417aead0189681c12d9162f31e8bc9b3e5':
  More libbacktrace fixes.
2013-10-30 14:33:32 -07:00
Christopher Ferris
8ed46278be More libbacktrace fixes.
Included in minor fix ups is the addition of a warning macro to replace
all of the ALOGW calls.

Fix a race where multiple threads could be attempting to unwind the threads
of the current process at the same time.

Bug: 8410085

Change-Id: I02a65dc778dde690e5f95fc8ff069a32d0832fd1
2013-10-30 14:14:54 -07:00
Christopher Ferris
6996f91809 resolved conflicts for merge of 0433d622 to master
Change-Id: I6799c3fe8900ddcb2e9fe3032793dbb0996cf177
2013-10-29 13:56:52 -07: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
4aef2e911e am 7bdb7b42: am 81890fd8: am 5daba1e0: Merge "Only build host library on linux-x86."
* commit '7bdb7b42224c6139c400eb47a5e9b660184aad54':
  Only build host library on linux-x86.
2013-10-02 14:34:43 -07:00
Christopher Ferris
9e1ee2b3c6 Only build host library on linux-x86.
Change-Id: I26d5bd4b34c3669897fea1488fa58972f4299757
2013-10-02 14:19:19 -07:00
Christopher Ferris
6d22960759 Move cutils/log.h to log/log.h.
The log.h file moved, so clean up these references to the old
location.

Change-Id: I25494ea069bfb20fa07a02e67868c8be82e60161
2013-10-01 23:46:23 -07:00
Christopher Ferris
a16a4e10e1 Fix problems in libbacktrace.
- Add a wait for stop to backtrace_test. There is a possible race
  condition that is exposed when using libunwind.
- Fix a few calls to unwind function calls.

Bug: 8410085
Change-Id: I7487d687f6d4b7b05b8a96ad1c5f7183681e5c95
2013-10-01 18:08:03 -07:00
Christopher Ferris
7fb22878d4 Create a single backtrace library.
This library will be used to abstract away getting backtrace
data from how it is implemented. This is the first step to
replacing libcorkscrew with libunwind.

Bug: 8410085
Change-Id: Ie8f159e96a055d378e1ddc72d40239fba4cf52b7
2013-09-28 12:26:35 -07:00