From: Jim Blandy <jimb@codesourcery.com>
To: Emi SUZUKI <emi-suzuki@tjsys.co.jp>
Cc: gdb@sourceware.org
Subject: Re: single-stepping and internal breakpoints on a multi-threaded program
Date: Fri, 06 Apr 2007 22:12:00 -0000 [thread overview]
Message-ID: <m3hcrtw3t6.fsf@codesourcery.com> (raw)
In-Reply-To: <20070405.205731.12335149.emi-suzuki@tjsys.co.jp> (Emi SUZUKI's message of "Thu, 05 Apr 2007 20:57:31 +0900")
Emi SUZUKI <emi-suzuki@tjsys.co.jp> writes:
> The attached program makes two sub threads, and we do single-stepping
> on one of them.
> When the target get stopped by a internal breakpoint hit (ex. thread
> creation, thread death, shared library loading) during singe-stepping,
> GDB unconditionally resume all the thread and it result in running
> over the range of single-stepping.
I'm able to reproduce this problem on my FC6 x86 dual core system.
Thanks very much for the clear reproduction instructions.
> I saw that the context of single-stepping thread is preserved by
> context_switch called in handle_inferior_event, but GDB doesn't go
> back to that context till the thread is trapped in another reason
> (in the above case, the death of the thread).
>
> I think it should either stop immediately and prompt the user that the
> single-stepping has been cancelled, or goes back to the preserved
> context somehow and continue single-stepping.
> How do you think of it?
So, if I'm understanding correctly, we single-step the 'counter'
thread, which proceeds normally until the 'no_counter' thread hits its
TD_CREATE event, to tell GDB about its existence. Then, GDB fails to
resume single-stepping the 'counter' thread, letting it run until it
exits and reports its TD_DEATH event.
The fact that the inferior uses breakpoints to report thread creation
and thread death is supposed to be an internal detail of the thread
library --- or, more properly, of the thread debugging interface. One
thread stepping shouldn't be affected by other threads being created
(although GDB should still print the 'new thread' messages).
So I think the right behavior would be for GDB to continue
single-stepping after processing creation and death events for other
threads.
I have forgetten exactly how GDB handles multi-threaded single
stepping; I'm afraid I can't suggest how to do this. If you're unable
to fix it yourself, please file a bug report, and include your test
program.
next prev parent reply other threads:[~2007-04-06 22:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-05 11:57 Emi SUZUKI
2007-04-06 22:12 ` Jim Blandy [this message]
2007-04-06 22:25 ` Michael Snyder
2007-04-10 8:38 ` Emi SUZUKI
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=m3hcrtw3t6.fsf@codesourcery.com \
--to=jimb@codesourcery.com \
--cc=emi-suzuki@tjsys.co.jp \
--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