[2/2] Replace address and aspace with thread in struct step_over_info

Message ID m34mawrwgl.fsf@sspiff.org
State New, archived
Headers

Commit Message

Doug Evans April 20, 2016, 6:01 p.m. UTC
  Yao Qi <qiyaoltc@gmail.com> writes:
> Pedro Alves <palves@redhat.com> writes:
>
>> I think this is problematic.
>>
>> While a thread is being stepped past a breakpoint, it's possible that the
>> user sets some other breakpoint, and then we end up in
>> stepping_past_instruction_at
>> deciding whether we can insert that new breakpoint, while the step-over thread
>> is running.
>>
>> As soon as the step-over thread is resumed for the actual step-over, it's
>> regcache is flushed (target_resume -> registers_changed_ptid).  From that point
>> and until the thread stops again, trying to fetch its regcache will error out,
>> because you can't read registers from a thread that is running.
>
> OK, that is a good case.  I didn't think of it.  I withdraw the patch.

A good place for a comment explaining Why Things Are The Way They Are.

Not sure how you want to word this.

2016-04-20  Doug Evans  <xdje42@gmail.com>

	* infrun.c (set_step_over_info): Add comment.
  

Comments

Pedro Alves April 20, 2016, 6:03 p.m. UTC | #1
On 04/20/2016 07:01 PM, Doug Evans wrote:

> A good place for a comment explaining Why Things Are The Way They Are.
> 
> Not sure how you want to word this.

That looks just fine to me.

Thanks,
Pedro Alves
  
Doug Evans Dec. 22, 2016, 11:51 p.m. UTC | #2
Pedro Alves <palves@redhat.com> writes:
> On 04/20/2016 07:01 PM, Doug Evans wrote:
>
>> A good place for a comment explaining Why Things Are The Way They Are.
>> 
>> Not sure how you want to word this.
>
> That looks just fine to me.

Thanks.
Committed.
  

Patch

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 696105d..c7ea5e2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1325,7 +1325,9 @@  struct step_over_info
 static struct step_over_info step_over_info;
 
 /* Record the address of the breakpoint/instruction we're currently
-   stepping over.  */
+   stepping over.
+   N.B. We record the aspace and address now, instead of say just the thread,
+   because when we need the info later the thread may be running.  */
 
 static void
 set_step_over_info (struct address_space *aspace, CORE_ADDR address,