From: "Denio, Mike" <miked@ti.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Step causes GDB to spin in infinite loop when PC doesn't change
Date: Fri, 18 Mar 2022 16:33:40 +0000 [thread overview]
Message-ID: <96dc6d3f7ab542368f7ac43abefadf4b@ti.com> (raw)
I am seeing an issue with the remote protocol on GDB with multiple threads on a riscv32 using the step command. Not sure if it's a bug or just me, but it seems like a legitimate bug.
I am using a custom server. The behavior is the same on both GDB 11.1 and 11.2.
This GDB was configured as follows:
configure --host=x86_64-pc-linux-gnu --target=riscv32-unknown-elf
--with-auto-load-dir=$debugdir:$datadir/auto-load
--with-auto-load-safe-path=$debugdir:$datadir/auto-load
--with-expat
--with-gdb-datadir=/usr/local/share/gdb (relocatable)
--with-jit-reader-dir=/usr/local/lib/gdb (relocatable)
--without-libunwind-ia64
--with-lzma
--without-babeltrace
--without-intel-pt
--with-mpfr
--without-xxhash
--with-python=/usr
--with-python-libdir=/usr/lib
--without-debuginfod
--without-guile
--disable-source-highlight
--with-separate-debug-dir=/usr/local/lib/debug (relocatable)
I am running in non-stop mode. A full log of the test is at the end of the email. The GDB commands I execute after connecting are:
(gdb) interrupt -a
(gdb) s
The problem is that my code starts off in an infinite loop (endz: jal x0,endz), with the cores basically waiting for an interrupt. If I execute a 'step' command, GDB will basically keep sending "vCont;s:2" in an infinite loop, until the PC addr of thread 2 changes. It also occurs if I fall into an infinite loop while stepping. It doesn't need to be the first instruction.
Thanks,
Mike
---[ Remote Log ]------------------
(gdb) tar ext :9999
Remote debugging using :9999
[remote] start_remote: enter
[remote] Sending packet: $qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec
[remote] Received Ack
[remote] Packet received: hwbreak+;vContSupported+;QStartNoAckMode+;QNonStop+;PacketSize=410
[remote] packet_ok: Packet qSupported (supported-packets) is supported
[remote] Sending packet: $vMustReplyEmpty#3a
[remote] Received Ack
[remote] Packet received:
[remote] Sending packet: $QStartNoAckMode#b0
[remote] Received Ack
[remote] Packet received: OK
[remote] Sending packet: $!#21
[remote] Packet received: OK
[remote] Sending packet: $Hg0#df
[remote] Packet received: OK
[remote] Sending packet: $QNonStop:1#8d
[remote] Packet received: OK
[remote] Sending packet: $qfThreadInfo#bb
[remote] Packet received: m1,2
[remote] Sending packet: $qsThreadInfo#c8
[remote] Packet received: l
[remote] Sending packet: $qAttached#8f
[remote] Packet received: 1
[remote] packet_ok: Packet qAttached (query-attached) is supported
[remote] Sending packet: $qTStatus#49
[remote] Packet received:
[remote] packet_ok: Packet qTStatus (trace-status) is NOT supported
[remote] Sending packet: $?#3f
[remote] Packet received: OK
[remote] stop: enter
[remote] Sending packet: $vCont?#49
[remote] Packet received: vCont;c;C;s;t
[remote] packet_ok: Packet vCont (verbose-resume) is supported
[remote] Sending packet: $vCont;t:2#25
[remote] Packet received: OK
[remote] stop: exit
[remote] Sending packet: $qSymbol::#5b
[remote] Notification received: Stop:T00thread:2;
[remote] Packet received: OK
[remote] packet_ok: Packet qSymbol (symbol-lookup) is supported
[remote] start_remote: exit
(gdb) [remote] wait: enter
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $Hg2#e1
[remote] Packet received: OK
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] Sending packet: $qOffsets#4b
[remote] Packet received:
[remote] Sending packet: $qSymbol::#5b
[remote] Packet received: OK
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $vCont;c#a8
[remote] Packet received: OK
[remote] wait: enter
[remote] wait: exit
interrupt -a
[remote] stop: enter
[remote] Sending packet: $vCont;t#b9
[remote] Packet received: OK
[remote] stop: exit
(gdb) [remote] wait: enter
[remote] Notification received: Stop:T00thread:1;
[remote] Sending packet: $vStopped#55
[remote] Packet received: T00thread:2;
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $Hg1#e0
[remote] Packet received: OK
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] Sending packet: $qfThreadInfo#bb
[remote] Packet received: m1,2
[remote] Sending packet: $qsThreadInfo#c8
[remote] Packet received: l
Thread 1 stopped.
endz () at r5_tests/smoke/boot.S:8
8 endz: jal x0,endz
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $Hg2#e1
[remote] Packet received: OK
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] Sending packet: $qfThreadInfo#bb
[remote] Packet received: m1,2
[remote] Sending packet: $qsThreadInfo#c8
[remote] Packet received: l
Thread 2 stopped.
endz () at r5_tests/smoke/boot.S:8
8 endz: jal x0,endz
[remote] wait: enter
[remote] wait: exit
s
[remote] Sending packet: $vCont;s:2#24
[remote] Packet received: OK
[remote] wait: enter
[remote] Notification received: Stop:T05thread:2;
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $vCont;s:2#24
[remote] Packet received: OK
[remote] wait: enter
[remote] wait: exit
[remote] wait: enter
[remote] Notification received: Stop:T05thread:2;
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $vCont;s:2#24
[remote] Packet received: OK
[remote] wait: enter
[remote] wait: exit
[remote] wait: enter
[remote] Notification received: Stop:T05thread:2;
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $vCont;s:2#24
[remote] Packet received: OK
[remote] wait: enter
[remote] wait: exit
[remote] wait: enter
[remote] Notification received: Stop:T05thread:2;
[remote] Sending packet: $vStopped#55
[remote] Packet received: OK
[remote] wait: exit
[remote] Sending packet: $g#67
[remote] Packet received: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000
[remote] wait: enter
[remote] wait: exit
[remote] Sending packet: $vCont;s:2#24
[... and so on ...]
next reply other threads:[~2022-03-18 16:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 16:33 Denio, Mike [this message]
2022-03-18 17:28 ` Luis Machado
2022-03-18 17:33 Denio, Mike
2022-03-18 17:46 ` Luis Machado
2022-03-18 17:57 Denio, Mike
2022-03-18 18:39 ` Pedro Alves
[not found] ` <928a31c6f548411084f4a30dff48e1fe@ti.com>
2022-03-18 20:57 ` Denio, Mike
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96dc6d3f7ab542368f7ac43abefadf4b@ti.com \
--to=miked@ti.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).