public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/28717] New: GDB steps twice on a single stepi
@ 2021-12-20 16:20 qwertytmp1 at gmail dot com
  2021-12-20 19:38 ` [Bug gdb/28717] " simark at simark dot ca
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: qwertytmp1 at gmail dot com @ 2021-12-20 16:20 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 28717
           Summary: GDB steps twice on a single stepi
           Product: gdb
           Version: 11.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: qwertytmp1 at gmail dot com
  Target Milestone: ---

On ARM/aarch64 platform, when executing command:
```
stepi
```

address increases by 8 bytes, instead of 4.

When I printed packets, received from the DGB client, I've found that it
consists of strange workflow:

```
'm1e2f8,4'    - read 4 bytes memory at 0x1e2f8
'vCont?'      - request a list of actions supported by the ‘vCont’ packet.
'vCont;s:1;c' - resume the inferior, singlestep, continue.
'g'           - return the value of the CPU registers
'm1e2fc,4'    - read 4 bytes memory at 0x1e2fc
'vCont;s:1'   - resume the inferior, singlestep.
'g'           - return the value of the CPU registers
...
```

As it can be seen, we have 'vCont;s:1;c' and 'vCont;s:1'.

P.S. Problem exists as on gdb-9.1 as on the gdb-11.1.

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
@ 2021-12-20 19:38 ` simark at simark dot ca
  2021-12-21 11:07 ` qwertytmp1 at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: simark at simark dot ca @ 2021-12-20 19:38 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Hi,

Can you provide an example program where this happens?  Can you try to
reproduce this with a GDBserver debugging a Linux program?  That would help us
figure out what happens.

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
  2021-12-20 19:38 ` [Bug gdb/28717] " simark at simark dot ca
@ 2021-12-21 11:07 ` qwertytmp1 at gmail dot com
  2021-12-23 11:43 ` qwertytmp1 at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: qwertytmp1 at gmail dot com @ 2021-12-21 11:07 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from lol lol <qwertytmp1 at gmail dot com> ---
Hello,

> Can you provide an example program where this happens?

Company, I'm working on, uses custom GDB server software.
That is why, unfortunately, I cannot share the source code of the gdbserver.
Fortunately, I can share commands to/from such custom GDB server:
```
GDBSRV RECEIVED: 'm1e2f8,4'
GDBSRV SENT: '$5f2403d5#fd'
GDBSRV RECEIVED: 'vCont?'
GDBSRV SENT: '$vCont;c;C;s;S#62'
GDBSRV RECEIVED: 'vCont;s:1;c'
GDBSRV SENT: '$T05watch:1e;#db'
GDBSRV RECEIVED: 'g'
GDBSRV SENT: '$010**a09f0* 30*%9f0* 30*}0*}0*}0*}0*_e09e0*
30*"0fce2010*.a*}a*}a*}a*}a*}a*}a*}a*}a*}a*}a*b#b4'
GDBSRV RECEIVED: 'm1e2fc,4'
GDBSRV SENT: '$ff0301d1#25'
GDBSRV RECEIVED: 'vCont;s:1'
GDBSRV SENT: '$T05watch:1e;#db'
GDBSRV RECEIVED: 'g'
GDBSRV SENT: '$010**a09f0* 30*%9f0* 30*}0*}0*}0*}0*_a09e0*
30*%e3010*.a*}a*}a*}a*}a*}a*}a*}a*}a*}a*}a*b#bb'
GDBSRV RECEIVED: 'm1e300,4'
GDBSRV SENT: '$fd7b02a9#5f'
GDBSRV RECEIVED: 'm1e2fc,4'
GDBSRV SENT: '$ff0301d1#25'
GDBSRV RECEIVED: 'm1e300,4'
GDBSRV SENT: '$fd7b02a9#5f'
GDBSRV RECEIVED: 'qfThreadInfo'
GDBSRV SENT: '$m1#9e'
GDBSRV RECEIVED: 'qsThreadInfo'
GDBSRV SENT: '$l#6c'
GDBSRV RECEIVED: 'm1e300,4'
GDBSRV SENT: '$fd7b02a9#5f'
GDBSRV RECEIVED: 'm1e2fc,4'
GDBSRV SENT: '$ff0301d1#25'
GDBSRV RECEIVED: 'm1e300,4'
GDBSRV SENT: '$fd7b02a9#5f'
```

I hope it will help to understand the problem.



> Can you try to reproduce this with a GDBserver debugging a Linux program?  That would help us figure out what happens.

I was failed to reproduce the problem with Linux application.
GDB client works without problems.


I've compared commands received/sent by the GDB client for the native AARCH64
application and Linux AARCH64 application.
Below you can see the difference:
```
If to debug NATIVE application | If to debug LINUX application
                                                           | 
(gdb) si                       | (gdb) si
PUTPKT: 'm1e2f8,4'             | PUTPKT: 'Z0,7ff7ed2504,4'
GETPKT: 'm1e2f8,4'             | GETPKT: 'Z0,7ff7ed2504,4'
PUTPKT: 'vCont?'               | PUTPKT: 'm7ff7ed2508,4'
GETPKT: 'vCont?'               | GETPKT: 'm7ff7ed2508,4'
PUTPKT: 'vCont;s:1;c'          | GETPKT: 'e0030091'
PUTPKT: 'g'                    | PUTPKT: 'vCont?'
GETPKT: 'g'                    | GETPKT: 'vCont?'
PUTPKT: 'm1e2fc,4'             | PUTPKT: 'vCont;s:p77.77;c:p77.-1'
GETPKT: 'm1e2fc,4'             | PUTPKT: 'm7ff7ed250c,4'
PUTPKT: 'vCont;s:1'            | GETPKT: 'm7ff7ed250c,4'
PUTPKT: 'g'                    | PUTPKT: 'm7ff7ed2508,4'
GETPKT: 'g'                    | GETPKT: 'm7ff7ed2508,4'
PUTPKT: 'm1e300,4'             | PUTPKT: 'm7ff7ed250c,4'
GETPKT: 'm1e300,4'             | GETPKT: 'm7ff7ed250c,4'
PUTPKT: 'm1e2fc,4'             | PUTPKT: 'qXfer:threads:read::0,1000'
GETPKT: 'm1e2fc,4'             | PUTPKT: 'z0,7ff7ed2504,4'
PUTPKT: 'm1e300,4'             | GETPKT: 'z0,7ff7ed2504,4'
GETPKT: 'm1e300,4'             | PUTPKT: 'm7ff7ed250c,4'
GETPKT: 'fd7b02a9'             | GETPKT: 'm7ff7ed250c,4'
GETPKT: 'm1'                   | PUTPKT: 'm7ff7ed2508,4'
PUTPKT: 'm1e300,4'             | GETPKT: 'm7ff7ed2508,4'
GETPKT: 'm1e300,4'             | PUTPKT: 'm7ff7ed250c,4'
PUTPKT: 'm1e2fc,4'             | GETPKT: 'm7ff7ed250c,4'
GETPKT: 'm1e2fc,4'             | 
PUTPKT: 'm1e300,4'             | 
GETPKT: 'm1e300,4'             | 

```

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
  2021-12-20 19:38 ` [Bug gdb/28717] " simark at simark dot ca
  2021-12-21 11:07 ` qwertytmp1 at gmail dot com
@ 2021-12-23 11:43 ` qwertytmp1 at gmail dot com
  2021-12-26 18:01 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: qwertytmp1 at gmail dot com @ 2021-12-23 11:43 UTC (permalink / raw)
  To: gdb-prs

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

lol lol <qwertytmp1 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qwertytmp1 at gmail dot com

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
                   ` (2 preceding siblings ...)
  2021-12-23 11:43 ` qwertytmp1 at gmail dot com
@ 2021-12-26 18:01 ` tromey at sourceware dot org
  2021-12-28 10:47 ` qwertytmp1 at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2021-12-26 18:01 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Another thing that's sometimes useful is to "set debug infrun 1"
and then run the experiment.  This will log gdb's idea of what
it is doing.

If that's not informative then you'll probably need to debug gdb.

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
                   ` (3 preceding siblings ...)
  2021-12-26 18:01 ` tromey at sourceware dot org
@ 2021-12-28 10:47 ` qwertytmp1 at gmail dot com
  2021-12-28 16:37 ` qwertytmp1 at gmail dot com
  2022-03-06 17:04 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: qwertytmp1 at gmail dot com @ 2021-12-28 10:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from lol lol <qwertytmp1 at gmail dot com> ---
@Tom Tromey

Thank you for this hint command!
I've tried to reproduce the problem with "set debug infrun 1".

Unfortunately, I'm not as proficient at GDB internals as I would like to be.
Maybe you see something weird from the log I've got:

```
(gdb) set debug infrun 1
(gdb) si
[infrun] clear_proceed_status_thread: Thread 1
[infrun] proceed: enter
  [infrun] proceed: addr=0xffffffffffffffff, signal=GDB_SIGNAL_DEFAULT
  [infrun] scoped_disable_commit_resumed: reason=proceeding
  [infrun] start_step_over: enter
    [infrun] start_step_over: stealing global queue of threads to step, length
= 0
    [infrun] operator(): step-over queue now empty
  [infrun] start_step_over: exit
  [infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=0, current
thread [Thread 1] at 0x1e514
PUTPKT: 'm1e514,4'
GETPKT: 'm1e514,4'
PUTPKT: 'vCont?'
GETPKT: 'vCont?'
PUTPKT: 'vCont;s:1;c'
  [infrun] prepare_to_wait: prepare_to_wait
  [infrun] reset: reason=proceeding
  [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for
target remote
  [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for
target remote
[infrun] proceed: exit
[infrun] fetch_inferior_event: enter
  [infrun] scoped_disable_commit_resumed: reason=handling event
  [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) =
  [infrun] print_target_wait_results:   42000.1.0 [Thread 1],
  [infrun] print_target_wait_results:   status->kind = stopped, signal =
GDB_SIGNAL_TRAP
  [infrun] handle_inferior_event: status->kind = stopped, signal =
GDB_SIGNAL_TRAP
PUTPKT: 'g'
GETPKT: 'g'
  [infrun] context_switch: Switching context from process 0 to Thread 1
  [infrun] handle_signal_stop: stop_pc=0x1e518
  [infrun] handle_signal_stop: stopped by watchpoint
  [infrun] handle_signal_stop: stopped data address=0x1f
  [infrun] resume_1: step=1, signal=GDB_SIGNAL_0, trap_expected=1, current
thread [Thread 1] at 0x1e518
PUTPKT: 'm1e518,4'
GETPKT: 'm1e518,4'
PUTPKT: 'vCont;s:1'
  [infrun] prepare_to_wait: prepare_to_wait
  [infrun] reset: reason=handling event
  [infrun] maybe_set_commit_resumed_all_targets: enabling commit-resumed for
target remote
  [infrun] maybe_call_commit_resumed_all_targets: calling commit_resumed for
target remote
[infrun] fetch_inferior_event: exit
[infrun] fetch_inferior_event: enter
  [infrun] scoped_disable_commit_resumed: reason=handling event
  [infrun] print_target_wait_results: target_wait (-1.0.0 [Thread 0], status) =
  [infrun] print_target_wait_results:   42000.1.0 [Thread 1],
  [infrun] print_target_wait_results:   status->kind = stopped, signal =
GDB_SIGNAL_TRAP
  [infrun] handle_inferior_event: status->kind = stopped, signal =
GDB_SIGNAL_TRAP
  [infrun] clear_step_over_info: clearing step over info
PUTPKT: 'g'
GETPKT: 'g'
  [infrun] context_switch: Switching context from process 0 to Thread 1
  [infrun] handle_signal_stop: stop_pc=0x1e51c
  [infrun] handle_signal_stop: stopped by watchpoint
  [infrun] handle_signal_stop: stopped data address=0x1f
PUTPKT: 'm1e51c,4'
GETPKT: 'm1e51c,4'
PUTPKT: 'm1e518,4'
GETPKT: 'm1e518,4'
PUTPKT: 'm1e51c,4'
GETPKT: 'm1e51c,4'
  [infrun] process_event_stop_test: stepi/nexti
  [infrun] stop_waiting: stop_waiting
GETPKT: 'fd7b02a9'
GETPKT: 'm1'
PUTPKT: 'm1e51c,4'
GETPKT: 'm1e51c,4'
PUTPKT: 'm1e518,4'
GETPKT: 'm1e518,4'
PUTPKT: 'm1e51c,4'
GETPKT: 'm1e51c,4'
0x000000000001e51c in ?? ()
  [infrun] infrun_async: enable=0
  [infrun] reset: reason=handling event
  [infrun] maybe_set_commit_resumed_all_targets: not requesting commit-resumed
for target remote, no resumed threads
(gdb) [infrun] fetch_inferior_event: exit
```

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
                   ` (4 preceding siblings ...)
  2021-12-28 10:47 ` qwertytmp1 at gmail dot com
@ 2021-12-28 16:37 ` qwertytmp1 at gmail dot com
  2022-03-06 17:04 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: qwertytmp1 at gmail dot com @ 2021-12-28 16:37 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from lol lol <qwertytmp1 at gmail dot com> ---
UPD. Probably the problem is in custom GDB server.

It returns "T05watch":

```
[remote] Sending packet: $vCont;s:1;c#c1
[remote] wait: enter
  [remote] Packet received: T05watch:1d;
```

instead of "T05thread":

```
[remote] Sending packet: $vCont;s:1;c#c1
[remote] wait: enter
  [remote] Packet received: T05thread:01;
```

P.S. Sorry for bothering you.
Feel free to close this ticket if you don't find any more issues (within logs).

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

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

* [Bug gdb/28717] GDB steps twice on a single stepi
  2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
                   ` (5 preceding siblings ...)
  2021-12-28 16:37 ` qwertytmp1 at gmail dot com
@ 2022-03-06 17:04 ` tromey at sourceware dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tromey at sourceware dot org @ 2022-03-06 17:04 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #6 from Tom Tromey <tromey at sourceware dot org> ---
It's no problem, I'm glad you seem to have found your problem.
I'm going to close this now.

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

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

end of thread, other threads:[~2022-03-06 17:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 16:20 [Bug gdb/28717] New: GDB steps twice on a single stepi qwertytmp1 at gmail dot com
2021-12-20 19:38 ` [Bug gdb/28717] " simark at simark dot ca
2021-12-21 11:07 ` qwertytmp1 at gmail dot com
2021-12-23 11:43 ` qwertytmp1 at gmail dot com
2021-12-26 18:01 ` tromey at sourceware dot org
2021-12-28 10:47 ` qwertytmp1 at gmail dot com
2021-12-28 16:37 ` qwertytmp1 at gmail dot com
2022-03-06 17:04 ` tromey at sourceware dot 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).