Binutils with MCST patches
6b65d1b6b3
Hi, This patch is to handle a software watchpoint case that program returns to caller's epilogue, and it causes the fail in thumb mode, finish^M Run till exit from #0 func () at gdb/testsuite/gdb.base/watchpoint-cond-gone.c:26^M 0x000001f6 in jumper ()^M (gdb) FAIL: gdb.base/watchpoint-cond-gone.exp: Catch the no longer valid watchpoint In the test, jumper calls func, and programs returns from func to jumper's epilogue, IOW, the branch instruction is the last instruction of jumper's function body. jumper: ..... 0x000001f2 <+10>: bl 0x200 [1] <---- indirect call to func 0x000001f6 <+14>: mov sp, r7 [2] <---- start of the epilogue 0x000001f8 <+16>: add sp, #8 0x000001fa <+18>: pop {r7} 0x000001fc <+20>: pop {r0} 0x000001fe <+22>: bx r0 When the inferior returns from func back to jumper, it is expected that an expression of a software watchpoint becomes out-of-scope. GDB validates the expression by checking the corresponding frame, but this check is guarded by gdbarch_in_function_epilogue_p. See breakpoint.c:watchpoint_check. It doesn't work in this case, because program returns from func's epilogue back to jumper's epilogue [2], GDB thinks the program is still within the epilogue, but in fact it goes to a different one. When PC points at [2], the sp-restore instruction is to be executed, so the stack frame isn't destroyed yet and we can still use the frame mechanism reliably. Note that when PC points to the first instruction of restoring SP, it is part of epilogue, but we still return zero. When goes to the next instruction, the backward scan will still match the epilogue sequence correctly. The reason for doing this is to handle the "return-to-epilogue" case. What this patch does is to restrict the epilogue matching that let GDB think the first SP restore instruction isn't part of the epilogue, and fall back to use frame mechanism. We set 'found_stack_adjust' zero before backward scan, and we've done this for arm mode counterpart (arm_in_function_epilogue_p) too. The patch is tested in arm-none-eabi and arm-none-linux-gnueabi with various multilibs. OK to apply? gdb: 2014-08-28 Yao Qi <yao@codesourcery.com> * arm-tdep.c (thumb_in_function_epilogue_p): Don't set found_stack_adjust in forward scan. Remove condition check on found_stack_adjust which is always true. Indent the code. |
||
---|---|---|
bfd | ||
binutils | ||
config | ||
cpu | ||
elfcpp | ||
etc | ||
gas | ||
gdb | ||
gold | ||
gprof | ||
include | ||
intl | ||
ld | ||
libdecnumber | ||
libiberty | ||
opcodes | ||
readline | ||
sim | ||
texinfo | ||
.cvsignore | ||
.gitattributes | ||
.gitignore | ||
ChangeLog | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING3 | ||
COPYING3.LIB | ||
COPYING.LIB | ||
COPYING.LIBGLOSS | ||
COPYING.NEWLIB | ||
depcomp | ||
djunpack.bat | ||
install-sh | ||
libtool.m4 | ||
lt~obsolete.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
makefile.vms | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
README | ||
README-maintainer-mode | ||
setup.com | ||
src-release.sh | ||
symlink-tree | ||
ylwrap |
README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README; if with a libg++ release, see libg++/README, etc. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.