[PATCH 1/2] gdb: Fix deleted thread when issuing next command
Thiago Jung Bauermann
thiago.bauermann@linaro.org
Thu Aug 25 23:11:54 GMT 2022
Hello Eduard,
Eduard Sargsyan via Gdb-patches <gdb-patches@sourceware.org> writes:
> From: Aleksandar Paunovic <aleksandar.paunovic@intel.com>
>
> 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.
>
> The fixed scenario:
> ~~~
> $ gdb -q breakpoint-running-inferior-1-exe
> (gdb) set schedule-multiple off
> (gdb) break breakpoint-running-inferior-1.c:26
> (gdb) run
> (gdb) add-inferior -no-connection
> (gdb) inferior 2
> (gdb) spawn gdbserver :2346 breakpoint-running-inferior-2-exe
> (gdb) target remote :2346
> (gdb) break breakpoint-running-inferior-2.c:26
> (gdb) continue
> (gdb) thread 1.1
> (gdb) clear breakpoint-running-inferior-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.base/breakpoint-running-inferior-1.c: New file.
> * gdb.base/breakpoint-running-inferior-2.c: New file.
> * gdb.base/breakpoint-running-inferior.exp: New file.
>
> Signed-off-by: Aleksandar Paunovic <aleksandar.paunovic@intel.com>
> ---
> gdb/infrun.c | 2 +
> .../gdb.base/breakpoint-running-inferior-1.c | 39 +++++++++
> .../gdb.base/breakpoint-running-inferior-2.c | 39 +++++++++
> .../gdb.base/breakpoint-running-inferior.exp | 84 +++++++++++++++++++
> 4 files changed, 164 insertions(+)
> create mode 100644 gdb/testsuite/gdb.base/breakpoint-running-inferior-1.c
> create mode 100644 gdb/testsuite/gdb.base/breakpoint-running-inferior-2.c
> create mode 100644 gdb/testsuite/gdb.base/breakpoint-running-inferior.exp
Aleksandar last posted version 4 of this patch, but this email seems to
contain either v1 or v2. Consequently, Simon's review comments aren't
addressed here. Was there a reason to return to the older version?
Also, I applied the patch to a commit from a few days ago which I had
handy (f8bfbd5b751b) and there were some failures when running the test:
=== gdb Summary ===
# of expected passes 10
# of unexpected failures 3
# of duplicate test names 1
Are the tests passing for you?
Interestingly, running the testcase with the infun.c change reverted
produced one less failure:
=== gdb Summary ===
# of expected passes 11
# of unexpected failures 2
# of duplicate test names 1
--
Thiago
More information about the Gdb-patches
mailing list