History log of /system/core/libbacktrace/backtrace_test.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
96722b0fa48524e03659c0a3d579f8ef4f1641ba 19-Jul-2017 Christopher Ferris <cferris@google.com> Cleanup the libbacktrace interface a bit.

- Change the field name load_base to load_bias (which is what it really is).
- Add a rel_pc field so that callers do not need to compute it themselves.
- Remove the BacktraceMap::GetRelativePc() since nobody should need to
compute this themselves.

Bug: 23762183

Test: Compiles and unit tests pass (debuggerd, libbacktrace).
Change-Id: I2cb579767120adf08c407a58f3c487ee3f2b45fc
/system/core/libbacktrace/backtrace_test.cpp
5ea2c1f20a091a44fb2c6cee2ec438f6e2fe2183 23-Mar-2017 Christopher Ferris <cferris@google.com> Test unwinding through a signal handler.

Also make backtrace_testlib.c C++.

Bug: 34468756
Test: Ran new unit test on host x86, host x86_64, angler (32 bit, 64 bit),
Test: fugu.
Change-Id: Ia810f596c2df56cd56e8ab17e6c19be0c48d737f
/system/core/libbacktrace/backtrace_test.cpp
f5e568e653d0dd6bccc86d1a60db5a2573f75f0e 22-Mar-2017 Christopher Ferris <cferris@google.com> Do not access device maps.

It's possible that a device map has memory controlled by a single entry
device driver. Thus, you can deadlock if a process is touching that
device memory and we try to unwind it and also touch that device memory.
Simply skip any attempts to step through, or get function names from
device memory maps.

Bug: 36130325

Test: Ran new unit tests, ran bionic unit tests, ran art ThreadStress.
Change-Id: Ibc62d7ec8106c619ee08968f05e04aea55d7cbfa
/system/core/libbacktrace/backtrace_test.cpp
82f3bbdc25253ee299207acd22b074bbe39bf2c6 14-Mar-2017 Christopher Ferris <cferris@google.com> Allow calling GetFunctionName before unwinding.

Some extra initialization needs to occur before calling the local/remote
GetFunctioneName.

Also, cleanup the test code a bit:

- Make all local functions static.
- Create a common function to create and finish remote processes.
- Remove unused function.
- Fix the formatting a bit by making it match clang format.

Test: Ran the unit tests.
Change-Id: I998bed1378d582df59fdf9263df6f208db5d795a
/system/core/libbacktrace/backtrace_test.cpp
3a14004c7f521cf2ca6dfea182fa7441e77c97e7 16-Jun-2016 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
67867dbd79a0cbc9b603b23ac460f9f58ea14d1e 19-May-2016 Chih-Hung Hsieh <chh@google.com> Fix misc-macro-parentheses warnings in adb, debuggerd, libbacktrace.

Bug: 28705665
Change-Id: I469b2a882f6d1f399bfc22c75a26da245991fc33
/system/core/libbacktrace/backtrace_test.cpp
206a3b9798e3622c906a3cafdb113c271c1c927c 09-Mar-2016 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
5ccdfa63499ed8342bde875ead003ff90f336f19 08-Mar-2016 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
588a2cad7faee54bfb16050d0c7398709f304fea 18-Feb-2016 James Hawkins <jhawkins@google.com> system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
/system/core/libbacktrace/backtrace_test.cpp
61c48ac854fc43b0f9eda84119446335b1d92a48 16-Jan-2016 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/libbacktrace/backtrace_test.cpp
da750a79c9fe503d52feb7af2c417b19f763649c 30-Nov-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
2d651eda49057ad837d4b8a96f3f0cf4e74d6d20 20-Aug-2015 Christopher Ferris <cferris@google.com> am e0ab2322: Display the map offset for each frame.

* commit 'e0ab23223a1c3110c9550136b8a119b4c30ec066':
Display the map offset for each frame.
e0ab23223a1c3110c9550136b8a119b4c30ec066 20-Aug-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
837eff22c86bcdddd50c68315ef17792a0d1949a 09-Jul-2015 Pirama Arumuga Nainar <pirama@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
684fb77c82affca723910e26e8c219c804e00354 09-May-2015 Christopher Ferris <cferris@google.com> Add tests for elf unwinding in memory.

Bug: 19517541
(cherry picked from commit 67aba6881d8857d3017e11695207eb2ade45a274)

Change-Id: I914636ccd814e041475b6b2d81119cac1745a9ff
/system/core/libbacktrace/backtrace_test.cpp
428fad97a0c9c3def1489b16f0257a9cbcfd43f8 30-Apr-2015 Dan Albert <danalbert@google.com> 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 23f750b068ddf5b20fb5d153a798b22562368992)

Change-Id: I2f888e8ed7a2f5719973786cbcbb399a81867ee9
/system/core/libbacktrace/backtrace_test.cpp
67aba6881d8857d3017e11695207eb2ade45a274 09-May-2015 Christopher Ferris <cferris@google.com> Add tests for elf unwinding in memory.

Bug: 19517541
Change-Id: Ib42360a82934ff7103e2ccb64c1105c59aa3fdea
/system/core/libbacktrace/backtrace_test.cpp
8bd4a4ecdc48ead03ca4e90ad585324bcd63b9f0 07-May-2015 Christopher Ferris <cferris@google.com> 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 944f417ccb86441060ffb670b4bdc2975fda08fc)
/system/core/libbacktrace/backtrace_test.cpp
944f417ccb86441060ffb670b4bdc2975fda08fc 07-May-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
2106f4ba95004fdfc76ad3fa308a07fdbf475984 02-May-2015 Christopher Ferris <cferris@google.com> 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 329ed7dae49eba09bdf865dd999d1a7e73bb9687)

Change-Id: Ibc37d8c8bb032820dca4e7531184349ba6d402d2
/system/core/libbacktrace/backtrace_test.cpp
329ed7dae49eba09bdf865dd999d1a7e73bb9687 02-May-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
23f750b068ddf5b20fb5d153a798b22562368992 30-Apr-2015 Dan Albert <danalbert@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
97e00bb25a016edfd0c7efce90c81d63a357b2e3 02-Apr-2015 Christopher Ferris <cferris@google.com> Update the test for better output on error.

Change-Id: Id3b0b96a33441ce5d908aac38e639ac3598a7a89
/system/core/libbacktrace/backtrace_test.cpp
ca09ce902c17c2bffc02bfafaf0844204ac13333 01-Apr-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
2c43cff01d1271be451671567955158629b23670 27-Mar-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
2b4a63fc6a4bfc6db69901258539276b888c7ec4 17-Mar-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
12385e3ad085aa1ac06c26529b32b688503a9fcf 06-Feb-2015 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
3cdbfdce6a38cd23968d27d6e9e8d3ee65c3cf98 09-Nov-2014 Christopher Ferris <cferris@google.com> 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 db44538387b08f367fc2419653639866f4c2fbd6)

Change-Id: Id326a7a7b92cb61573def3f761597c40f3ef2f4b
/system/core/libbacktrace/backtrace_test.cpp
a2efd3ac7abe223aa7a8ba8b5ba448216c4953b4 07-May-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
aa63d9f980f95718fc28ca7e222c1e8d7ca9e778 29-Apr-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
e29609106033a48a6128664668d22bf4fb42a7ee 08-Mar-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
df2906186b6952c57b1f662bfef0b65c9f8c2e0d 23-Jan-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
46756821c4fe238f12a6e5ea18c356398f8d8795 15-Jan-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
20303f856f1f1cdb5af58af0b116b8c598f0ea5c 11-Jan-2014 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp
bc12d6329ef72147da93881a34aab763905b1039 12-Nov-2013 Christopher Ferris <cferris@google.com> 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 242b1a8c7a5ec73172bac811e51acbc27201f22c)

Conflicts:
libbacktrace/Backtrace.cpp
/system/core/libbacktrace/backtrace_test.cpp
7f081ec079923a089c9928bc982154b873addf68 05-Nov-2013 Christopher Ferris <cferris@google.com> Use new defines in test code.

In addition, fix up the warnings and remove the -fpermissive when
compiling.

Change-Id: Ia27b902499b34ff3d881acb9057120af390baf2c
/system/core/libbacktrace/backtrace_test.cpp
17e91d44edf5e6476a477a200bcd89d4327358a3 21-Oct-2013 Christopher Ferris <cferris@google.com> 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
/system/core/libbacktrace/backtrace_test.cpp