This is the mail archive of the gdb-testers@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]

[binutils-gdb] Convert SystemTap probe interface to C++ (and perform some cleanups)


*** TEST RESULTS FOR COMMIT 0e9ae10f5f97824067365af4813b843973297573 ***

Author: Sergio Durigan Junior <sergiodj@redhat.com>
Branch: master
Commit: 0e9ae10f5f97824067365af4813b843973297573

Convert SystemTap probe interface to C++ (and perform some cleanups)

This patch converts the SystemTap probe
interface (gdb/stap-probe.[ch]) to C++, and also performs some
cleanups that were on my TODO list for a while.

The main changes were the conversion of 'struct stap_probe' to 'class
stap_probe', and a new 'class stap_static_probe_ops' to replace the
use of 'stap_probe_ops'.  Both classes implement the virtual methods
exported by their parents, 'class probe' and 'class static_probe_ops',
respectively.  I believe it's now a bit simpler to understand the
logic behind the stap-probe interface.

There are several helper functions used to parse parts of a stap
probe, and since they are generic and don't need to know about the
probe they're working on, I decided to leave them as simple static
functions (instead of e.g. converting them to class methods).

I've also converted a few uses of "VEC" to "std::vector", which makes
the code simpler and easier to maintain.  And, as usual, some cleanups
here and there.

Even though I'm sending a series of patches, they need to be tested
and committed as a single unit, because of inter-dependencies.  But it
should be easier to review in separate logical units.

I've regtested this patch on BuildBot, no regressions found.

gdb/ChangeLog:
2017-11-22  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Simon Marchi  <simark@simark.ca>

	* stap-probe.c (struct probe_ops stap_probe_ops): Delete
	variable.
	(struct stap_probe_arg) <stap_probe_arg>: New constructor.
	<aexpr>: Change type to 'expression_up'.
	(stap_probe_arg_s): Delete type and VEC.
	(struct stap_probe): Delete.  Replace by...
	(class stap_static_probe_ops): ...this and...
	(class stap_probe): ...this.  Rename variables to add 'm_'
	prefix.  Do not use 'union' for arguments anymore.
	(stap_get_expected_argument_type): Receive probe name instead
	of 'struct stap_probe'.  Adjust code.
	(stap_parse_probe_arguments): Rename to...
	(stap_probe::parse_arguments): ...this.  Adjust code to
	reflect change.
	(stap_get_probe_address): Rename to...
	(stap_probe::get_relocated_address): ...this.  Adjust code
	to reflect change.
	(stap_get_probe_argument_count): Rename to...
	(stap_probe::get_argument_count): ...this.  Adjust code
	to reflect change.
	(stap_get_arg): Rename to...
	(stap_probe::get_arg_by_number'): ...this. Adjust code to
	reflect change.
	(can_evaluate_probe_arguments): Rename to...
	(stap_probe::can_evaluate_arguments): ...this.  Adjust code
	to reflect change.
	(stap_evaluate_probe_argument): Rename to...
	(stap_probe::evaluate_argument): ...this.  Adjust code
	to reflect change.
	(stap_compile_to_ax): Rename to...
	(stap_probe::compile_to_ax): ...this.  Adjust code to
	reflect change.
	(stap_probe_destroy): Delete.
	(stap_modify_semaphore): Adjust comment.
	(stap_set_semaphore): Rename to...
	(stap_probe::set_semaphore): ...this.  Adjust code to reflect
	change.
	(stap_clear_semaphore): Rename to...
	(stap_probe::clear_semaphore): ...this.  Adjust code to
	reflect	change.
	(stap_probe::get_static_ops): New method.
	(handle_stap_probe): Adjust code to create instance of
	'stap_probe'.
	(stap_get_probes): Rename to...
	(stap_static_probe_ops::get_probes): ...this.  Adjust code to
	reflect change.
	(stap_probe_is_linespec): Rename to...
	(stap_static_probe_ops::is_linespec): ...this.  Adjust code to
	reflect change.
	(stap_type_name): Rename to...
	(stap_static_probe_ops::type_name): ...this.  Adjust code to
	reflect change.
	(stap_gen_info_probes_table_header): Rename to...
	(stap_static_probe_ops::gen_info_probes_table_header):
	...this.  Adjust code to reflect change.
	(stap_gen_info_probes_table_values): Rename to...
	(stap_probe::gen_info_probes_table_values): ...this.  Adjust
	code to reflect change.
	(struct probe_ops stap_probe_ops): Delete.
	(info_probes_stap_command): Use 'info_probes_for_spops'
	instead of 'info_probes_for_ops'.
	(_initialize_stap_probe): Use 'all_static_probe_ops' instead
	of 'all_probe_ops'.


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