diff options
author | Alan Modra <amodra@gmail.com> | 2017-12-11 17:31:11 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2017-12-12 23:23:38 +1030 |
commit | db9077b7275e86637218a7a7d165cb85a4de116f (patch) | |
tree | d3d99d5a0da9aa3f31da7d4e1d963e60540613ae /gdb/doc | |
parent | a933405894161c8b15f675c48d077b7f7d6aabf2 (diff) | |
download | gdb-db9077b7275e86637218a7a7d165cb85a4de116f.zip gdb-db9077b7275e86637218a7a7d165cb85a4de116f.tar.gz gdb-db9077b7275e86637218a7a7d165cb85a4de116f.tar.bz2 |
PR22576, ppc64_skip_trampoline_code uses wrong r2 for EXEC_REVERSE
The TOC pointer register, r2, on powerpc64 is generally not mentioned
in debug info. It is saved and restored by call linkage code, and
set to the callee value either by call stub code (ELFv1) or in the
callee global entry point code (ELFv2). A call stub uses the caller
TOC pointer to access the PLT. So for gdb to read the correct PLT
entry in order to determine the destination of the trampoline, gdb
needs to know the caller r2. When skipping over trampolines in the
normal forward direction, the caller r2 is simply the current value of
r2 (at the start of the trampoline). However, when reversing over
trampolines the current value of r2 is that for the callee. Using
that value results in wild reads of memory rather than the correct PLT
entry.
This patch corrects the value of r2 by using the value saved on the
stack for reverse execution. Note that in reverse execution mode it
isn't really necessary for skip_trampoline_code to return the actual
destination, so we're doing a little more work than needed here. Any
non-zero return value would do (and it would be nicer if the interface
was changed to return the start of the stub).
PR tdep/22576
* ppc64-tdep.c (ppc64_plt_entry_point): Rewrite to take TOC-relative
PLT offset, and retrieve r2 from stack when executing in reverse.
(ppc64_standard_linkage1_target): Drop pc param. Calculate offset
rather than PLT address.
(ppc64_standard_linkage2_target): Likewise.
(ppc64_standard_linkage3_target): Likewise.
(ppc64_standard_linkage4_target): Likewise.
(ppc64_skip_trampoline_code_1): Adjust to suit.
Diffstat (limited to 'gdb/doc')
0 files changed, 0 insertions, 0 deletions