public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Denio, Mike" <miked@ti.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Issue with multiple threads using remote protocol on riscv32
Date: Wed, 16 Mar 2022 14:45:54 +0000	[thread overview]
Message-ID: <0f242330e5e242dea1957fbab47a6473@ti.com> (raw)

I am seeing an issue with the remote protocol  on GDB with multiple threads on a riscv32 using the continue command. Not sure if it's a bug or just me, but it may be me as I am new to GDB.

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) set *0x10000000=1
(gdb) c -a&

The problem is that the "c -a&" is implemented by a 'vCont;c:1' followed by a 'vCont;c', essentially telling thread 1 to continue twice, causing it to skip over a break.

Am I interpreting the commands incorrectly or am I sending GDB something incorrect that is confusing it?

Thanks,
Mike

---[ Remote Log ]------------------

'+'                     --->
'qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+' --->
                        <--- '+$hwbreak+;vContSupported+;QStartNoAckMode+;QNonStop+;PacketSize=410#e3'
'+'                     --->
'vMustReplyEmpty'       --->
                        <--- '+$#00'
'+'                     --->
'QStartNoAckMode'       --->
                        <--- '+$OK#9a'
'+'                     --->
'!'                     --->
                        <--- '$OK#9a'
'Hg0'                   --->
                        <--- '$OK#9a'
'QNonStop:1'            --->
                        <--- '$OK#9a'
'qfThreadInfo'          --->
                        <--- '$m1,2#fc'
'qsThreadInfo'          --->
                        <--- '$l#6c'
'qAttached'             --->
                        <--- '$1#31'
'qTStatus'              --->
                        <--- '$#00'
'?'                     --->
                        <--- '$OK#9a'
'vCont?'                --->
                        <--- '$vCont;c;C;s;t#83'
'vCont;t:2'             --->
                        <--- '$OK#9a'
                        <--- '%Stop:T00thread:2;#b3'
'qSymbol::'             --->
                        <--- '$OK#9a'
'vStopped'              --->
                        <--- '$OK#9a'
'Hg2'                   --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'
'qOffsets'              --->
                        <--- '$#00'
'qSymbol::'             --->
                        <--- '$OK#9a'
'vCont;c'               --->
                        <--- '$OK#9a'

(gdb) interrupt -a

'vCont;t'               --->
                        <--- '$OK#9a'
                        <--- '%Stop:T00thread:1;#b2'
'vStopped'              --->
                        <--- '$T00thread:2;#d3'
'vStopped'              --->
                        <--- '$OK#9a'
'Hg1'                   --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'
'qfThreadInfo'          --->
                        <--- '$m1,2#fc'
'qsThreadInfo'          --->
                        <--- '$l#6c'
'Hg2'                   --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'
'qfThreadInfo'          --->
                       <--- '$m1,2#fc'
'qsThreadInfo'          --->
                        <--- '$l#6c'

(gdb) set *0x10000000 = 1

'X10000000,0:'          --->
                        <--- '$#00'
'M10000000,4:01000000'  --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'
'Hg1'                   --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'

(gdb) c -a&

'vCont;c:1'             --->
                        <--- '$OK#9a'
                        <--- '%Stop:T05thread:1;#b7' // THIS STOP IS LOST BECAUSE GDB IMMEDIATELY TELLS THREAD 1 TO CONTINUE
'vCont;c'               --->
                        <--- '$OK#9a'
'vStopped'              --->
                        <--- '$OK#9a'
                        <--- '%Stop:T05thread:2;#b8'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000002084000800041000200400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000#a5'
'qfThreadInfo'          --->
                        <--- '$m1,2#fc'
'qsThreadInfo'          --->
                        <--- '$l#6c'
'vStopped'              --->
                        <--- '$OK#9a'
'Hg2'                   --->
                        <--- '$OK#9a'
'g'                     --->
                        <--- '$000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000#80'
'qfThreadInfo'          --->
                        <--- '$m1,2#fc'
'qsThreadInfo'          --->
                        <--- '$l#6c'





             reply	other threads:[~2022-03-16 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 14:45 Denio, Mike [this message]
2022-03-16 14:58 ` Pedro Alves
2022-03-16 15:10   ` [EXTERNAL] " Denio, Mike
2022-03-17 17:52     ` Pedro Alves
2022-03-17 19:11       ` 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=0f242330e5e242dea1957fbab47a6473@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).