* [pushed] gdb: fix thread_step_over_chain_length
@ 2021-08-17 19:27 Simon Marchi
0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2021-08-17 19:27 UTC (permalink / raw)
To: gdb-patches
If I debug a single-thread program and look at the infrun debug logs, I
see:
[infrun] start_step_over: stealing global queue of threads to step, length = 2
That makes no sense... turns out there's a buglet in
thread_step_over_chain_length, "num" should be initialized to 0. I
think this bug is a leftover from an earlier version of the code (not
merged upstream) that manually walked the list, where the first item was
implicitly counted (hence the 1).
Change-Id: I0af03aa93509aed36528be5076894dc156a0b5ce
---
gdb/thread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/thread.c b/gdb/thread.c
index 8f0584e5238e..a82fb49140a3 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -380,7 +380,7 @@ thread_is_in_step_over_chain (struct thread_info *tp)
int
thread_step_over_chain_length (const thread_step_over_list &l)
{
- int num = 1;
+ int num = 0;
for (const thread_info &thread ATTRIBUTE_UNUSED : l)
++num;
--
2.32.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-17 19:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 19:27 [pushed] gdb: fix thread_step_over_chain_length Simon Marchi
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).