public inbox for
 help / color / mirror / Atom feed
From: Luis Machado <>
To: "Denio, Mike" <>, "" <>
Subject: Re: Step causes GDB to spin in infinite loop when PC doesn't change
Date: Fri, 18 Mar 2022 17:28:03 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>


On 3/18/22 16:33, Denio, Mike via Gdb wrote:
> 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.

That's what the step/next commands are designed to do. GDB will keep 
stepping until it sees a line change. I suppose a "continue" command 
here would be more appropriate, as GDB will send it once and keep 
waiting for the outcome. stepi/nexti would be undesirable given they 
will stop after a single instruction.

  reply	other threads:[~2022-03-18 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 16:33 Denio, Mike
2022-03-18 17:28 ` Luis Machado [this message]
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] ` <>
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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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).