Commit graph

348 commits

Author SHA1 Message Date
Christopher Ferris
e1eb2272d6 Merge \"Fix race condition updating local map data.\"
am: 863d8e11b9

Change-Id: I00899ce500c2ae8bc58b6eb42c01d8688dd232c0
2016-06-18 00:05:26 +00:00
Christopher Ferris
3a14004c7f Fix race condition updating local map data.
If the underlying local map changes, it's possible for multiple
threads to try and modify the map data associated with the UnwindLocalMap
object. Add a lock when generating the local map to avoid this problem.

In addition, add a read lock whenever any caller gets the maps iterator.
Updated all iterator callers to make this lock.

Bug: 29387050
Change-Id: Ie34822c3d8fd3bdb3dd126aeeb399969c36508c1
2016-06-16 23:28:11 -07:00
Dan Willemsen
823d5bbc20 Merge "Remove invalid uses of -l and -I" am: 5d6193c658
am: 9ae3c079dc

* commit '9ae3c079dca647869dcbc5a5075609f0895e4f4c':
  Remove invalid uses of -l and -I

Change-Id: Id0ddd34cee10579684cdde36f3c095658a50784b
2016-06-01 21:57:27 +00:00
Dan Willemsen
ee2da03e26 Remove invalid uses of -l and -I
LOCAL_LDLIBS should only be used with -l flags for NDK and some host
libraries. Other uses should use LOCAL_SHARED_LIBRARIES.

LOCAL_LDFLAGS should not contain -l entries, they should be in
LOCAL_LDLIBS instead.

LOCAL_CFLAGS should not contain -I entries, those should use
LOCAL_C_INCLUDES instead.

Change-Id: Ic901aa14651572ac682166becd4f0cd86baecc34
2016-06-01 13:41:23 -07:00
Chih-Hung Hsieh
dccd3a3698 Merge "Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace." am: dab7d9de03
am: fa7569c921

* commit 'fa7569c921b9ca0db894287ea826cbd3b041d880':
  Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.

Change-Id: I63223e36f3627d312051c86d54919b6cef33766c
2016-05-19 00:05:39 +00:00
Chih-Hung Hsieh
67867dbd79 Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.
Bug: 28705665
Change-Id: I469b2a882f6d1f399bfc22c75a26da245991fc33
2016-05-18 15:53:15 -07:00
Chih-hung Hsieh
fb44ca5178 Merge "Fix google-explicit-constructor warnings." am: 7bdd6a8b5a
am: 427d8d840f

* commit '427d8d840f6ec5ce5767b2ee521e4ac5b7ebd619':
  Fix google-explicit-constructor warnings.

Change-Id: I26dc45aca83f991aa7993f6d4233e0439dd44a22
2016-04-30 05:16:35 +00:00
Chih-Hung Hsieh
1c563d96f0 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I4504e98a8db31e0edcbe63c23f9af43eb13e9d86
2016-04-29 15:44:04 -07:00
Chih-hung Hsieh
f648232165 Merge "Fix google-runtime-int warnings." am: 603df0e
am: 6eaa916

* commit '6eaa91685fa69bd7bb4309933899a9e33fa61dfd':
  Fix google-runtime-int warnings.

Change-Id: I2e0fd77a2c841e5279973f08e961bf2ffdd41c09
2016-04-19 16:25:05 +00:00
Chih-Hung Hsieh
ec2ff8c176 Fix google-runtime-int warnings.
Bug: 28220065
Change-Id: I6b8e121ddf98355d1c1ac034c2e3522b2b49e14b
2016-04-18 14:45:46 -07:00
Yabin Cui
3424eaa01d Merge "libbacktrace: only build libbacktrace_offline static library." am: f20e4b1
am: b150324

* commit 'b1503248f4baa28ed739948a51da370bf40037ea':
  libbacktrace: only build libbacktrace_offline static library.

Change-Id: I903f82a38022f7094b70bc8e4d59ac5098456571
2016-04-14 21:38:12 +00:00
Yabin Cui
51e607056d libbacktrace: only build libbacktrace_offline static library.
As device may not have libbacktrace_offline shared library, simpleperf
no longer rely on it. So there is no reason to keep libbacktrace_offline
shared library.

Bug: 28152982
Change-Id: If8e31b1434646dbbfed60264eb25f034bc5d6946
2016-04-14 10:31:08 -07:00
Yabin Cui
566692fa11 Merge "libbacktrace_offline: support unwinding of shared libraries in apk file." am: d8c88fc
am: f63704e

* commit 'f63704ed5a9daa40b9e471c7020ae4e4541dee79':
  libbacktrace_offline: support unwinding of shared libraries in apk file.

Change-Id: If880c04da5ab6b4faa232b80fbfceca37f63d41d
2016-03-29 18:30:19 +00:00
Yabin Cui
b791a76ed7 libbacktrace_offline: support unwinding of shared libraries in apk file.
Bug: 26962895
Change-Id: I009080f26e7323247c3ab24eea614eec4432ca6a
2016-03-26 16:06:23 -07:00
Josh Gao
c7d8777d56 Don\'t demangle symbol names. am: fbbc744 am: 0edda64 am: 9bf0b81 am: 0fb3191
am: 05e1e1f

* commit '05e1e1fb4100bb52fab2af41dc6caaf31c527819':
  Don't demangle symbol names.
2016-03-23 20:58:50 +00:00
Josh Gao
05e1e1fb41 Don\'t demangle symbol names. am: fbbc744 am: 0edda64 am: 9bf0b81
am: 0fb3191

* commit '0fb3191840680f7e084aa9ee53a1906074a16b68':
  Don't demangle symbol names.
2016-03-23 20:52:26 +00:00
Josh Gao
0edda648fb Don\'t demangle symbol names.
am: fbbc744

* commit 'fbbc744130c85538a754d245e958d7d79f24309c':
  Don't demangle symbol names.
2016-03-23 20:40:48 +00:00
Josh Gao
fbbc744130 Don't demangle symbol names.
Bug: http://b/27299236
Change-Id: I26ef47f80d4d6048a316ba51e83365ff65d70439
2016-03-23 11:43:35 -07:00
Stephen Hines
a0062cfc31 Update BacktraceOffline for LLVM rebase to r256229.
Bug: http://b/26987366

(cherry picked from commit 19c30e9516)

Change-Id: I5e4568292c0b4bbd2daefc0abd3d36c691622eb4
2016-03-20 22:58:29 -07:00
Pirama Arumuga Nainar
922e151ba2 Merge "Update BacktraceOffline for LLVM rebase to r256229." 2016-03-18 21:54:51 +00:00
Christopher Ferris
c463ba45c4 Add error reporting mechanism for failing Unwind.
Remove the logging of an error if a thread disappears before the unwind
can begin. This can happen, so allow the caller to determine if this
is really a problem worth logging.

Bug: 27449879

(cherry picked from commit 206a3b9798)

Change-Id: If9e7cfeb6eb7b122679a734c1a9eacee8354ef18
2016-03-10 14:14:43 -08:00
Christopher Ferris
206a3b9798 Add error reporting mechanism for failing Unwind.
Remove the logging of an error if a thread disappears before the unwind
can begin. This can happen, so allow the caller to determine if this
is really a problem worth logging.

Bug: 27449879
Change-Id: Ie81718d53fb0e519fa0a7db9fd5f314b72bfa431
2016-03-10 12:39:15 -08:00
Christopher Ferris
26cf352637 Merge "Don't fail if the new pss is less than stable." 2016-03-08 18:09:18 +00:00
Stephen Hines
19c30e9516 Update BacktraceOffline for LLVM rebase to r256229.
Bug: http://b/26987366
Change-Id: I3c5f3349a669c04bb40dd7175f840b57dc46f7f6
2016-03-08 01:23:43 -08:00
Christopher Ferris
5ccdfa6349 Don't fail if the new pss is less than stable.
Sometimes, the new pss is significantly less than the stable pss. Do
not fail if this case occurs.

Change-Id: Ic7da87275a821818e375d05cac10e84c62710c5e
2016-03-07 19:18:31 -08:00
Andreas Gampe
a7a7369343 Revert "Do not do local unwinds through .oat or .dex maps."
This reverts commit 4265ed7cc8.

Workaround in libunwind instead: change-id I98be5754cc4de4071616db334dc0c9862d3a2504

Bug: 27391690

(cherry picked from commit 04dcb00ab7)

Change-Id: Id77dc081b655dc0fcb513ad0ee95221d91a301f9
2016-03-02 13:20:35 -08:00
Andreas Gampe
04dcb00ab7 Revert "Do not do local unwinds through .oat or .dex maps."
This reverts commit 4265ed7cc8.

Workaround in libunwind instead: change-id I98be5754cc4de4071616db334dc0c9862d3a2504

Bug: 27391690
Change-Id: Id77dc081b655dc0fcb513ad0ee95221d91a301f9
2016-03-02 19:39:21 +00:00
Christopher Ferris
b035a19e4f Do not do local unwinds through .oat or .dex maps.
Bug: 27391690

(cherry picked from commit 4265ed7cc8)

Change-Id: I88a49537544b507a3b0bfa61eafc27400a05281b
2016-03-01 18:19:42 -08:00
Christopher Ferris
4265ed7cc8 Do not do local unwinds through .oat or .dex maps.
Bug: 27391690
Change-Id: I88a49537544b507a3b0bfa61eafc27400a05281b
2016-03-01 18:07:59 -08:00
James Hawkins
588a2cad7f system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
2016-02-18 14:52:46 -08:00
Yabin Cui
9946a8f755 libbacktrace: support building static libraries on target.
Bug: 27125711

Change-Id: I28a49e3e128fa4291815a54cf942452bd1f9f756
2016-02-10 15:20:44 -08:00
Christopher Ferris
d4c884330c Fix use of uninitialized memory.
When creating an UnwindMapLocal fails in the Build() function call,
the destructor for UnwindMap is called. Unfortunately, the map_cursor_
member variable has not been initialized, so the call to destroy it
winds up operating on garbage data.

Part of this is a result of a bad class hierarchy, so this refactors
the classes slightly, and properly initializes the map_cursor_ member
variable in the base class.

Bug: 26931578
Change-Id: I885596bf65e4ef63559cee2c56cd41576d5ecc1b
2016-02-05 15:22:34 -08:00
Than McIntosh
1e0fea291a Fix for host simpleperf 'gettid' unsat.
Bug: 26900419
Change-Id: Ifefd017f4b62ecfb2521bd1c38dbb3b09054f205
2016-02-01 15:59:40 -05:00
Christopher Ferris
8540216028 Put BacktraceOffline code into a separate library.
BacktraceOffline is the only code that uses libLLVM. Create
a new shared library, backtrace_offline.so, that references this
so that including libbacktrace.so doesn't wind up pulling in libLLVM.

Change-Id: I90c502d833f6c464c3810dffde52a0c6da241cce
2016-01-25 16:26:48 -08:00
Christopher Ferris
61c48ac854 Modify tests to use executable memory.
The check_unreadble_elf_* tests only create a readable map. I changed
libunwind to disallow unwinding through non-executable maps, so make
the maps executable too.

Bug: 26589772
Change-Id: Idbe6426ac4d3243779b819c8f1aebdcdacb0669f
2016-01-15 16:08:58 -08:00
Yabin Cui
2ad59db75f libbacktrace: check if elf file paths are valid before reading them.
Bug: 25194400
Change-Id: If6e60585673226392d38fab9ad14bd7b94261316
2015-12-08 19:22:29 -08:00
Yabin Cui
6405bb3aee Fix libbacktrace host build.
On host build, libbacktrace relies on libcutils to provide gettid()
function.

Change-Id: Iad83384ea699ca024b71b73cef26755287c9e6fe
2015-12-07 20:09:24 -08:00
Elliott Hughes
4f71319df0 Track rename of base/ to android-base/.
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-12-04 22:00:26 -08:00
Christopher Ferris
da750a79c9 Change the way some maps are printed.
Before, an anonymous map wound up printing the pc as relative.
Unfortunately, this meant that it was impossible to tell the actual
pc. The new code prints the map name as <anonymous:map_start> and
still prints the pc as relative.

In addition, add the start of the map for map names that begin with a
'[' character.

Bug: 25844836
Change-Id: Ie0b6149dde258fe13f0e5a3e5739d85374512f4b
2015-11-30 14:39:52 -08:00
Yabin Cui
af8ac0c498 libbacktrace: don't let llvm cflags cover libbacktrace's cflags.
Change-Id: Ib2783bf5d145599ffed822eec0a2d9f7df2fddf5
2015-09-24 17:46:27 -07:00
Elliott Hughes
9ea0ff343f Merge "Clean up maps parsing in libbacktrace." 2015-09-23 05:35:05 +00:00
Yabin Cui
9e1dd67de4 libbacktrace: enable -fno-omit-frame-pointer for host build.
This change makes sure -fno-omit-frame-pointer flag is not
overrided by flags set in $(LLVM_HOST_BUILD_MK).

Change-Id: I53037b0eab6bd1272cec0f5c9caa058ad1a55419
2015-09-22 22:07:21 -07:00
Elliott Hughes
fe3593dc2a Clean up maps parsing in libbacktrace.
(This might want to be unified with the very similar code in bionic, but
that's a job for another day.)

Change-Id: I5dade498f781305fa9909ee01f1f4bebc537c169
2015-09-22 17:26:24 -07: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
Yabin Cui
ab5e583327 Revert "Add BacktraceOffline for offline backtracing."
Using llvm makes libbacktrace stops building for 32 bit on linux host x86_64.

This reverts commit c9c6b6ee77.

Change-Id: Ieb807db881d7bb3132cd09e25fd08c28766ca0a8
2015-09-17 22:54:22 +00:00
Yabin Cui
c9c6b6ee77 Add BacktraceOffline for offline backtracing.
It is used by simpeleprf for stack unwinding.

Bug: 22229391
Change-Id: I26d698610ccdc9545da837bc5a8a9ec787f27a6b
2015-09-16 17:38:23 -07:00
Christopher Ferris
d9a06afb19 Add a logging handler on timeout.
If the signal handler doesn't fire in the given time when trying to unwind
a thread, put on a logging handler. This prevents crashes if the signal
does eventually fire.

Bug: 23783762

(cherry picked from commit d7226f9a14)

Change-Id: Ib990a06733cc93717752ab4998f4ae26afd7e249
2015-09-03 19:06:06 -07:00
Christopher Ferris
d7226f9a14 Add a logging handler on timeout.
If the signal handler doesn't fire in the given time when trying to unwind
a thread, put on a logging handler. This prevents crashes if the signal
does eventually fire.

Bug: 23783762
Change-Id: Ib7abb36b71d079a7043117697c41b535319586fd
2015-09-03 12:27:57 -07:00
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