This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Reset trace local state when opening trace file
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 05 Jun 2013 12:04:42 +0100
- Subject: Re: [PATCH 2/2] Reset trace local state when opening trace file
- References: <1369714812-3307-1-git-send-email-yao at codesourcery dot com> <1369714812-3307-2-git-send-email-yao at codesourcery dot com> <51ADD23A dot 1030500 at redhat dot com> <51AED0E4 dot 6040704 at codesourcery dot com>
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