This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tdep/14261] Break point not set at the 1st executable instruction in case of code compiled with clang on ARM Architecture.


https://sourceware.org/bugzilla/show_bug.cgi?id=14261

--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
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  21daaaaffcbda47b724858dd99ee2082043ef2da (commit)
       via  f303bc3e6ca29f0413376e38164dc5cdc0893d4b (commit)
      from  65840e31a7a7cd64c81ac47bcb17319536ce3ba2 (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=21daaaaffcbda47b724858dd99ee2082043ef2da

commit 21daaaaffcbda47b724858dd99ee2082043ef2da
Author: Yao Qi <yao@codesourcery.com>
Date:   Thu Nov 27 11:37:54 2014 +0800

    Improve arm_skip_prologue by using arm_analyze_prologue

    Hi,
    I see many fails in dw2-dir-file-name.exp on arm target when test
    case is compiled with -marm, however, these fails are disappeared when
    test case is compiled with -mthumb.

    The difference of pass and fail shown below is that "0x000085d4 in" isn't
    printed out, but test case expects to see it.

    -Breakpoint 2, compdir_missing__ldir_missing__file_basename () at
tmp-dw2-dir-file-name.c:999^M
    -(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp:
compdir_missing__ldir_missing__file_basename: continue to breakpoint:
compdir_missing__ldir_missing__file_basename
    +Breakpoint 2, 0x000085d4 in compdir_missing__ldir_missing__file_basename
() at tmp-dw2-dir-file-name.c:999^M
    +(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp:
compdir_missing__ldir_missing__file_basename: continue to breakpoint:
compdir_missing__ldir_missing__file_basename

    This difference is caused by setting breakpoint at the first instruction
    in the function (actually, the first instruction in prologue, at [1]),
    so that frame_show_address returns false, and print_frame doesn't print the
    address.

       0x00008620 <+0>:     push    {r11}           ; (str r11, [sp, #-4]!) 
<--[1]
       0x00008624 <+4>:     add     r11, sp, #0
       0x00008628 <+8>:     ldr     r3, [pc, #24]   ; 0x8648
<compdir_missing__ldir_missing__file_basename+40>
       0x0000862c <+12>:    ldr     r3, [r3]
       0x00008630 <+16>:    add     r3, r3, #1
       0x00008634 <+20>:    ldr     r2, [pc, #12]   ; 0x8648
<compdir_missing__ldir_missing__file_basename+40>

    Then, it must be the arm_skip_prologue's fault that unable to skip
    instructions in prologue.  At the end of arm_skip_prologue, it matches
    several instructions, such as "str  r(0123),[r11,#-nn]" and
    "str  r(0123),[sp,#nn]", but "push {r11}" isn't handled.

    These instruction matching code in arm_skip_prologue, which can be regarded
    as leftover of development for many years, should be merged to
    arm_analyze_prologue and use arm_analyze_prologue in arm_skip_prologue.
    Here is the something like the history of arm_{skip,scan,analyze}_prologue.
    Around 2002, there are arm_skip_prologue and arm_scan_prologue, but code
are
    duplicated to some extent.  When match an instruction, both functions
should
    be modified, for example in Michael Snyder's patch
    https://sourceware.org/ml/gdb-patches/2002-05/msg00205.html and Michael
    expressed the willingness to merge both into one.  Daniel added code call
    thumb_analyze_prologue in arm_skip_prologue in 2006, but didn't handle its
    counterpart arm_analyze_prologue, which is added in 2010
    <https://sourceware.org/ml/gdb-patches/2010-03/msg00820.html>
    however, the instructions matching at the bottom of arm_skip_prologue
wasn't
    cleaned up.  This patch is to merge them into arm_analyze_prologue.

    gdb:

    2014-12-12  Yao Qi  <yao@codesourcery.com>

        PR tdep/14261
        * arm-tdep.c (arm_skip_prologue): Remove unused local variable
        'skip_pc'.  Remove code skipping prologue instructions, use
        arm_analyze_prologue instead.
        (arm_analyze_prologue): Stop the scanning for unrecognized
        instruction when skipping prologue.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f303bc3e6ca29f0413376e38164dc5cdc0893d4b

commit f303bc3e6ca29f0413376e38164dc5cdc0893d4b
Author: Yao Qi <yao@codesourcery.com>
Date:   Fri Nov 28 15:19:12 2014 +0800

    Don't scan prologue past epilogue

    This patch is to stop prologue analysis past epilogue in for arm mode,
    while we've already had done the same to thumb mode (see
    thumb_instruction_restores_sp).  This is useful to parse functions
    with empty body (epilogue follows prologue).

    gdb:

    2014-12-12  Yao Qi  <yao@codesourcery.com>

        * arm-tdep.c (arm_instruction_restores_sp): New function.
        (arm_analyze_prologue): Call arm_instruction_restores_sp.
        (arm_in_function_epilogue_p): Move code to
        arm_instruction_restores_sp.

-----------------------------------------------------------------------

Summary of changes:
 gdb/ChangeLog  |   16 +++++++
 gdb/arm-tdep.c |  128 +++++++++++++++++++-------------------------------------
 2 files changed, 59 insertions(+), 85 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]