From: Yao Qi <qiyaoltc@gmail.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] ftrace: Fix gdbserver crash when doing tstatus after detach or process exit
Date: Fri, 29 Apr 2016 12:10:00 -0000 [thread overview]
Message-ID: <86h9ekehu2.fsf@gmail.com> (raw)
In-Reply-To: <1459344024-2260-1-git-send-email-simon.marchi@ericsson.com> (Simon Marchi's message of "Wed, 30 Mar 2016 09:20:24 -0400")
Simon Marchi <simon.marchi@ericsson.com> 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
gdb_load_shlib
--
Yao (齐尧)
next prev parent reply other threads:[~2016-04-29 12:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 13:20 Simon Marchi
2016-04-28 17:04 ` Simon Marchi
2016-04-28 17:28 ` Simon Marchi
2016-04-29 12:10 ` Yao Qi [this message]
2016-04-29 12:46 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86h9ekehu2.fsf@gmail.com \
--to=qiyaoltc@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox