This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
gdb and binutils branch master updated. 808f7ab1fc88da40007c17a20e49928359f27491
- From: qiyao at sourceware dot org
- To: gdb-cvs at sourceware dot org
- Date: 11 Jul 2014 13:38:33 -0000
- Subject: gdb and binutils branch master updated. 808f7ab1fc88da40007c17a20e49928359f27491
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".
The branch, master has been updated
via 808f7ab1fc88da40007c17a20e49928359f27491 (commit)
via 540314bdd87c7478d21b44dd4856d937bcc1479b (commit)
via 1db01f22f58cc01768dc921a7443a1bad4e48eb5 (commit)
from 3116063bd617de56fbc3bad046a692b1fb363a9d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=808f7ab1fc88da40007c17a20e49928359f27491
commit 808f7ab1fc88da40007c17a20e49928359f27491
Author: Yao Qi <yao@codesourcery.com>
Date: Wed Jul 2 15:16:26 2014 +0800
Stop prologue analysis when past the epilogue
We see a fail in gdb.trace/entry-values.exp on armv4t thumb,
bt^M
#0 0x000086fc in foo (i=0, i@entry=<optimized out>, j=2, j@entry=<optimized out>)^M
#1 0x00000002 in ?? ()^M
Backtrace stopped: previous frame identical to this frame (corrupt stack?)^M
(gdb) FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1)
The fail is caused by incorrect prologue analysis, which can be illustrated by
setting a breakpoint on function foo,
(gdb) disassemble foo
Dump of assembler code for function foo:
0x000086e8 <+0>: push {r7, lr}
0x000086ea <+2>: sub sp, #8
0x000086ec <+4>: add r7, sp, #0
0x000086ee <+6>: str r0, [r7, #4]
0x000086f0 <+8>: str r1, [r7, #0]
0x000086f2 <+10>: movs r3, #0
0x000086f4 <+12>: adds r0, r3, #0
0x000086f6 <+14>: mov sp, r7
0x000086f8 <+16>: add sp, #8
0x000086fa <+18>: pop {r7}
0x000086fc <+20>: pop {r1}
0x000086fe <+22>: bx r1
End of assembler dump.
(gdb) b foo
Breakpoint 1 at 0x86fc
As we can see, GDB analyzes the prologue and skip the prologue to the last
instruction but one. The breakpoint is set within the epilogue, and GDB
skips too many instruction for prologue. This patch teaches GDB to stop
prologue analysis when goes into the epilogue. With this patch applied,
GDB is able to unwind correctly,
(gdb) bt
#0 0x000086f6 in foo (i=0, i@entry=2, j=2, j@entry=3)
#1 0x00008718 in bar (i=<optimized out>)
#2 0x00008758 in main ()
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Break the loop if
thumb_instruction_restores_sp return true.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=540314bdd87c7478d21b44dd4856d937bcc1479b
commit 540314bdd87c7478d21b44dd4856d937bcc1479b
Author: Yao Qi <yao@codesourcery.com>
Date: Wed Jul 2 14:45:12 2014 +0800
Match instruction adjusts SP in thumb
This is a refactor patch, that moves matching instructions adjusting
SP into a new function, thumb_instruction_restores_sp. The second
call to thumb_instruction_restores_sp in thumb_in_function_epilogue_p
is a little different from the original. The original code matches
'POP <registers> without PC', but thumb_in_function_epilogue_p matches
'POP <registers> (with and without PC)'. However, GDB found one
instruction about return and is scanning the previous instruction,
which should be an instruction about return too, so the code change
doesn't affect the functionality.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_instruction_restores_sp): New function.
(thumb_in_function_epilogue_p): Call
thumb_instruction_restores_sp.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1db01f22f58cc01768dc921a7443a1bad4e48eb5
commit 1db01f22f58cc01768dc921a7443a1bad4e48eb5
Author: Yao Qi <yao@codesourcery.com>
Date: Tue Jul 1 15:36:44 2014 +0800
Restrict matching add/sub sp, #imm
Currently, GDB matches both add/sub sp, #imm in prologue and epilogue,
which is not very precise. On the instruction level, the immediate
number in both instruction can't be negative, so 'sub sp, #imm' only
appears in prologue while 'add sp, #imm' only appears in epilogue.
Note that on assembly level, we can write 'add sp, -8', but gas will
translate to 'sub sp, 8' instruction.
This patch is to only match 'sub sp, #imm' in prologue and match
'add sp, #immm' in epilogue. It paves the way for the following
patch.
gdb:
2014-07-11 Yao Qi <yao@codesourcery.com>
* arm-tdep.c (thumb_analyze_prologue): Don't match instruction
'add sp, #imm'.
(thumb_in_function_epilogue_p): Don't match 'sub sp, #imm'.
-----------------------------------------------------------------------
Summary of changes:
gdb/ChangeLog | 17 +++++++++++++++++
gdb/arm-tdep.c | 41 ++++++++++++++++++++++-------------------
2 files changed, 39 insertions(+), 19 deletions(-)
hooks/post-receive
--
gdb and binutils