This is the mail archive of the
mailing list for the GDB project.
Re: [PATCH] ftrace: Fix gdbserver crash when doing tstatus after detach or process exit
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Simon Marchi <simon dot marchi at ericsson dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Fri, 29 Apr 2016 13:10:29 +0100
- Subject: Re: [PATCH] ftrace: Fix gdbserver crash when doing tstatus after detach or process exit
- Authentication-results: sourceware.org; auth=none
- References: <1459344024-2260-1-git-send-email-simon dot marchi at ericsson dot com>
Simon Marchi <firstname.lastname@example.org> writes:
> A first solution that comes to mind is to make agent_loaded_p check if
> current_thread is NULL, and return false if that's the case. It would
> make sense, since if there is no current thread, the agent can't
> possibly be loaded. However, that would require adding some
> #ifdef GDBSERVER to the common code, which is not acceptable.
> An alternative would be to use
> current_thread != NULL && agent_loaded_p ()
> wherever agent_loaded_p () is used. However, I find it error prone
> for future uses of agent_loaded_p (), since it would be easy to forget
> to check for current_thread.
> Instead, the solution I chose is to clear the
> all_agent_symbols_looked_up flag whenever we have no more current thread
> (process exit or detach). I am not 100% sure it's correct, as there
> might be valid situations I don't know about where the agent is loaded
> but current_thread == NULL, so please correct me if I'm wrong.
Alternatively, we can check (current_thread == NULL) in every cmd_q*
functions in traceppoint.c, since we've done so in cmd_qtminftpilen
> Finally, as a side-note, and just to make sure I understand correctly:
> since there is a single global all_agent_symbols_looked_up flag, I guess
> the tracking of whether the agent is loaded is not expected to work
> correctly in a multi-process scenario, is that right? If there are two
> processes under gdbserver, there could be one with and one without the
> agent. So ideally (as it would be more "right" than the current patch),
> I suppose we should track this per-process?
I don't think multi-process tracepoint and fast tracepoint is supported.
> +# Compile the test case with the in-process agent library.
> +set libipa [get_in_proc_agent]
> +gdb_load_shlibs $libipa