public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/18139] New: gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target
@ 2015-03-18 11:21 qiyao at gcc dot gnu.org
  2015-03-18 16:50 ` [Bug testsuite/18139] " qiyao at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-03-18 11:21 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 18139
           Summary: gdb.linespec/break-asm-file.exp needs some tweak for
                    non-x86 target
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: qiyao at gcc dot gnu.org

the test case has an assumption that ".int 0" is a valid instruction,

func2:
.Lbegin_func2:
.int 0
.int 0
.Lend_func2:
.size func2, .-func2
.globl _func

however, it is not true on many other targets.  This test fails on arm,
aarch64, ppc and s390x.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/18139] gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target
  2015-03-18 11:21 [Bug testsuite/18139] New: gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target qiyao at gcc dot gnu.org
@ 2015-03-18 16:50 ` qiyao at gcc dot gnu.org
  2015-03-26  8:33 ` cvs-commit at gcc dot gnu.org
  2015-03-26 13:04 ` qiyao at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-03-18 16:50 UTC (permalink / raw)
  To: gdb-prs

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

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |qiyao at gcc dot gnu.org

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/18139] gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target
  2015-03-18 11:21 [Bug testsuite/18139] New: gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target qiyao at gcc dot gnu.org
  2015-03-18 16:50 ` [Bug testsuite/18139] " qiyao at gcc dot gnu.org
@ 2015-03-26  8:33 ` cvs-commit at gcc dot gnu.org
  2015-03-26 13:04 ` qiyao at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2015-03-26  8:33 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Yao Qi <qiyao@sourceware.org>:

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

commit 6d5f0679fe4ff7c3d8ec1d97646ee23b02564715
Author: Yao Qi <yao.qi@linaro.org>
Date:   Thu Mar 26 08:29:48 2015 +0000

    Handle the effect of skipping prologue

    break-asm-file.exp has some manually written dwarf to create some line
    number entries like this,

      [0x0000013d]  Extended opcode 2: set Address to 0x40053f
      [0x00000144]  Advance Line by 4 to 7
      [0x00000146]  Copy
      [0x00000147]  Extended opcode 2: set Address to 0x400541
      [0x0000014e]  Advance Line by 1 to 8
      [0x00000150]  Copy
      [0x00000151]  Extended opcode 2: set Address to 0x400547
      [0x00000158]  Extended opcode 1: End of Sequence

    0x40053f is the start address of function func, and is mapped to line
    7.  0x400541 is within function func, and is mapped to line 8.

    (gdb) disassemble /r 0x40053f,+8
    Dump of assembler code from 0x40053f to 0x400547:
       0x000000000040053f <func+0>: 00 00   add    %al,(%rax)
       0x0000000000400541 <func+2>: 00 00   add    %al,(%rax)
       0x0000000000400543 <func+4>: 00 00   add    %al,(%rax)
       0x0000000000400545 <func+6>: 00 00   add    %al,(%rax)

    in the following test,

    (gdb) break a/break-asm-file0.s:func
    Breakpoint 1 at 0x40053f: file a/break-asm-file0.s, line 7.

    As we can see, breakpoint is set at the start address of function func
    on x86, which means no prologue is skipped.  On other targets, such as
    arm and aarch64, breakpoint is set at the address *after* the start
    address, which is mapped to line 8.  Then test fails.

    In fact, it is lucky this test doesn't fail on x86 and x86_64, whose
    gdbarch method skip_prologue doesn't reply on skip_prologue_using_sal
    if producer isn't clang.

      if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL))
        {
          CORE_ADDR post_prologue_pc
        = skip_prologue_using_sal (gdbarch, func_addr);
          struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr);

          /* Clang always emits a line note before the prologue and another
         one after.  We trust clang to emit usable line notes.  */
          if (post_prologue_pc
          && (cust != NULL
              && COMPUNIT_PRODUCER (cust) != NULL
              && startswith (COMPUNIT_PRODUCER (cust), "clang ")))
            return max (start_pc, post_prologue_pc);
        }

    so it doesn't return and go further to prologue analyser.  Since ".int 0"
    isn't an instruction of prologue, nothing is skipped, starting address
    is used, and test passes.

    however, on targets which don't have such producer checking, the first
    line number entry is skipped, and skip_prologue_using_sal returns sal
    represents the second line number entry.

    The idea of this patch is to force GDB stop at somewhere which is stilled
    mapped to line 7 after skipping prologue.  I choose to add a new line
    number entry for the following instruction but mapped to the same line (7),
    because I see the comments in dwarf2read.c,

       ... fact that two consecutive
       line number entries for the same line is a heuristic used by gcc
       to denote the end of the prologue.

    then the line table becomes:

      [0x000000d4]  Extended opcode 2: set Address to 0x400529
      [0x000000db]  Advance Line by 4 to 7
      [0x000000dd]  Copy
      [0x000000de]  Extended opcode 2: set Address to 0x40052a
      [0x000000e5]  Advance Line by 0 to 7
      [0x000000e7]  Copy
      [0x000000e8]  Extended opcode 2: set Address to 0x40052b
      [0x000000ef]  Advance Line by 1 to 8
      [0x000000f1]  Copy
      [0x000000f2]  Extended opcode 2: set Address to 0x40052c
      [0x000000f9]  Extended opcode 1: End of Sequence

    gdb/testsuite:

    2015-03-26  Yao Qi  <yao.qi@linaro.org>

        PR testsuite/18139
        * gdb.linespec/break-asm-file0.s (func): New label .Lfunc_2.
        Add a line number entry for the same line.
        * gdb.linespec/break-asm-file1.s (func): New label .Lfunc_2.
        Add a line number entry for the same line.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug testsuite/18139] gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target
  2015-03-18 11:21 [Bug testsuite/18139] New: gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target qiyao at gcc dot gnu.org
  2015-03-18 16:50 ` [Bug testsuite/18139] " qiyao at gcc dot gnu.org
  2015-03-26  8:33 ` cvs-commit at gcc dot gnu.org
@ 2015-03-26 13:04 ` qiyao at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: qiyao at gcc dot gnu.org @ 2015-03-26 13:04 UTC (permalink / raw)
  To: gdb-prs

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

Yao Qi <qiyao at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |8.0

--- Comment #2 from Yao Qi <qiyao at gcc dot gnu.org> ---
Patches are pushed in.  Close it.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-26  8:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 11:21 [Bug testsuite/18139] New: gdb.linespec/break-asm-file.exp needs some tweak for non-x86 target qiyao at gcc dot gnu.org
2015-03-18 16:50 ` [Bug testsuite/18139] " qiyao at gcc dot gnu.org
2015-03-26  8:33 ` cvs-commit at gcc dot gnu.org
2015-03-26 13:04 ` qiyao at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).