old-cross-binutils/gdb/testsuite/gdb.arch
Sergio Durigan Junior 9991b20795 Andrew Haley found a bug on GDB running on ARM when using
--enable-64-bit-bfd.  Basically the issue happens when dealing with "bl"
instructions: GDB does branch destination calculation and (wrongly)
sign-extends the PC.  Here is a piece of his original message explaining
the problem:

>      next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
>
>      /* The Linux kernel offers some user-mode helpers in a high page.  We can
>         not read this page (as of 2.6.23), and even if we could then we couldn't
>         set breakpoints in it, and even if we could then the atomic operations
>         would fail when interrupted.  They are all called as functions and return
>         to the address in LR, so step to there instead.  */
>      if (next_pc > 0xffff0000)
>        next_pc = get_frame_register_unsigned (frame, ARM_LR_REGNUM);
>
>      arm_insert_single_step_breakpoint (gdbarch, aspace, next_pc);
>
>    Unfortunately, branch destination addresses are SIGN EXTENDED to 64
>    bits.  So,
>
>    (top-gdb) p/x next_pc
>    $14 = 0xffffffffb6df2864
>
>    Which triggers the next_pc = get_frame_register_unsigned(), and we
>    cannot step into any branches because the destination PC is wrong.

Anyway, the fix is simple and Andrew himself provided it for us.  It
took a while for me to figure out how to trigger the bug (in order to
write a testcase for it), but I finally made it.

The attached patch fixes the problem (by casting to `unsigned long'
instead of just `long'), and also includes a testcase to reproduce the
issue.

gdb/ChangeLog:

2013-04-22  Andrew Haley  <aph@redhat.com>

	* arm-tdep.c (BranchDest): Cast result as "unsigned long",
	instead of "long".

gdb/testsuite/ChangeLog:

2013-04-22  Sergio Durigan Junior  <sergiodj@redhat.com>

	* gdb.arch/arm-bl-branch-dest.c: New file.
	* gdb.arch/arm-bl-branch-dest.exp: Likewise.
2013-04-22 09:20:33 +00:00
..
alpha-step.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
alpha-step.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
altivec-abi.c
altivec-abi.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
altivec-regs.c
altivec-regs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-byte.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-disp-step.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-disp-step.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-dword.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-inline.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-inline.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-inline.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-param.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-param.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value-param.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value.cc Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-entry-value.s Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-i386-address.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-i386-address.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-prologue-xmm.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-prologue-xmm.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-prologue-xmm.s Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-pseudo.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-tailcall-cxx.exp gdb/ 2013-03-10 18:04:00 +00:00
amd64-tailcall-cxx1.cc gdb/ 2013-03-10 18:04:00 +00:00
amd64-tailcall-cxx1.S gdb/ 2013-03-10 18:04:00 +00:00
amd64-tailcall-cxx2.cc gdb/ 2013-03-10 18:04:00 +00:00
amd64-tailcall-cxx2.S gdb/ 2013-03-10 18:04:00 +00:00
amd64-tailcall-noret.c gdb/ 2013-03-10 18:06:26 +00:00
amd64-tailcall-noret.exp gdb/ 2013-03-10 18:06:26 +00:00
amd64-tailcall-noret.S gdb/ 2013-03-10 18:06:26 +00:00
amd64-tailcall-ret.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-tailcall-ret.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-tailcall-ret.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
amd64-word.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arm-bl-branch-dest.c Andrew Haley found a bug on GDB running on ARM when using 2013-04-22 09:20:33 +00:00
arm-bl-branch-dest.exp Andrew Haley found a bug on GDB running on ARM when using 2013-04-22 09:20:33 +00:00
arm-disp-step.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
arm-disp-step.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
e500-abi.c
e500-abi.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
e500-prologue.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
e500-prologue.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
e500-regs.c
e500-regs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gcore.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1291.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1291.s Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1431.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1431.s Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1558.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
gdb1558.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-avx.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-avx.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-bp_permanent.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-byte.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-cfi-notcurrent.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-cfi-notcurrent.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-cpuid.h Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-disp-step.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-disp-step.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-dr3-watch.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-dr3-watch.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-float.exp Fix the x87 FP register printout when issuing the “info float” command. 2013-04-19 14:13:30 +00:00
i386-float.S Fix the x87 FP register printout when issuing the “info float” command. 2013-04-19 14:13:30 +00:00
i386-gnu-cfi-asm.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-gnu-cfi.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-gnu-cfi.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-permbkpt.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-permbkpt.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-prologue.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-prologue.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-pseudo.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-signal.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-signal.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-size-overlap.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-size-overlap.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-size.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-size.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-sse-stack-align.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-sse-stack-align.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-sse-stack-align.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-sse.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-sse.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-unwind.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-unwind.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
i386-word.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ia64-breakpoint-shadow.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ia64-breakpoint-shadow.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
iwmmxt-regs.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
iwmmxt-regs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
Makefile.in * Makefile.in (clean): Remove Fission .dwo and .dwp files. 2012-05-17 19:03:59 +00:00
mips-octeon-bbit.c 2012-08-19 Andrew Pinski <apinski@cavium.com> 2012-08-19 22:22:49 +00:00
mips-octeon-bbit.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
mips16-thunks-inmain.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-main.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-sin.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-sinfrob.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-sinfrob16.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-sinmain.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks-sinmips16.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
mips16-thunks.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pa-nullify.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
pa-nullify.s
pa64-nullify.s
powerpc-aix-prologue.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
powerpc-aix-prologue.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
powerpc-d128-regs.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
powerpc-d128-regs.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
powerpc-prologue.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
powerpc-prologue.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc-dfp.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc-dfp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc-fp.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc-fp.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc64-atomic-inst.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
ppc64-atomic-inst.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
spu-info.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
spu-info.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
spu-ls.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
spu-ls.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
system-gcore.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
thumb-bx-pc.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb-bx-pc.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb-prologue.c Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb-prologue.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb-singlestep.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb-singlestep.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb2-it.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
thumb2-it.S Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
vsx-regs.c
vsx-regs.exp Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00