History log of /system/core/libunwindstack/tests/RegsTest.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fe3963143f16833b14b505cf41a2e19a9e304efb 20-Apr-2018 Josh Gao <jmgao@google.com> libunwindstack: add Regs::Clone.

Add a way to copy a Regs object.

Bug: http://b/77296294
Test: libunwindstack_test
Change-Id: I28aff510aa3e1b677d5ae46dc3bfe7652817ce52
(cherry picked from commit 2f37a15472945194fed528cb8d3104aa4865fc4c)
/system/core/libunwindstack/tests/RegsTest.cpp
fd6b7284ee4154bdab11da7d332920dc8b6aa342 29-Mar-2018 Christopher Ferris <cferris@google.com> Fix null pointer dereference in RegsArm.

Fix RegsArm::GetPcAdjustment to check for an invalid elf before trying
to read memory.
Modify the tests for this so it crashes without this change.

Also modify the GetPcAdjustment for all different architectures so
that unless the relative pc is too small, it will return the minimum
amount that should be adjusted. This is to handle cases where we still
want to adjust the pc but it's in an invalid elf. Mostly this is for
handling cases when the pc is in jit gdb debug code so that we use the
right unwind information.

Bug: 77233204

Test: Passes unit tests for libbacktrace/libunwindstack.
Change-Id: Id73609adaf3b80a583584441de228156fec3afa7
(cherry picked from commit 6dbc28ece3ab7cadd0087b4dc31ba9a2986545f0)
/system/core/libunwindstack/tests/RegsTest.cpp
414df3e583c21023a22a11b64e703cd4ab38b29a 15-Mar-2018 Yabin Cui <yabinc@google.com> Always set the sp reg to the cfa for DWARF.

There are a few places where it is assumed that this register is
set to the cfa value when interpreting DWARF information.

Add a testcase for unwinding art_quick_osr_stub on ARM.

Bug: 73954823

Test: Ran libunwindstack/libbacktrace unit tests.
Test: Random debuggerd -b of process on a hikey.
Test: Ran the 137 art test on host.
Change-Id: Ida6ccdc38c3cfeea6b57fe861a0cc127b150b790
(cherry picked from commit 11e96fe48a74e6ab97d4de899684d3a61a9d1129)
/system/core/libunwindstack/tests/RegsTest.cpp
a2ec50bf57c9dba78459ef011cd13f8525ea57b4 22-Feb-2018 Christopher Ferris <cferris@google.com> Change the GetAdjustedRelPc to GetPcAdjustment.

This cleans up a bit of the Unwinder code to make it clear what's
going on.

Modify the offline unit tests to verify the pc and sp to make sure
that those values get computed correctly.

Test: Passes unit tests.
Test: Passes 137-cfi art tests.
Change-Id: I0787a1d77b8726d3defd08f31c7476f6798f8d0d
/system/core/libunwindstack/tests/RegsTest.cpp
0b79ae155f0a5740a04723071e9f05f2527cbb86 25-Jan-2018 Christopher Ferris <cferris@google.com> Add a global elf cache.

Bug: 65682279

Test: Ran new unit tests.
Change-Id: I19c64614b2b11a27f58204d4cc34913c02e04c36
/system/core/libunwindstack/tests/RegsTest.cpp
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/tests/RegsTest.cpp
61b1a1ae7797e0d3177400cdb3cda028ea14669d 08-Nov-2017 Douglas Leung <douglas.leung@mips.com> Add libunwindstack support for Mips and Mips64

This patch requires v3.18 kernel or above, because v3.10 kernel
has a bug (as of 8/1/2017) in the ptrace(GETREGSET) function for mips
and mips64.

Change-Id: I004c1fa190193eebe1c84440b366289122a6bd8a
Signed-off-by: Douglas Leung <douglas.leung@mips.com>
Signed-off-by: Dejan Jovicevic <dejan.jovicevic@mips.com>
/system/core/libunwindstack/tests/RegsTest.cpp
d06001d6e07b14b865f3294fff82d2571ed7cb2c 01-Dec-2017 Christopher Ferris <cferris@google.com> Split arch data into separate files.

Add an ArchEnum to express the arch of the Elf objects and Reg objects.

Split out the regs code into per arch pieces and generic parts.
Also, split out the header files for each arch.

Do not break out the test code yet, there isn't enough and it doesn't
help to maintain the tests.

Test: libunwindstack/libbacktrace/debuggerd unit tests pass.
Test: Running debuggerd -b <PIDS> yields valid data on bullhead.
Change-Id: If61f6c730c9ff2249f986b41de8c4d62f7158325
/system/core/libunwindstack/tests/RegsTest.cpp
be788d891da26943b1ad6abe0f07a8745fa676d5 27-Nov-2017 Christopher Ferris <cferris@google.com> Allow multiple threads sharing a map to unwind.

Add a mutex in MapInfo, and a mutex in Elf. Lock the creation of an Elf
file using the MapInfo mutex, and lock when calling Step, GetFunctionName,
or GetSoname since they can modify information in the object. It might
be beneficial to use a fine grained lock in the future.

Change the Maps object to contain a vector of MapInfo pointers rather
than the total objects. This avoids copying this data around.

Add a test to libbacktrace to verify that sharing a map while doing
unwinds in different threads works.

Add concurrency tests in libunwindstack to verify the locking works.

Add always inline to the RegsGetLocal arm and aarch64 functions. I had
a case where clang did not inline the code, so make sure this is specified.

Bug: 68813077

Test: New unit tests to cover the case. Passes all unit tests.
Test: Ran a monkey test while dumping bugreports and verified that
Test: no crashes in libunwind.
Test: Remove the locking and verified that all of the concurrenty tests fail.
Change-Id: I769e728c676f6bdae9e64ce4cdc03b6749beae03
/system/core/libunwindstack/tests/RegsTest.cpp
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/tests/RegsTest.cpp
f6f691b63c1b2166ed005a462a6fba5001786eda 26-Sep-2017 Christopher Ferris <cferris@google.com> Update the Unwinder object and add tests.

Changes:
- Remove unused GetReturnAddressFromDefault function and tests.
- Modify the unwinder to stop when a pc/sp in a device map.
- Modify the unwinder to skip initial frames based on map names.
- Unit tests that exercise all of the paths in the unwinder code.
- Move the test Elf/ElfInterface objects into their own file.
- Update RegsFake to handle extra cases.
- Modify libbacktrace code to use this unwinder.

The new unwinder does not implement the ignore frame functionality since
this is not used very often and is better implemented using a skip frames
in named libraries functionality.

Test: Ran new unit tests, ran backtrace tests.
Change-Id: Ifd65e9acd66ac5e2d0e04bd32a9ad870b54610ff
/system/core/libunwindstack/tests/RegsTest.cpp
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/tests/RegsTest.cpp
0953ecd03a90350117d6881c55959c6644972b79 25-Aug-2017 Josh Gao <jmgao@google.com> libunwindstack: make machine type a property of Regs.

There are no actual users of the machine type output parameter to
Regs::RemoteGet. The concrete implementations of Regs know what machine
type they represent anyway, so provide an accessor to query.

Test: treehugger
Test: libunwindstack tests on 32/64-bit host, hikey960
Change-Id: Ia25910531d36c41b2b6919f154cfa914aae63117
/system/core/libunwindstack/tests/RegsTest.cpp
eb4a6dbf5c6697c953942d079744c05da0c09d51 19-Jul-2017 Christopher Ferris <cferris@google.com> Speed up StepIfSignalHandler path.

The StepIfSignalHandler code reads from the process memory object, which
is currently the slowest way to read memory. Change the code to read from
the elf memory object which will almost always be a memory mapped file and
should be really fast.

Also, move the tests for StepIfSignalHandler to its own file.

Bug: 23762183

Test: Unit tests pass.
Change-Id: I1100b50554e5ef736a87babd484f3f34e9071caa
/system/core/libunwindstack/tests/RegsTest.cpp
a019665b3cb73609c888af7f17c64bf80ec40283 19-Jul-2017 Christopher Ferris <cferris@google.com> Add signal handling to the register object.

- Add the StepIfSignalHandler function to the Regs object that checks
if the code is in a signal handler.
- Add tests for new code, also add a test that unwinds through a signal
handler.
- Slight modification to Elf to fail if a bad machine type is encountered.
Add tests for this.

Bug: 23762183

Test: Ran unit tests.
Change-Id: Idafa1105d00b91a9343d7464ac9ed1cb95830963
/system/core/libunwindstack/tests/RegsTest.cpp
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/tests/RegsTest.cpp
2a25c4aab5c7d0f0f6018789cce0b6e8c4abb03b 08-Jul-2017 Christopher Ferris <cferris@google.com> Add full support for initing registers.

- Fixes a few bugs in untested functionality.
- Add tests for the way the register handling code is used.
- Fix a few tests that were not reaping child processes.

Bug: 23762183

Test: Ran unit tests on host (32 bit and 64 bit).
Test: Ran unit tests on angler (32 bit and 64 bit).
Change-Id: I573d6617b4f1561f6e8494d7213c52086d112d97
/system/core/libunwindstack/tests/RegsTest.cpp
7b8e4671926486d61aab693968d8a0256a856033 02-Jun-2017 Christopher Ferris <cferris@google.com> Change RegsTmpl to RegsImpl.

Also clang-format modified Regs.cpp slightly.

Bug: 23762183

Test: Built and ran unit tests.
Change-Id: I1c7c1b01974ee3f35059c42b8e2aef24d46c81a7
/system/core/libunwindstack/tests/RegsTest.cpp
3958f8060ac0adccd977c0fab7a53d45f3fce58d 02-Feb-2017 Christopher Ferris <cferris@google.com> Elf interface for new unwinder.

This cl includes the code to read arm unwind information from a shared
library.

Bug: 23762183

Test: Passes all unit tests. I can dump the arm unwind information
Test: for an arm shared library.
Change-Id: I43501ea2eab843b81de8bd5128401dd1971af8d3
/system/core/libunwindstack/tests/RegsTest.cpp
723cf9b6e61744f7a20a807e67ab50adb9db5d42 20-Jan-2017 Christopher Ferris <cferris@google.com> New version of unwinder.

Bug: 23762183

Test: All unit tests pass.
Change-Id: I0ac69e55af56e1142c0a1ee3715cdc48f2ed3ec3
/system/core/libunwindstack/tests/RegsTest.cpp