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 3/4] Handle thread-specific breakpoints on remote targets


> From: Simon Marchi <simon.marchi@ericsson.com>
> CC: Simon Marchi <simon.marchi@ericsson.com>
> Date: Tue, 18 Apr 2017 18:13:20 -0400
> 
> This patch lets remote targets evaluate thread-specific breakpoints,
> instead of having to do the round trip to GDB.  It can potentially save
> a lot of RSP messages, which can slow down execution considerably if the
> number of hits by wrong threads is high.
> 
> The implementation is based on the existing target side evaluation of
> condition.  A new "thread_id" agent expression bytecode is introduced and
> used by GDB.  This bytecode tells the target to push the id of the
> current thread on the stack, allowing GDB to craft agent expressions
> comparing the current thread id with a constant (the thread specified by
> breakpoint).  Therefore, remote targets only need to add support for
> this bytecode to take advantage of the feature (and report "AxThreadID+"
> in qSupported).  This patch does that for gdbserver.
> 
> gdb/ChangeLog:
> 
> 	* NEWS: Mention new agent expression bytecode and qSupported
> 	reply.
> 	* ax-gdb.c (gen_thread_id): New function.
> 	(gen_expr): Handle OP_THREAD_ID.
> 	* breakpoint.c (make_thread_id_exp): New function.
> 	(expression_and): New function.
> 	(build_target_condition_list): Create and add thread-id check
> 	expression if the breakpoint is thread-specific.
> 	* common/ax.def (thread_id): New operator.
> 	* remote.c (PACKET_AXThreadId): New enum label.
> 	(remote_protocol_features): Add entry for AXThreadId.
> 	(remote_supports_thread_id_operator): New function.
> 	(init_remote_ops): Assign remote_supports_thread_id_operator
> 	to to_supports_thread_id_operator.
> 	(_initialize_remote): Add packet config command for AXThreadId.
> 	* std-operator.def (OP_THREAD_ID): New operator.
> 	* target-debug.h, target-delegates.c: Re-generate.
> 	* target.h (target_ops) <to_supports_thread_id_operator>: New
> 	field.
> 	(target_supports_thread_id_operator): New macro.
> 
> gdb/gdbserver/ChangeLog:
> 
> 	* ax.c (gdb_eval_agent_expr): Handle thread_id bytecode.
> 	* server.c (handle_query): Send AXThreadId+ in qSupported reply.
> 
> gdb/doc/ChangeLog:
> 
> 	* agentexpr.texi (Bytecode Descriptions): Document thread_id
> 	bytecode.
> 	* gdb.texinfo (General Query Packets): Document AXThreadId in
> 	the qSupported possible replies.

OK for the documentation parts.

Thanks.


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