[PATCH v4] gdb: Fix deleted thread when issuing next command

Simon Marchi simon.marchi@polymtl.ca
Fri Jun 25 14:38:28 GMT 2021


On 2021-06-24 11:41 a.m., Aleksandar Paunovic wrote:
> V3 can be found here https://sourceware.org/pipermail/gdb-patches/2021-June/180310.html
> V4 addresses two comments from Simon.
> Changes compared to V3:
> * Removed "WARNING: Timed out waiting for EOF" by doing gdbserver_exit at the end of the test
> * standard_testfile break-while-other-inf-steps-1.c is shortened to standard_testfile -1.c
> 
> Best,
> Aleksandar
> 
> When issuing "next" command the thread got deleted even though it was still
> alive and running.  This happened because the thread was examined under a
> wrong inferior and therefor target_thread_alive was called on the wrong
> target stack.
> 
> The fixed scenario:
> ~~~
> $ gdb -q break-while-other-inf-steps-1-exe
> (gdb) set schedule-multiple off
> (gdb) break break-while-other-inf-steps-1.c:26
> (gdb) run
> (gdb) add-inferior -no-connection
> (gdb) inferior 2
> (gdb) spawn gdbserver :2346 break-while-other-inf-steps-2-exe
> (gdb) target remote :2346
> (gdb) break break-while-other-inf-steps-2.c:26
> (gdb) continue
> (gdb) thread 1.1
> (gdb) clear break-while-other-inf-steps-2.c:26
> (gdb) set schedule-multiple on
> (gdb) next
> (gdb) thread 1.1
> ~~~
> 
> Before:
> ~~~
> Thread ID 1.1 has terminated.
> ~~~
> 
> Now:
> ~~~
> Switching to thread 1.1
> ~~~
> 
> gdb/ChangeLog:
> 2021-04-30  Aleksandar Paunovic  <aleksandar.paunovic@intel.com>
> 
> 	* infrun.c (keep_going_stepped_thread): Switch to correct
> 	inferior and check if thread is executing.
> 
> gdb/testsuite/ChangeLog:
> 2021-04-30  Aleksandar Paunovic  <aleksandar.paunovic@intel.com>
> 
> 	* gdb.multi/break-while-other-inf-steps-1.c: New file.
> 	* gdb.multi/break-while-other-inf-steps-2.c: New file.
> 	* gdb.multi/break-while-other-inf-steps.exp: New file.

Thanks for taking care of the timeout.

Now, I just tried your test without the fix applied, and it still
passes.  So it doesn't seem to catch the problem you are fixing.  If you
do the same, do you see it failing?

Simon


More information about the Gdb-patches mailing list