public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug tdep/31471] New: [gdb/tdep, arm] FAIL: gdb.arch/thumb2-it.exp: it_3, stepi 3
@ 2024-03-11 13:00 vries at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: vries at gcc dot gnu.org @ 2024-03-11 13:00 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31471
           Summary: [gdb/tdep, arm] FAIL: gdb.arch/thumb2-it.exp: it_3,
                    stepi 3
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On pinebook pro (aarch64 manjaro linux, 32-bit debian chroot) I run into:
...
(gdb) PASS: gdb.arch/thumb2-it.exp: it_2, continue
break *it_3^M
Breakpoint 4 at 0x40051e: file
/home/vries/gdb/src/gdb/testsuite/gdb.arch/thumb2-it.S, line 67.^M
(gdb) call (int) it_3()^M
^M
Breakpoint 4, it_3 () at
/home/vries/gdb/src/gdb/testsuite/gdb.arch/thumb2-it.S:67^M
67              mov     r0, #0  @ Setup^M
The program being debugged stopped while in a function called from GDB.^M
Evaluation of the expression containing the function^M
(it_3) will be abandoned.^M
When the function is done executing, GDB will silently stop.^M
(gdb) PASS: gdb.arch/thumb2-it.exp: it_3, call
stepi^M
68              cmp     r0, #0  @ Setup^M
(gdb) PASS: gdb.arch/thumb2-it.exp: it_3, stepi 0
stepi^M
69              itete   ge      @ IT instruction, Expected == 2^M
(gdb) PASS: gdb.arch/thumb2-it.exp: it_3, stepi 1
stepi^M
70              addge   r0, #1  @ Reached^M
(gdb) PASS: gdb.arch/thumb2-it.exp: it_3, stepi 2
stepi^M
71              addlt   r0, #2  @ Not reached^M
(gdb) FAIL: gdb.arch/thumb2-it.exp: it_3, stepi 3
continue^M
...

objdump output:
...
0000051e <it_3>:
 51e:   f04f 0000       mov.w   r0, #0
 522:   2800            cmp     r0, #0
 524:   bfab            itete   ge
 526:   3001            addge   r0, #1
 528:   3002            addlt   r0, #2
 52a:   3004            addge   r0, #4
 52c:   3008            addlt   r0, #8
 52e:   4770            bx      lr
...

The following happens: while stopped at 0x526, thumb_get_next_pcs_raw is called
to determine where to set breakpoints.

In thumb_get_next_pcs_raw, it lands in the "There are conditional instructions
after this one" case, and returns the pcs for insns at 0x528 and 0x52a.

Both breakpoints are set, and then the breakpoint at 0x528 is hit. 
Nevertheless the instruction is not executed, because the flags do not allow
the insn to run. 

The next stepi hits instruction 0x52a, which is indeed executed.

The test-case expects stepi to skip over the insn at 0x528.

I think it's possible do so, AFAIU the logic for determining whether we're
stopped at a a disabled IT sub-insn is present in thumb_get_next_pcs_raw.

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-11 13:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 13:00 [Bug tdep/31471] New: [gdb/tdep, arm] FAIL: gdb.arch/thumb2-it.exp: it_3, stepi 3 vries 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).