summaryrefslogtreecommitdiff
path: root/libbacktrace
AgeCommit message (Collapse)Author
2016-08-25Fix race condition updating local map data.nougat-mr2.3-releasenougat-mr2.2-releasenougat-mr2.1-releasenougat-mr2-security-releasenougat-mr2-releasenougat-mr2-pixel-releasenougat-mr2-devnougat-mr1.8-releasenougat-mr1.7-releasenougat-mr1.6-releasenougat-mr1.5-releasenougat-mr1.4-releasenougat-mr1.3-releasenougat-mr1.2-releasenougat-mr1.1-releasenougat-mr1-volantis-releasenougat-mr1-security-releasenougat-mr1-releasenougat-mr1-flounder-releasenougat-mr1-devnougat-mr1-cts-releasenougat-mr1-cts-devChristopher Ferris
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 Bug: 31067025 (cherry picked from commit 3a14004c7f521cf2ca6dfea182fa7441e77c97e7) Change-Id: Id00116f156a24b36085c0d5dfc3dde4d2ac55194
2016-04-14libbacktrace: only build libbacktrace_offline static library.nougat-releasenougat-mr0.5-releasenougat-dr1-releasenougat-devnougat-cts-releasenougat-cts-devYabin Cui
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 (cherry picked from commit 51e607056dd0db93ef683d05349dd98648c47e47)
2016-03-29libbacktrace_offline: support unwinding of shared libraries in apk file.Yabin Cui
Bug: 26962895 Change-Id: I009080f26e7323247c3ab24eea614eec4432ca6a (cherry picked from commit b791a76ed76442a74c466c6116787c73ceea2170)
2016-03-23Don\'t demangle symbol names. am: 4cb2ba2 am: 8b29746 am: 9bf0b81Josh Gao
am: 0fb3191 * commit '0fb3191840680f7e084aa9ee53a1906074a16b68': Don't demangle symbol names.
2016-03-23Don\'t demangle symbol names.Josh Gao
am: 4cb2ba2 * commit '4cb2ba20883580153c4abd3760a510be63a12e2f': Don't demangle symbol names.
2016-03-23Don't demangle symbol names.Josh Gao
Bug: http://b/27299236 Change-Id: I26ef47f80d4d6048a316ba51e83365ff65d70439
2016-03-20Update BacktraceOffline for LLVM rebase to r256229.Stephen Hines
Bug: http://b/26987366 (cherry picked from commit 19c30e95167e4879c79007d42ea9c32c4eaa8979) Change-Id: I5e4568292c0b4bbd2daefc0abd3d36c691622eb4
2016-03-10Add error reporting mechanism for failing Unwind.Christopher Ferris
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 206a3b9798e3622c906a3cafdb113c271c1c927c) Change-Id: If9e7cfeb6eb7b122679a734c1a9eacee8354ef18
2016-03-02Revert "Do not do local unwinds through .oat or .dex maps."Andreas Gampe
This reverts commit 4265ed7cc897c54c55bb18bb341859b5df0f4966. Workaround in libunwind instead: change-id I98be5754cc4de4071616db334dc0c9862d3a2504 Bug: 27391690 (cherry picked from commit 04dcb00ab7ee73c1b6e75fe6d4e02d1f854cd4cd) Change-Id: Id77dc081b655dc0fcb513ad0ee95221d91a301f9
2016-03-01Do not do local unwinds through .oat or .dex maps.Christopher Ferris
Bug: 27391690 (cherry picked from commit 4265ed7cc897c54c55bb18bb341859b5df0f4966) Change-Id: I88a49537544b507a3b0bfa61eafc27400a05281b
2016-02-05Fix use of uninitialized memory.Christopher Ferris
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-01Fix for host simpleperf 'gettid' unsat.Than McIntosh
Bug: 26900419 Change-Id: Ifefd017f4b62ecfb2521bd1c38dbb3b09054f205
2016-01-25Put BacktraceOffline code into a separate library.Christopher Ferris
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-15Modify tests to use executable memory.Christopher Ferris
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
2015-12-08libbacktrace: check if elf file paths are valid before reading them.brillo-m9-releasebrillo-m9-devbrillo-m8-releasebrillo-m8-devYabin Cui
Bug: 25194400 Change-Id: If6e60585673226392d38fab9ad14bd7b94261316
2015-12-07Fix libbacktrace host build.Yabin Cui
On host build, libbacktrace relies on libcutils to provide gettid() function. Change-Id: Iad83384ea699ca024b71b73cef26755287c9e6fe
2015-12-04Track rename of base/ to android-base/.Elliott Hughes
Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
2015-11-30Change the way some maps are printed.Christopher Ferris
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-09-24libbacktrace: don't let llvm cflags cover libbacktrace's cflags.Yabin Cui
Change-Id: Ib2783bf5d145599ffed822eec0a2d9f7df2fddf5
2015-09-23Merge "Clean up maps parsing in libbacktrace."Elliott Hughes
2015-09-22libbacktrace: enable -fno-omit-frame-pointer for host build.Yabin Cui
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-22Clean up maps parsing in libbacktrace.Elliott Hughes
(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-22Revert "Revert "Revert "Revert "Add BacktraceOffline for offline ↵Yabin Cui
backtracing."""" This reverts commit 82806f875c87273bc115a764af37f77926975f6d. Change-Id: Ie06465c89a5fc115517130f9f2904cc855973155
2015-09-22Revert "Revert "Revert "Add BacktraceOffline for offline backtracing."""Yabin Cui
This reverts commit fd992c3b949924c0804e359c0e3d482436c099b1. Change-Id: Ic1824afac6c32f1087b66de9d6368a561f235d13
2015-09-21Revert "Revert "Add BacktraceOffline for offline backtracing.""Yabin Cui
This reverts commit 5c0b797cfc7e1297895e66db8d3de4a924e9f463. 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-17Revert "Add BacktraceOffline for offline backtracing."Yabin Cui
Using llvm makes libbacktrace stops building for 32 bit on linux host x86_64. This reverts commit 08853d2a5dbfd04f23b3a537cb91e8b4242b4737. Change-Id: Ieb807db881d7bb3132cd09e25fd08c28766ca0a8
2015-09-16Add BacktraceOffline for offline backtracing.Yabin Cui
It is used by simpeleprf for stack unwinding. Bug: 22229391 Change-Id: I26d698610ccdc9545da837bc5a8a9ec787f27a6b
2015-09-03Add a logging handler on timeout.marshmallow-mr1-devmarshmallow-dr1.5-releasemarshmallow-dr1.5-devmarshmallow-dr-releasemarshmallow-dr-devChristopher Ferris
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 d7226f9a1485ba19f714369fd7f8b444d66feb61) Change-Id: Ib990a06733cc93717752ab4998f4ae26afd7e249
2015-09-03Add a logging handler on timeout.Christopher Ferris
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-08-20am 802ae55f: Display the map offset for each frame.Christopher Ferris
* commit '802ae55fd1454226b1d76e4a311b2b937d1e0dd9': Display the map offset for each frame.
2015-08-20Display the map offset for each frame.Christopher Ferris
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 802ae55fd1454226b1d76e4a311b2b937d1e0dd9) Change-Id: I950f92c1cb29ee05eed777f47453efa03318cf3e
2015-08-20Display the map offset for each frame.marshmallow-devChristopher Ferris
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-07-09Use delete[] to de-allocate pointers from new[]Pirama Arumuga Nainar
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-02Add static versions for libbacktrace and libnativebridge. Bug fixes.Calin Juravle
Change-Id: Ic68ac15b2676e4f475330c8e7bb34e0d48783686
2015-06-12Remove PtraceRead error message.Christopher Ferris
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 35c8136d96a6007ac83f828ac02cc6b75d3f5cc0) Change-Id: Ie6e20fbc18702fde935f2cf8cbf1b297fda43282
2015-06-12Remove PtraceRead error message.Christopher Ferris
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-01Modify the code to avoid potential deadlocks.Christopher Ferris
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 2d09171758b7d98c77f27e439a4caf35dd84c311) Change-Id: I414c500eb08983a5017caf3fce4f499465575a9d
2015-06-01Modify the code to avoid potential deadlocks.Christopher Ferris
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-05-15Prevent crashes if a map cannot be created.Christopher Ferris
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 30c942cf1024bf791c28ab9b67a1f752de72248c)
2015-05-14Prevent crashes if a map cannot be created.Christopher Ferris
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-13Add tests for elf unwinding in memory.Christopher Ferris
Bug: 19517541 (cherry picked from commit 67aba6881d8857d3017e11695207eb2ade45a274) Change-Id: I914636ccd814e041475b6b2d81119cac1745a9ff
2015-05-13Remove libbacktrace definition of gettid.Dan Albert
Also simplifies the Darwin implementation of gettid, because apparently libbacktrace had a better way of doing it. Bug: 19517541 (cherry picked from commit 23f750b068ddf5b20fb5d153a798b22562368992) Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
2015-05-12Add tests for elf unwinding in memory.Christopher Ferris
Bug: 19517541 Change-Id: Ib42360a82934ff7103e2ccb64c1105c59aa3fdea
2015-05-06Fix small ptrace reads.Christopher Ferris
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 944f417ccb86441060ffb670b4bdc2975fda08fc)
2015-05-06Fix small ptrace reads.Christopher Ferris
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-06Add offset to map data.Christopher Ferris
Also, print the offset in the maps section. Bug: 20864928 Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61 (cherry picked from commit 5c8856854de4ae7836fc1073d534f4b7b7a03eb9)
2015-05-06Add offset to map data.Christopher Ferris
Also, print the offset in the maps section. Bug: 20864928 Change-Id: I71f005726e5ef73cf75bbcb8f829fd5127cb9d61
2015-05-01Add load base to map for relocation packing.Christopher Ferris
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 82188a0bcce9d31d91f018790c4851b6fdd4768a) Change-Id: Ibc37d8c8bb032820dca4e7531184349ba6d402d2
2015-05-01Add load base to map for relocation packing.Christopher Ferris
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-04-30Fix unused argument error on darwinColin Cross
Change-Id: Ie90f7f32b5bd1496bd663c969d729ea3f96d2588