From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by sourceware.org (Postfix) with ESMTPS id 23DBC3947C23 for ; Fri, 18 Mar 2022 16:33:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23DBC3947C23 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 22IGXfPH012217 for ; Fri, 18 Mar 2022 11:33:41 -0500 Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 22IGXf8U043428 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 18 Mar 2022 11:33:41 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 18 Mar 2022 11:33:41 -0500 Received: from DFLE104.ent.ti.com ([fe80::44c:e883:6f6f:384d]) by DFLE104.ent.ti.com ([fe80::44c:e883:6f6f:384d%17]) with mapi id 15.01.2308.014; Fri, 18 Mar 2022 11:33:41 -0500 From: "Denio, Mike" To: "gdb@sourceware.org" Subject: Step causes GDB to spin in infinite loop when PC doesn't change Thread-Topic: Step causes GDB to spin in infinite loop when PC doesn't change Thread-Index: Adg64+qEK1MZI3IVQ7SCusGZE38q3A== Date: Fri, 18 Mar 2022 16:33:40 +0000 Message-ID: <96dc6d3f7ab542368f7ac43abefadf4b@ti.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.249.41.28] x-exclaimer-md-config: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 MIME-Version: 1.0 X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2022 16:33:46 -0000 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, bu= t it seems like a legitimate bug. I am using a custom server. The behavior is the same on both GDB 11.1 and 1= 1.2. This GDB was configured as follows: configure --host=3Dx86_64-pc-linux-gnu --target=3Driscv32-unknown-elf --with-auto-load-dir=3D$debugdir:$datadir/auto-load --with-auto-load-safe-path=3D$debugdir:$datadir/auto-load --with-expat --with-gdb-datadir=3D/usr/local/share/gdb (relocatable) --with-jit-reader-dir=3D/usr/local/lib/gdb (relocatable) --without-libunwind-ia64 --with-lzma --without-babeltrace --without-intel-pt --with-mpfr --without-xxhash --with-python=3D/usr --with-python-libdir=3D/usr/lib --without-debuginfod --without-guile --disable-source-highlight --with-separate-debug-dir=3D/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,en= dz), with the cores basically waiting for an interrupt. If I execute a 'ste= p' 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 i= nfinite 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+;qRel= ocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEven= ts+;no-resumed+;memory-tagging+#ec [remote] Received Ack [remote] Packet received: hwbreak+;vContSupported+;QStartNoAckMode+;QNonS= top+;PacketSize=3D410 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [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: 0000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000004000000 [remote] wait: enter [remote] wait: exit [remote] Sending packet: $vCont;s:2#24 [... and so on ...]