History log of /system/core/libunwindstack/include/unwindstack/ElfInterface.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
beae42bc7f8fb6494138ff8a6d17ed6a65b2cf9a 16-Feb-2018 Christopher Ferris <cferris@google.com> Fix soname reading code.

The dynamic section contained an address, not an offset into the elf
file to indicate where the soname exists. Changed to use the strtab
entries in the section headers to map this address to the actual offset.

Refactor the soname test a bit to make it easier to verify the code.

Bug: 73499044

Test: Passes new unit tests.
Test: Ran unwind_info on the failing shared elf and verified the soinfo
Test: is correct.
Change-Id: I16ba148389bcb9aadd3566fb442dac27f89fe894
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
2fcf4cf13e9aefa8c312084af12ca2d712a6ead3 24-Jan-2018 Christopher Ferris <cferris@google.com> Add error propagation into Unwinder/Elf objects.

The backtrace offline code uses these error codes to diagnose errors.
In addtion, I've had cases where seeing these errors would help diagnose
failures.

This also allows us to add a few features to indicate why an unwind
terminated (such as max frames exceeded).

Bug: 65682279

Test: Updated unit tests pass.
Change-Id: If82b5092698e8a194016d670efff1320f9b44d50
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
150db124f3f3c0f8e1c341fd33c6c64310e0ac39 21-Dec-2017 Christopher Ferris <cferris@google.com> Add ability to read jit gdb data.

Changes:
- New JitDebug class to handle all of the jit gdb interface.
- Add unit tests for all, along with new offline test using debug data.
- Add new Memory type called MemoryOfflineParts that has multiple
MemoryOffline objects to support the offline test.
- Update the tools to use the JitDebug object.
- Modify libbacktrace to use the JitDebug, but only looking in libart.so
and libartd.so.
- Change the Format32Bits to Is32Bit since it's more accurate and I use
it in a different context where original name didn't make sense.
- Add a new function to find global variables in an elf file
(GetGlobalVariable).
- Add a new function to determine if a pc is valid for this elf (IsValidPc).

Bug: 68396769

Test: Ran new unit tests. Added new offline test that uses jit debug data.
Test: Ran art test that generates jit data and verified a crash unwinds
Test: through the jit data.
Change-Id: I6e7ee2f5bab2242028a06feece156dff21c0a974
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
e7b6624c3fd6bb780f6330448fad175e80469384 15-Dec-2017 Christopher Ferris <cferris@google.com> Fix issues in libunwindstack.

- Add a load_bias field in MapInfo so that it can be loaded offline,
and also so it can be cached.
- Add an Add function to the Maps class so that it's possible to manually
create a map.
- Remove the OfflineMaps class since I haven't found a reason for this to
exist.
- Add a pointer to the gnu debugdata compressed section in the interface
itself and modify the step path to try eh_frame, then debug_frame, then
gnu_debugdata. This way arm can add exidx as the last step behind
gnu_debugdata. Add an offline test to verify the order of unwind.
- Fix x86_64_ucontext_t since it was a different size on 32 bit and 64 bit
systems.

Test: Pass new unit tests.
Change-Id: I978b70d6c244bd307c62a29886d24c1a8cb2af23
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
b7de5f542925216dbb8b7124260d2915570598d1 02-Dec-2017 Christopher Ferris <cferris@google.com> Demand read load bias for a map.

Add a static GetLoadBias method to the Elf object that only reads just
enough to get the load bias.

Add a method to MapInfo that gets the load bias. First attempt to get
it if the elf object already exists. If no elf object was created, use
the new static method to get the load bias.

In BacktraceMap, add a custom iterator so that when code dereferences
a map element, that's when the load bias will be retrieved if it hasn't
already been set.

Bug: 69871050

Test: New unit tests, verify tombstones have non-zero load bias values for
Test: libraries with a non-zero load bias.
Change-Id: I125f4abc827589957fce2f0df24b0f25d037d732
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
c9dee84d81e4672dee5dd08890c904d1ab841e56 03-Nov-2017 Christopher Ferris <cferris@google.com> Add support for only a .eh_frame.

Static executables only have a .eh_frame section and no .eh_frame_hdr
section. Add support for this by rearranging the class hierarchy and
creating a DwarfEhFrameWithHdr class and a DwarfEhFrame class to handle
the different cases.

Add new unit tests for DwarfEhFrame and for the new functionality.

Bug: 68820189

Test: Passes new unit tests, unwinds static executables.
Change-Id: I63d7cb8c52a686e96579a2266e18c0d06bbb6e63
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
e69f470933f24977825bb34ee39d32650b75107f 20-Oct-2017 Christopher Ferris <cferris@google.com> Multiple bugfixes, small restructuring.

- Move the load bias stored out of ElfInterface into Elf. For the compressed
sections, the load bias was not the same as the data from the uncompressed
section.
- Move the initialization of the compressed section into Init. It was too easy
to forget to call the init of the compressed section.
- Do not automatically add in load bias to the pc before calling ElfInterface
code. Do all of the pc manipulations in the Elf object.
- Change the interface GetFunctionName code to pass in the load_bias instead
of modifying the pc inside the code.
- Modify the Step function to pass in the elf offset, not add it to the pc.
It is necessary to have two different relative values when executing the
Step: a pc that is relative to the beginning of the elf for the reading data
the actual instructions when trying to determine if this is in a signal
frame, and a pc that is relative to the map for finding the appropriate
unwind information.
- Add a feature to Unwinder so that an unwind can be stopped if it ends up
in map that has a specified suffix. This is so that the ART unwinding
code doesn't require skipping the compressed section. Instead, stop at
if trying to unwind through a known suffix code that means the code is
in java code. This is important because the compressed section data is
not only used by the jave compiled code, so that will continue to work.
- Fix tests for restructuring, add new tests for new functionality.

Test: Ran art test 137-cfi using new unwinder as default.
Test: Ran new unit tests.
Change-Id: I42e658c64c5e14f698ba34944a3043afac967884
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
b9de87f7edefd7a2473134b267716c5fd750e89f 20-Sep-2017 Christopher Ferris <cferris@google.com> Add a new unwind method on error.

If a function crashes by jumping into unexecutable code, the old method
could not unwind through that. Add a fallback method to set the pc from
the default return address location.

In addition, add a new finished check for steps. This will provide a method
to indicate that this step is the last step. This prevents cases where
the fallback method might be triggered incorrectly.

Update the libbacktrace code to unwind using the new methodology.

Update the unwind tool to use the new unwind methodology.

Add a new option to crasher that calls through a null function.

Create a new object, Unwinder, that encapsulates the a basic unwind. For now,
libbacktrace will still use the custom code.

Added new unit tests to cover the new cases. Also add a test that
crashes calling a nullptr as a function, and then has call frames in
the signal stack.

Bug: 65842173

Test: Pass all unit tests, verify crasher dumps properly.
Change-Id: Ia18430ab107e9f7bdf0e14a9b74710b1280bd7f4
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
3f805ac3f8e61489f66a54bbdb1a8dd541c043d1 30-Aug-2017 Christopher Ferris <cferris@google.com> Add proper support for embedded elf files.

- Add a method to get the max size of an elf file by reading the
section header offset + size. This will properly map an elf
file embedded into an apk, instead of just mapping in what is done
by the dynamic linker. It does assume that the section headers are
at the end of the elf file.
- Add new tests for the above functionality.
- Update the unwind_symbols tool to take an address for finding a
function instead of dumping the entire symbol table.

Bug: 23762183

Test: Unit tests pass, unwind through the camera process and verify
Test: the GoogleCamera.apk shows some function names.
Change-Id: I00c021680fe1d43b60d652bf91bbf6667d9617be
/system/core/libunwindstack/include/unwindstack/ElfInterface.h
d226a5140989f509a0ed3e2723f05d5fc93ce8df 14-Jul-2017 Christopher Ferris <cferris@google.com> Make the library usable as a library.

- Add namespace unwindstack everywhere so that it's easier for other
code to use the library.
- Move some of the header files into include/unwindstack so that they
can be exposed.
- Modify the headers so that only a limited number need to be exposed.
- Update the tools to use the new headers.
- Add a GetLoadBias() call on the Elf object. This prevents the need
to get the interface object out of the Elf object.
- Move the GetRelPc() call out of the Reg class, to the Elf class. It's
not always the case that a Reg object will be around when you want to
get a relative pc. The tests for this moved to ElfTest.cpp.

Bug: 23762183

Test: Unit tests pass.
Change-Id: Iac609dac1dd90ed83d1a1e24ff2579c96c023bc3
/system/core/libunwindstack/include/unwindstack/ElfInterface.h