Commit graph

19 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
e6feaeeda1 Revert "Revert enabling libunwind."
This reverts commit db2309e3d1.

Change-Id: I1626442f029473066ce20921667a406f1a1ea865
2013-11-08 02:59:52 +00: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
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
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
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
9e1ee2b3c6 Only build host library on linux-x86.
Change-Id: I26d5bd4b34c3669897fea1488fa58972f4299757
2013-10-02 14:19:19 -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