This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2] Reset trace local state when opening trace file


On 06/05/2013 06:47 AM, Yao Qi wrote:
> On 06/04/2013 07:40 PM, Pedro Alves wrote:
>> I was going to suggest fixing somewhere along target_preopen/target_pre_inferior,
>> but then the stale trace state may even interfere with the exec target,
>> (what we get at the top of the stack when we drop from remote/tfile/ctf).
>>
>> So, instead, how about we fix this in remote_close/tfile_close/ctf_close ?
>>
>> Haven't tried it, but it should fix the above case as well.
>>
>
> Pedro,
> I can reproduce it in your example, and in the new patch, I call
> trace_reset_local_state in remote_close/tfile_close/ctf_close.  The
> problem is fixed.

Thanks.  One more thing.  Sorry for not mentioning it before.

>
> +/* Reset local state of tracing.  */
> +
> +void
> +trace_reset_local_state (void)
> +{
> +  set_traceframe_num (-1);
> +  set_tracepoint_num (-1);
> +  set_traceframe_context (NULL);
> +  clear_traceframe_info ();
> +}
>  


This is really doing what the existing:

/* This function handles the details of what to do about an ongoing
   tracing run if the user has asked to detach or otherwise disconnect
   from the target.  */

void
disconnect_tracing (void)
{
  /* Also we want to be out of tfind mode, otherwise things can get
     confusing upon reconnection.  Just use these calls instead of
     full tfind_1 behavior because we're in the middle of detaching,
     and there's no point to updating current stack frame etc.  */
  set_current_traceframe (-1);
  set_tracepoint_num (-1);
  set_traceframe_context (NULL);
}

is supposed to do, though disconnect_tracing seems to miss doing a
couple things the new function does.  I think they should be merged.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]