This is the mail archive of the 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] ftrace: Fix gdbserver crash when doing tstatus after detach or process exit

Simon Marchi <> 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
and cmd_qtinit.

> 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


Yao (éå)

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