Commit graph

9 commits

Author SHA1 Message Date
Christopher Ferris
7937a36c8e Change all uintptr_t to uint64_t in API.
In order to support the offline unwinding properly, get rid of the
usage of non-fixed type uintptr_t from all API calls.

In addition, completely remove the old local and remote unwinding code
that used libunwind.

The next step will be to move the offline unwinding to the new unwinder.

Bug: 65682279

Test: Ran unit tests for libbacktrace/debuggerd.
Test: Ran debuggerd -b on a few arm and arm64 processes.
Test: Ran crasher and crasher64 and verified tombstones look correct.
Change-Id: Ib0c6cee3ad6785a102b74908a3d8e5e93e5c6b33
2018-01-18 17:26:20 -08:00
Christopher Ferris
82f3bbdc25 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
2017-03-21 14:21:49 -07:00
Chih-Hung Hsieh
034c475931 Fix google-explicit-constructor warnings in system/core.
* Declare explicit conversion constructors.
* Add NOLINT for implicit conversion constructors.
* Fix also some misaligned indendations.

Bug: 28341362
Change-Id: Idf911f35923b408d92285cc1a053f382ba08c63e
Test: build with clang-tidy
2016-07-26 11:26:01 -07: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
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
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
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
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
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