From: Tom Tromey <tromey@redhat.com>
To: Josh Watt <jpewdev@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: Thread Specific Breakpoints in Remote Targets
Date: Wed, 31 Aug 2011 14:47:00 -0000 [thread overview]
Message-ID: <m3ippd8wor.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAEPrYjQnadK872r5dXz2-KFBsoXcpBj0CMPc3gcSmtAvcrUBpg@mail.gmail.com> (Josh Watt's message of "Tue, 30 Aug 2011 17:03:02 -0500")
>>>>> "Josh" == Josh Watt <jpewdev@gmail.com> writes:
Josh> As can been seen from the log, the stub is sending a message to
Josh> switch to thread 1040 ($Hg410#44) right before setting the
Josh> breakpoint (and again before deleting it). In subsequent
Josh> operation, it is apparent that it is always switching to this
Josh> thread when setting and clearing a breakpoint.
FWIW I found your note very clear, thanks for the dump and background
info.
Josh> Because of this, our remote stub cannot rely on the currently
Josh> selected thread as the target thread for a given breakpoint and
Josh> must communicate with GDB every time a breakpoint is hit.
I did not understand this though.
It sounds like you are making breakpoints on the target thread-specific
based on the current thread. But I thought we didn't (yet) have a way
to inform the target that a given breakpoint was thread-specific (but I
don't know this area extremely well -- if I'm wrong I'd like to know
about it).
Josh> I looked through some of the code, and I think it is due to the
Josh> following:
Josh> In breakpoint.c there are calls to
Josh> switch_to_program_space_and_thread() at lines 1895 and 2662 which
Josh> must be selecting the wrong thread, but I'm not sure how to make
Josh> it select the correct thread (if it is even supposed to).
I think you are correct. switch_to_program_space_and_thread selects the
first (meaning first in gdb's internal table) live thread of the
first inferior bound to that program space.
I am not sure whether this choice particularly matters to all callers of
switch_to_program_space_and_thread. However, I think it probably does not
matter to callers from breakpoint.c; I think those could safely
short-circuit switching if the current program space is already correct
and if the current thread is live.
This, I think, will fix your immediate problem but I can't claim the
result will really be correct. I think it would be preferable to
implement real target support for thread-specific breakpoints.
Tom
next prev parent reply other threads:[~2011-08-31 14:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-30 22:03 Josh Watt
2011-08-31 14:47 ` Tom Tromey [this message]
2011-08-31 18:09 ` Pedro Alves
2011-08-31 18:30 ` Josh Watt
2011-08-31 18:42 ` Pedro Alves
2011-09-01 15:34 ` Josh Watt
2011-10-05 17:23 ` Tom Tromey
2011-09-01 13:23 ` Raphael Zulliger
2011-09-01 21:35 ` Petr Hluzín
2011-09-01 23:57 ` Pedro Alves
2011-09-02 5:13 ` Raphael Zulliger
2011-09-03 16:00 ` Petr Hluzín
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=m3ippd8wor.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb@sourceware.org \
--cc=jpewdev@gmail.com \
/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