binutils-gdb/gdb/probe.c

940 lines
26 KiB
C
Raw Normal View History

2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* Generic static probe support for GDB.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "probe.h"
#include "command.h"
#include "cli/cli-cmds.h"
#include "cli/cli-utils.h"
#include "objfiles.h"
#include "symtab.h"
#include "progspace.h"
#include "filenames.h"
#include "linespec.h"
#include "gdb_regex.h"
#include "frame.h"
#include "arch-utils.h"
#include "value.h"
#include "ax.h"
#include "ax-gdb.h"
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
#include "location.h"
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
#include <ctype.h>
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
#include <algorithm>
Rename common to gdbsupport This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/gdb_optional.h"
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* Class that implements the static probe methods for "any" probe. */
class any_static_probe_ops : public static_probe_ops
{
public:
/* See probe.h. */
bool is_linespec (const char **linespecp) const override;
/* See probe.h. */
void get_probes (std::vector<std::unique_ptr<probe>> *probesp,
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
struct objfile *objfile) const override;
/* See probe.h. */
const char *type_name () const override;
/* See probe.h. */
std::vector<struct info_probe_column> gen_info_probes_table_header
() const override;
};
/* Static operations associated with a generic probe. */
const any_static_probe_ops any_static_probe_ops {};
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
/* A helper for parse_probes that decodes a probe specification in
SEARCH_PSPACE. It appends matching SALs to RESULT. */
static void
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
parse_probes_in_pspace (const static_probe_ops *spops,
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
struct program_space *search_pspace,
const char *objfile_namestr,
const char *provider,
const char *name,
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line> *result)
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
{
Change all_objfiles adapter to be a method on program_space This changes the all_objfiles range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-17 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_range>: New typedef. <objfiles>: New method. <objfiles_head>: Rename from objfiles. (object_files): Update. * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Update. * guile/scm-objfile.c (gdbscm_objfiles): Update. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Update. * python/py-progspace.c (pspy_get_objfiles): Update. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Update. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Update. * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_objfile_from_block) (lookup_static_symbol, basic_lookup_transparent_type) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list, find_main_name): Update. * symmisc.c (print_symbol_bcache_statistics) (print_objfile_statistics, maintenance_print_symbols) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs) (maintenance_expand_symtabs, maintenance_info_line_tables): Update. * symfile.c (remove_symbol_file_command, overlay_invalidate_all) (find_pc_overlay, find_pc_mapped_section, list_overlays_command) (map_overlay_command, unmap_overlay_command) (simple_overlay_update, expand_symtabs_matching) (map_symbol_filenames): Update. * symfile-debug.c (set_debug_symfile): Update. * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): Update. * source.c (select_source_symtab, forget_cached_source_info): Update. * solib.c (solib_read_symbols): Update. * solib-spu.c (append_ocl_sos): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. * printcmd.c (info_symbol_command): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Update. * objfiles.h (class all_objfiles): Remove. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp, update_section_map) (shared_objfile_contains_address_p) (default_iterate_over_objfiles_in_search_order): Update. * objc-lang.c (info_selectors_command, info_classes_command) (find_methods): Update. * minsyms.c (find_solib_trampoline_target): Update. * maint.c (maintenance_info_sections) (maintenance_translate_address, count_symtabs_and_blocks): Update. * main.c (captured_main_1): Update. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Update. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Update. * jit.c (jit_find_objf_with_entry_addr): Update. * hppa-tdep.c (find_unwind_entry) (hppa_lookup_stub_minimal_symbol): Update. * gcore.c (gcore_create_callback, objfile_find_memory_regions): Update. * elfread.c (elf_gnu_ifunc_resolve_by_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2-frame.c (dwarf2_frame_find_fde): Update. * dwarf-index-write.c (save_gdb_index_command): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * blockframe.c (find_pc_partial_function): Update. * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update.
2019-01-16 00:55:05 +01:00
for (objfile *objfile : search_pspace->objfiles ())
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
{
if (!objfile->sf || !objfile->sf->sym_probe_fns)
continue;
if (objfile_namestr
&& FILENAME_CMP (objfile_name (objfile), objfile_namestr) != 0
&& FILENAME_CMP (lbasename (objfile_name (objfile)),
objfile_namestr) != 0)
continue;
const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
for (auto &p : probes)
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (spops != &any_static_probe_ops && p->get_static_ops () != spops)
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
continue;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (provider != NULL && p->get_provider () != provider)
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
continue;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (p->get_name () != name)
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
continue;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
symtab_and_line sal;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
sal.pc = p->get_relocated_address (objfile);
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal.explicit_pc = 1;
sal.section = find_pc_overlay (sal.pc);
sal.pspace = search_pspace;
sal.prob = p.get ();
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal.objfile = objfile;
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
result->push_back (std::move (sal));
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
}
}
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* See definition in probe.h. */
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line>
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
parse_probes (const struct event_location *location,
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
struct program_space *search_pspace,
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
struct linespec_result *canonical)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
char *arg_end, *arg;
char *objfile_namestr = NULL, *provider = NULL, *name, *p;
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
const char *arg_start, *cs;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
gdb_assert (event_location_type (location) == PROBE_LOCATION);
arg_start = get_probe_location (location);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
cs = arg_start;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const static_probe_ops *spops = probe_linespec_to_static_ops (&cs);
if (spops == NULL)
error (_("'%s' is not a probe linespec"), arg_start);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
arg = (char *) cs;
arg = skip_spaces (arg);
if (!*arg)
error (_("argument to `%s' missing"), arg_start);
arg_end = skip_to_space (arg);
/* We make a copy here so we can write over parts with impunity. */
std::string copy (arg, arg_end - arg);
arg = &copy[0];
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* Extract each word from the argument, separated by ":"s. */
p = strchr (arg, ':');
if (p == NULL)
{
/* This is `-p name'. */
name = arg;
}
else
{
char *hold = p + 1;
*p = '\0';
p = strchr (hold, ':');
if (p == NULL)
{
/* This is `-p provider:name'. */
provider = arg;
name = hold;
}
else
{
/* This is `-p objfile:provider:name'. */
*p = '\0';
objfile_namestr = arg;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
provider = hold;
name = p + 1;
}
}
if (*name == '\0')
error (_("no probe name specified"));
if (provider && *provider == '\0')
error (_("invalid provider name"));
if (objfile_namestr && *objfile_namestr == '\0')
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
error (_("invalid objfile name"));
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line> result;
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
if (search_pspace != NULL)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
parse_probes_in_pspace (spops, search_pspace, objfile_namestr,
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
provider, name, &result);
}
else
{
struct program_space *pspace;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
ALL_PSPACES (pspace)
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
parse_probes_in_pspace (spops, pspace, objfile_namestr,
Limit breakpoint re-set to the current program space Currently, we always re-set all locations of all breakpoints. This commit makes us re-set only locations of the current program space. If we loaded symbols to a program space (e.g., "file" command or some shared library was loaded), GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. However, there's no reason to recreate locations for _other_ program spaces, as those haven't changed. Similarly, when we create a new inferior, through e.g., a fork, GDB must run through all breakpoints and determine if any new locations need to be added to the breakpoint. There's no reason to destroy the locations of the parent inferior and other inferiors. We know those won't change. In addition to being inneficient, resetting breakpoints of inferiors that are currently running is problematic, because: - some targets can't read memory while the inferior is running. - the inferior might exit while we're re-setting its breakpoints, which may confuse prologue skipping. I went through all the places where we call breakpoint_re_set, and it seems to me that all can be changed to only re-set locations of the current program space. The patch that reversed threads order in "info threads" etc. happened to make gdb.threads/fork-plus-thread.exp expose this problem when testing on x86/-m32. The problem was latent and masked out by chance by the code-cache: https://sourceware.org/ml/gdb-patches/2016-01/msg00213.html Tested on x86-64 F20, native (-m64/-m32) and extended-remote gdbserver. Fixes the regression discussed in the url above with --target_board=unix/-m32: -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout) -FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited) +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left +PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left gdb/ChangeLog: 2016-01-19 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Adjust call to decode_line_full. * break-catch-throw.c (re_set_exception_catchpoint): Pass the current program space down to linespec decoding and breakpoint location updating. * breakpoint.c (parse_breakpoint_sals): Adjust calls to decode_line_full. (until_break_command): Adjust calls to decode_line_1. (base_breakpoint_decode_location, bkpt_decode_location): Add 'search_pspace' parameter. Pass it along. (bkpt_probe_create_sals_from_location): Adjust calls to parse_probes. (tracepoint_decode_location, tracepoint_probe_decode_location) (strace_marker_decode_location): Add 'search_pspace' parameter. Pass it along. (all_locations_are_pending): Rewrite to take a breakpoint and program space as arguments instead. (hoist_existing_locations): New function. (update_breakpoint_locations): Add 'filter_pspace' parameter. Use hoist_existing_locations instead of always removing all locations, and adjust to all_locations_are_pending change. (location_to_sals): Add 'search_pspace' parameter. Pass it along. Don't disable the breakpoint if there are other locations in another program space. (breakpoint_re_set_default): Adjust to pass down the current program space as filter program space. (decode_location_default): Add 'search_pspace' parameter and pass it along. (prepare_re_set_context): Don't switch program space here. (breakpoint_re_set): Use save_current_space_and_thread instead of save_current_program_space. * breakpoint.h (struct breakpoint_ops) <decode_location>: Add 'search_pspace' parameter. (update_breakpoint_locations): Add 'filter_pspace' parameter. * cli/cli-cmds.c (edit_command, list_command): Adjust calls to decode_line_1. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Pass the current program space as filter program space. * linespec.c (struct linespec_state) <search_pspace>: New field. (create_sals_line_offset, convert_explicit_location_to_sals) (parse_linespec): Pass the search program space down. (linespec_state_constructor): Add 'search_pspace' parameter. Store it. (linespec_parser_new): Add 'search_pspace' parameter and pass it along. (linespec_lex_to_end): Adjust. (decode_line_full, decode_line_1): Add 'search_pspace' parameter and pass it along. (decode_line_with_last_displayed): Adjust. (collect_symtabs_from_filename, symtabs_from_filename): New 'search_pspace' parameter. Use it. (find_function_symbols): Pass the search program space down. * linespec.h (decode_line_1, decode_line_full): Add 'search_pspace' parameter. * probe.c (parse_probes_in_pspace): New function, factored out from ... (parse_probes): ... this. Add 'search_pspace' parameter and use it. * probe.h (parse_probes): Add pspace' parameter. * python/python.c (gdbpy_decode_line): Adjust. * tracepoint.c (scope_info): Adjust.
2016-01-19 13:18:14 +01:00
provider, name, &result);
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
if (result.empty ())
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
throw_error (NOT_FOUND_ERROR,
_("No probe matching objfile=`%s', provider=`%s', name=`%s'"),
objfile_namestr ? objfile_namestr : _("<any>"),
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
provider ? provider : _("<any>"),
name);
}
if (canonical)
{
std::string canon (arg_start, arg_end - arg_start);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
canonical->special_display = 1;
canonical->pre_expanded = 1;
canonical->location = new_probe_location (canon.c_str ());
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
return result;
}
/* See definition in probe.h. */
std::vector<probe *>
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
find_probes_in_objfile (struct objfile *objfile, const char *provider,
const char *name)
{
std::vector<probe *> result;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
if (!objfile->sf || !objfile->sf->sym_probe_fns)
return result;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
for (auto &p : probes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (p->get_provider () != provider)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (p->get_name () != name)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
result.push_back (p.get ());
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
return result;
}
/* See definition in probe.h. */
change probes to be program-space-independent This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
2013-12-02 21:58:59 +01:00
struct bound_probe
2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com> * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. (elf_compile_to_ax): Likewise. * infrun.c (insert_exception_resume_from_probe): Likewise. (check_exception_resume): Remove `objfile' variable. * probe.c (find_probe_by_pc): Remove `objfile' argument. (struct probe_and_objfile, probe_and_objfile_s): Delete. (collect_probes): Adjust return value to `VEC (probe_p) *'. (compare_entries): Rename to... (compare_probes): ...this. Adjust function to work with `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' respectively. (gen_ui_out_table_header_info): Adjust `probes' argument to be `VEC (probe_p) *'. (print_ui_out_info): Adjust argument to be `struct probe *'. (info_probes_for_ops): Adjust internal computations to use `VEC (probe_p) *'. (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax, gen_info_probes_table_values>: Remove `objfile' argument. (struct probe) <objfile>: New field. (find_probe_by_pc): Remove `objfile' argument. * stap-probe.c (stap_parse_probe_arguments): Likewise. (stap_get_probe_argument_count): Likewise. (stap_get_arg): Likewise. (stap_evaluate_probe_argument): Likewise. (stap_compile_to_ax): Likewise. (compile_probe_arg): Refactor not to pass `objfile' anymore. (handle_stap_probe): Fill `objfile' field from `struct probe'. (stap_gen_info_probes_table_header): Remove `objfile' argument. * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument, sym_compile_to_ax>: Likewise.
2012-07-18 18:12:17 +02:00
find_probe_by_pc (CORE_ADDR pc)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
change probes to be program-space-independent This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
2013-12-02 21:58:59 +01:00
struct bound_probe result;
result.objfile = NULL;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
result.prob = NULL;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Change all_objfiles adapter to be a method on program_space This changes the all_objfiles range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-17 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_range>: New typedef. <objfiles>: New method. <objfiles_head>: Rename from objfiles. (object_files): Update. * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Update. * guile/scm-objfile.c (gdbscm_objfiles): Update. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Update. * python/py-progspace.c (pspy_get_objfiles): Update. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Update. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Update. * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_objfile_from_block) (lookup_static_symbol, basic_lookup_transparent_type) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list, find_main_name): Update. * symmisc.c (print_symbol_bcache_statistics) (print_objfile_statistics, maintenance_print_symbols) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs) (maintenance_expand_symtabs, maintenance_info_line_tables): Update. * symfile.c (remove_symbol_file_command, overlay_invalidate_all) (find_pc_overlay, find_pc_mapped_section, list_overlays_command) (map_overlay_command, unmap_overlay_command) (simple_overlay_update, expand_symtabs_matching) (map_symbol_filenames): Update. * symfile-debug.c (set_debug_symfile): Update. * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): Update. * source.c (select_source_symtab, forget_cached_source_info): Update. * solib.c (solib_read_symbols): Update. * solib-spu.c (append_ocl_sos): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. * printcmd.c (info_symbol_command): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Update. * objfiles.h (class all_objfiles): Remove. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp, update_section_map) (shared_objfile_contains_address_p) (default_iterate_over_objfiles_in_search_order): Update. * objc-lang.c (info_selectors_command, info_classes_command) (find_methods): Update. * minsyms.c (find_solib_trampoline_target): Update. * maint.c (maintenance_info_sections) (maintenance_translate_address, count_symtabs_and_blocks): Update. * main.c (captured_main_1): Update. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Update. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Update. * jit.c (jit_find_objf_with_entry_addr): Update. * hppa-tdep.c (find_unwind_entry) (hppa_lookup_stub_minimal_symbol): Update. * gcore.c (gcore_create_callback, objfile_find_memory_regions): Update. * elfread.c (elf_gnu_ifunc_resolve_by_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2-frame.c (dwarf2_frame_find_fde): Update. * dwarf-index-write.c (save_gdb_index_command): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * blockframe.c (find_pc_partial_function): Update. * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update.
2019-01-16 00:55:05 +01:00
for (objfile *objfile : current_program_space->objfiles ())
Remove most uses of ALL_OBJFILES This removes most uses of ALL_OBJFILES, replacing them with ranged for loops. The remaining uses are all in macros, and will be removed in subsequent patches. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_static_symbol) (basic_lookup_transparent_type, find_pc_sect_compunit_symtab) (find_symbol_at_address, find_line_symtab, find_main_name): Use all_objfiles. * probe.c (find_probe_by_pc, collect_probes): Use all_objfiles. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Use all_objfiles. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Use all_objfiles. * ada-lang.c (add_nonlocal_symbols): Use all_objfiles. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Use all_objfiles. * maint.c (maintenance_info_sections): Use all_objfiles. * main.c (captured_main_1): Use all_objfiles. * spu-tdep.c (spu_objfile_from_frame): Use all_objfiles. * guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Use all_objfiles. * solib-spu.c (append_ocl_sos): Use all_objfiles. * symmisc.c (maintenance_print_symbols): Use all_objfiles. (maintenance_print_msymbols): Use all_objfiles. * source.c (select_source_symtab): Use all_objfiles. * jit.c (jit_find_objf_with_entry_addr): Use all_objfiles. * symfile.c (remove_symbol_file_command) (expand_symtabs_matching, map_symbol_filenames): Use all_objfiles. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use all_objfiles. * dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles. * objc-lang.c (find_methods): Use all_objfiles. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp) (default_iterate_over_objfiles_in_search_order): Use all_objfiles. * hppa-tdep.c (find_unwind_entry): Use all_objfiles. * psymtab.c (maintenance_print_psymbols): Use all_objfiles. (maintenance_check_psymtabs): Use all_objfiles. (ALL_PSYMTABS): Remove. * compile/compile-object-run.c (do_module_cleanup): Use all_objfiles. * blockframe.c (find_pc_partial_function): Use all_objfiles. * cp-support.c (add_symbol_overload_list_qualified): Use all_objfiles. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Use all_objfiles. * dwarf-index-write.c (save_gdb_index_command): Use all_objfiles. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use all_objfiles. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Use all_objfiles. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Uses all_objfiles. * solib.c (solib_read_symbols): Use all_objfiles
2018-11-23 20:20:05 +01:00
{
if (!objfile->sf || !objfile->sf->sym_probe_fns
|| objfile->sect_index_text == -1)
continue;
/* If this proves too inefficient, we can replace with a hash. */
const std::vector<std::unique_ptr<probe>> &probes
Remove most uses of ALL_OBJFILES This removes most uses of ALL_OBJFILES, replacing them with ranged for loops. The remaining uses are all in macros, and will be removed in subsequent patches. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_static_symbol) (basic_lookup_transparent_type, find_pc_sect_compunit_symtab) (find_symbol_at_address, find_line_symtab, find_main_name): Use all_objfiles. * probe.c (find_probe_by_pc, collect_probes): Use all_objfiles. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Use all_objfiles. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Use all_objfiles. * ada-lang.c (add_nonlocal_symbols): Use all_objfiles. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Use all_objfiles. * maint.c (maintenance_info_sections): Use all_objfiles. * main.c (captured_main_1): Use all_objfiles. * spu-tdep.c (spu_objfile_from_frame): Use all_objfiles. * guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Use all_objfiles. * solib-spu.c (append_ocl_sos): Use all_objfiles. * symmisc.c (maintenance_print_symbols): Use all_objfiles. (maintenance_print_msymbols): Use all_objfiles. * source.c (select_source_symtab): Use all_objfiles. * jit.c (jit_find_objf_with_entry_addr): Use all_objfiles. * symfile.c (remove_symbol_file_command) (expand_symtabs_matching, map_symbol_filenames): Use all_objfiles. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use all_objfiles. * dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles. * objc-lang.c (find_methods): Use all_objfiles. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp) (default_iterate_over_objfiles_in_search_order): Use all_objfiles. * hppa-tdep.c (find_unwind_entry): Use all_objfiles. * psymtab.c (maintenance_print_psymbols): Use all_objfiles. (maintenance_check_psymtabs): Use all_objfiles. (ALL_PSYMTABS): Remove. * compile/compile-object-run.c (do_module_cleanup): Use all_objfiles. * blockframe.c (find_pc_partial_function): Use all_objfiles. * cp-support.c (add_symbol_overload_list_qualified): Use all_objfiles. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Use all_objfiles. * dwarf-index-write.c (save_gdb_index_command): Use all_objfiles. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use all_objfiles. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Use all_objfiles. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Uses all_objfiles. * solib.c (solib_read_symbols): Use all_objfiles
2018-11-23 20:20:05 +01:00
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
for (auto &p : probes)
Remove most uses of ALL_OBJFILES This removes most uses of ALL_OBJFILES, replacing them with ranged for loops. The remaining uses are all in macros, and will be removed in subsequent patches. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_static_symbol) (basic_lookup_transparent_type, find_pc_sect_compunit_symtab) (find_symbol_at_address, find_line_symtab, find_main_name): Use all_objfiles. * probe.c (find_probe_by_pc, collect_probes): Use all_objfiles. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Use all_objfiles. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Use all_objfiles. * ada-lang.c (add_nonlocal_symbols): Use all_objfiles. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Use all_objfiles. * maint.c (maintenance_info_sections): Use all_objfiles. * main.c (captured_main_1): Use all_objfiles. * spu-tdep.c (spu_objfile_from_frame): Use all_objfiles. * guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Use all_objfiles. * solib-spu.c (append_ocl_sos): Use all_objfiles. * symmisc.c (maintenance_print_symbols): Use all_objfiles. (maintenance_print_msymbols): Use all_objfiles. * source.c (select_source_symtab): Use all_objfiles. * jit.c (jit_find_objf_with_entry_addr): Use all_objfiles. * symfile.c (remove_symbol_file_command) (expand_symtabs_matching, map_symbol_filenames): Use all_objfiles. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use all_objfiles. * dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles. * objc-lang.c (find_methods): Use all_objfiles. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp) (default_iterate_over_objfiles_in_search_order): Use all_objfiles. * hppa-tdep.c (find_unwind_entry): Use all_objfiles. * psymtab.c (maintenance_print_psymbols): Use all_objfiles. (maintenance_check_psymtabs): Use all_objfiles. (ALL_PSYMTABS): Remove. * compile/compile-object-run.c (do_module_cleanup): Use all_objfiles. * blockframe.c (find_pc_partial_function): Use all_objfiles. * cp-support.c (add_symbol_overload_list_qualified): Use all_objfiles. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Use all_objfiles. * dwarf-index-write.c (save_gdb_index_command): Use all_objfiles. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use all_objfiles. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Use all_objfiles. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Uses all_objfiles. * solib.c (solib_read_symbols): Use all_objfiles
2018-11-23 20:20:05 +01:00
if (p->get_relocated_address (objfile) == pc)
{
result.objfile = objfile;
result.prob = p.get ();
Remove most uses of ALL_OBJFILES This removes most uses of ALL_OBJFILES, replacing them with ranged for loops. The remaining uses are all in macros, and will be removed in subsequent patches. gdb/ChangeLog 2019-01-09 Tom Tromey <tom@tromey.com> * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_static_symbol) (basic_lookup_transparent_type, find_pc_sect_compunit_symtab) (find_symbol_at_address, find_line_symtab, find_main_name): Use all_objfiles. * probe.c (find_probe_by_pc, collect_probes): Use all_objfiles. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Use all_objfiles. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Use all_objfiles. * ada-lang.c (add_nonlocal_symbols): Use all_objfiles. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Use all_objfiles. * maint.c (maintenance_info_sections): Use all_objfiles. * main.c (captured_main_1): Use all_objfiles. * spu-tdep.c (spu_objfile_from_frame): Use all_objfiles. * guile/scm-objfile.c (gdbscm_objfiles): Use all_objfiles. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Use all_objfiles. * solib-spu.c (append_ocl_sos): Use all_objfiles. * symmisc.c (maintenance_print_symbols): Use all_objfiles. (maintenance_print_msymbols): Use all_objfiles. * source.c (select_source_symtab): Use all_objfiles. * jit.c (jit_find_objf_with_entry_addr): Use all_objfiles. * symfile.c (remove_symbol_file_command) (expand_symtabs_matching, map_symbol_filenames): Use all_objfiles. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Use all_objfiles. * dwarf2-frame.c (dwarf2_frame_find_fde): Use all_objfiles. * objc-lang.c (find_methods): Use all_objfiles. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp) (default_iterate_over_objfiles_in_search_order): Use all_objfiles. * hppa-tdep.c (find_unwind_entry): Use all_objfiles. * psymtab.c (maintenance_print_psymbols): Use all_objfiles. (maintenance_check_psymtabs): Use all_objfiles. (ALL_PSYMTABS): Remove. * compile/compile-object-run.c (do_module_cleanup): Use all_objfiles. * blockframe.c (find_pc_partial_function): Use all_objfiles. * cp-support.c (add_symbol_overload_list_qualified): Use all_objfiles. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Use all_objfiles. * dwarf-index-write.c (save_gdb_index_command): Use all_objfiles. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Use all_objfiles. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Use all_objfiles. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Uses all_objfiles. * solib.c (solib_read_symbols): Use all_objfiles
2018-11-23 20:20:05 +01:00
return result;
}
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
change probes to be program-space-independent This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
2013-12-02 21:58:59 +01:00
return result;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
/* Make a vector of probes matching OBJNAME, PROVIDER, and PROBE_NAME.
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
If SPOPS is not &any_static_probe_ops, only probes related to this
specific static probe ops will match. Each argument is a regexp,
or NULL, which matches anything. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
static std::vector<bound_probe>
collect_probes (const std::string &objname, const std::string &provider,
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const std::string &probe_name, const static_probe_ops *spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
std::vector<bound_probe> result;
Introduce compiled_regex, eliminate make_regfree_cleanup This patch replaces compile_rx_or_error and make_regfree_cleanup with a class that wraps a regex_t. gdb/ChangeLog: 2017-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add gdb_regex.c. (COMMON_OBS): Add gdb_regex.o. * ada-lang.c (ada_add_standard_exceptions) (ada_add_exceptions_from_frame, name_matches_regex) (ada_add_global_exceptions, ada_exceptions_list_1): Change regex parameter type to compiled_regex. Adjust. (ada_exceptions_list): Use compiled_regex. * break-catch-throw.c (exception_catchpoint::pattern): Now a std::unique_ptr<compiled_regex>. (exception_catchpoint::~exception_catchpoint): Remove regfree call. (check_status_exception_catchpoint): Adjust to use compiled_regex. (handle_gnu_v3_exceptions): Adjust to use compiled_regex. * breakpoint.c (solib_catchpoint::compiled): Now a std::unique_ptr<compiled_regex>. (solib_catchpoint::~solib_catchpoint): Remove regfree call. (check_status_catch_solib): Adjust to use compiled_regex. (add_solib_catchpoint): Adjust to use compiled_regex. * cli/cli-cmds.c (apropos_command): Use compiled_regex. * cli/cli-decode.c (apropos_cmd): Change regex parameter to compiled_regex reference. Adjust to use it. * cli/cli-decode.h: Remove struct re_pattern_buffer forward declaration. Include "gdb_regex.h". (apropos_cmd): Change regex parameter to compiled_regex reference. * gdb_regex.c: New file. * gdb_regex.h (make_regfree_cleanup, get_regcomp_error): Delete declarations. (class compiled_regex): New. * linux-tdep.c: Include "common/gdb_optional.h". (struct mapping_regexes): New, factored out from mapping_is_anonymous_p, and adjusted to use compiled_regex. (mapping_is_anonymous_p): Use mapping_regexes wrapped in a gdb::optional and remove cleanups. Adjust to compiled_regex. * probe.c: Include "common/gdb_optional.h". (collect_probes): Use compiled_regex and gdb::optional and remove cleanups. * skip.c: Include "common/gdb_optional.h". (skiplist_entry::compiled_function_regexp): Now a gdb::optional<compiled_regex>. (skiplist_entry::compiled_function_regexp_is_valid): Delete field. (free_skiplist_entry): Remove regfree call. (compile_skip_regexp, skip_rfunction_p): Adjust to use compiled_regex and gdb::optional. * symtab.c: Include "common/gdb_optional.h". (search_symbols): Use compiled_regex and gdb::optional. * utils.c (do_regfree_cleanup, make_regfree_cleanup) (get_regcomp_error, compile_rx_or_error): Delete. Some bits moved to gdb_regex.c.
2017-06-07 15:21:40 +02:00
gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
if (!provider.empty ())
prov_pat.emplace (provider.c_str (), REG_NOSUB,
_("Invalid provider regexp"));
if (!probe_name.empty ())
probe_pat.emplace (probe_name.c_str (), REG_NOSUB,
_("Invalid probe regexp"));
if (!objname.empty ())
obj_pat.emplace (objname.c_str (), REG_NOSUB,
_("Invalid object file regexp"));
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Change all_objfiles adapter to be a method on program_space This changes the all_objfiles range adapter to be a method on the program space, and fixes up all the users. gdb/ChangeLog 2019-01-17 Tom Tromey <tom@tromey.com> * progspace.h (program_space) <objfiles_range>: New typedef. <objfiles>: New method. <objfiles_head>: Rename from objfiles. (object_files): Update. * guile/scm-progspace.c (gdbscm_progspace_objfiles): Update. * guile/scm-pretty-print.c (ppscm_find_pretty_printer_from_objfiles): Update. * guile/scm-objfile.c (gdbscm_objfiles): Update. * python/py-xmethods.c (gdbpy_get_matching_xmethod_workers): Update. * python/py-progspace.c (pspy_get_objfiles): Update. * python/py-prettyprint.c (find_pretty_printer_from_objfiles): Update. * python/py-objfile.c (objfpy_lookup_objfile_by_name) (objfpy_lookup_objfile_by_build_id): Update. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_files): Update. * windows-tdep.c (windows_iterate_over_objfiles_in_search_order): Update. * symtab.c (iterate_over_symtabs, matching_obj_sections) (expand_symtab_containing_pc, lookup_objfile_from_block) (lookup_static_symbol, basic_lookup_transparent_type) (find_pc_sect_compunit_symtab, find_symbol_at_address) (find_line_symtab, info_sources_command) (default_collect_symbol_completion_matches_break_on) (make_source_files_completion_list, find_main_name): Update. * symmisc.c (print_symbol_bcache_statistics) (print_objfile_statistics, maintenance_print_symbols) (maintenance_print_msymbols, maintenance_print_objfiles) (maintenance_info_symtabs, maintenance_check_symtabs) (maintenance_expand_symtabs, maintenance_info_line_tables): Update. * symfile.c (remove_symbol_file_command, overlay_invalidate_all) (find_pc_overlay, find_pc_mapped_section, list_overlays_command) (map_overlay_command, unmap_overlay_command) (simple_overlay_update, expand_symtabs_matching) (map_symbol_filenames): Update. * symfile-debug.c (set_debug_symfile): Update. * spu-tdep.c (spu_overlay_update, spu_objfile_from_frame): Update. * source.c (select_source_symtab, forget_cached_source_info): Update. * solib.c (solib_read_symbols): Update. * solib-spu.c (append_ocl_sos): Update. * psymtab.c (maintenance_print_psymbols) (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * probe.c (parse_probes_in_pspace, find_probe_by_pc): Update. * printcmd.c (info_symbol_command): Update. * ppc-linux-tdep.c (ppc_linux_spe_context_inferior_created): Update. * objfiles.h (class all_objfiles): Remove. * objfiles.c (have_partial_symbols, have_full_symbols) (have_minimal_symbols, qsort_cmp, update_section_map) (shared_objfile_contains_address_p) (default_iterate_over_objfiles_in_search_order): Update. * objc-lang.c (info_selectors_command, info_classes_command) (find_methods): Update. * minsyms.c (find_solib_trampoline_target): Update. * maint.c (maintenance_info_sections) (maintenance_translate_address, count_symtabs_and_blocks): Update. * main.c (captured_main_1): Update. * linux-thread-db.c (try_thread_db_load_from_pdir) (has_libpthread): Update. * linespec.c (iterate_over_all_matching_symtabs) (search_minsyms_for_name): Update. * jit.c (jit_find_objf_with_entry_addr): Update. * hppa-tdep.c (find_unwind_entry) (hppa_lookup_stub_minimal_symbol): Update. * gcore.c (gcore_create_callback, objfile_find_memory_regions): Update. * elfread.c (elf_gnu_ifunc_resolve_by_cache) (elf_gnu_ifunc_resolve_by_got): Update. * dwarf2-frame.c (dwarf2_frame_find_fde): Update. * dwarf-index-write.c (save_gdb_index_command): Update. * cp-support.c (add_symbol_overload_list_qualified): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint): Update. * blockframe.c (find_pc_partial_function): Update. * ada-lang.c (ada_lookup_simple_minsym, add_nonlocal_symbols) (ada_collect_symbol_completion_matches) (ada_add_global_exceptions): Update.
2019-01-16 00:55:05 +01:00
for (objfile *objfile : current_program_space->objfiles ())
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
if (! objfile->sf || ! objfile->sf->sym_probe_fns)
continue;
if (obj_pat)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Introduce compiled_regex, eliminate make_regfree_cleanup This patch replaces compile_rx_or_error and make_regfree_cleanup with a class that wraps a regex_t. gdb/ChangeLog: 2017-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add gdb_regex.c. (COMMON_OBS): Add gdb_regex.o. * ada-lang.c (ada_add_standard_exceptions) (ada_add_exceptions_from_frame, name_matches_regex) (ada_add_global_exceptions, ada_exceptions_list_1): Change regex parameter type to compiled_regex. Adjust. (ada_exceptions_list): Use compiled_regex. * break-catch-throw.c (exception_catchpoint::pattern): Now a std::unique_ptr<compiled_regex>. (exception_catchpoint::~exception_catchpoint): Remove regfree call. (check_status_exception_catchpoint): Adjust to use compiled_regex. (handle_gnu_v3_exceptions): Adjust to use compiled_regex. * breakpoint.c (solib_catchpoint::compiled): Now a std::unique_ptr<compiled_regex>. (solib_catchpoint::~solib_catchpoint): Remove regfree call. (check_status_catch_solib): Adjust to use compiled_regex. (add_solib_catchpoint): Adjust to use compiled_regex. * cli/cli-cmds.c (apropos_command): Use compiled_regex. * cli/cli-decode.c (apropos_cmd): Change regex parameter to compiled_regex reference. Adjust to use it. * cli/cli-decode.h: Remove struct re_pattern_buffer forward declaration. Include "gdb_regex.h". (apropos_cmd): Change regex parameter to compiled_regex reference. * gdb_regex.c: New file. * gdb_regex.h (make_regfree_cleanup, get_regcomp_error): Delete declarations. (class compiled_regex): New. * linux-tdep.c: Include "common/gdb_optional.h". (struct mapping_regexes): New, factored out from mapping_is_anonymous_p, and adjusted to use compiled_regex. (mapping_is_anonymous_p): Use mapping_regexes wrapped in a gdb::optional and remove cleanups. Adjust to compiled_regex. * probe.c: Include "common/gdb_optional.h". (collect_probes): Use compiled_regex and gdb::optional and remove cleanups. * skip.c: Include "common/gdb_optional.h". (skiplist_entry::compiled_function_regexp): Now a gdb::optional<compiled_regex>. (skiplist_entry::compiled_function_regexp_is_valid): Delete field. (free_skiplist_entry): Remove regfree call. (compile_skip_regexp, skip_rfunction_p): Adjust to use compiled_regex and gdb::optional. * symtab.c: Include "common/gdb_optional.h". (search_symbols): Use compiled_regex and gdb::optional. * utils.c (do_regfree_cleanup, make_regfree_cleanup) (get_regcomp_error, compile_rx_or_error): Delete. Some bits moved to gdb_regex.c.
2017-06-07 15:21:40 +02:00
if (obj_pat->exec (objfile_name (objfile), 0, NULL, 0) != 0)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
}
const std::vector<std::unique_ptr<probe>> &probes
= objfile->sf->sym_probe_fns->sym_get_probes (objfile);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
for (auto &p : probes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (spops != &any_static_probe_ops && p->get_static_ops () != spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
if (prov_pat
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
&& prov_pat->exec (p->get_provider ().c_str (), 0, NULL, 0) != 0)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
if (probe_pat
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
&& probe_pat->exec (p->get_name ().c_str (), 0, NULL, 0) != 0)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
result.emplace_back (p.get (), objfile);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
}
return result;
}
change probes to be program-space-independent This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
2013-12-02 21:58:59 +01:00
/* A qsort comparison function for bound_probe_s objects. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
static bool
compare_probes (const bound_probe &a, const bound_probe &b)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
int v;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
v = a.prob->get_provider ().compare (b.prob->get_provider ());
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
if (v != 0)
return v < 0;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
v = a.prob->get_name ().compare (b.prob->get_name ());
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
if (v != 0)
return v < 0;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (a.prob->get_address () != b.prob->get_address ())
return a.prob->get_address () < b.prob->get_address ();
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
return strcmp (objfile_name (a.objfile), objfile_name (b.objfile)) < 0;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
/* Helper function that generate entries in the ui_out table being
crafted by `info_probes_for_ops'. */
static void
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
gen_ui_out_table_header_info (const std::vector<bound_probe> &probes,
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const static_probe_ops *spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
/* `headings' refers to the names of the columns when printing `info
probes'. */
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
gdb_assert (spops != NULL);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
std::vector<struct info_probe_column> headings
= spops->gen_info_probes_table_header ();
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
for (const info_probe_column &column : headings)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
size_t size_max = strlen (column.print_name);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe : probes)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
/* `probe_fields' refers to the values of each new field that this
probe will display. */
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (probe.prob->get_static_ops () != spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
continue;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
std::vector<const char *> probe_fields
= probe.prob->gen_info_probes_table_values ();
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
gdb_assert (probe_fields.size () == headings.size ());
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
for (const char *val : probe_fields)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
/* It is valid to have a NULL value here, which means that the
backend does not have something to write and this particular
field should be skipped. */
if (val == NULL)
continue;
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
size_max = std::max (strlen (val), size_max);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
}
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->table_header (size_max, ui_left,
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
column.field_name, column.print_name);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
}
/* Helper function to print not-applicable strings for all the extra
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
columns defined in a static_probe_ops. */
static void
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
print_ui_out_not_applicables (const static_probe_ops *spops)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
std::vector<struct info_probe_column> headings
= spops->gen_info_probes_table_header ();
for (const info_probe_column &column : headings)
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
current_uiout->field_string (column.field_name, _("n/a"));
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* Helper function to print extra information about a probe and an objfile
2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com> * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. (elf_compile_to_ax): Likewise. * infrun.c (insert_exception_resume_from_probe): Likewise. (check_exception_resume): Remove `objfile' variable. * probe.c (find_probe_by_pc): Remove `objfile' argument. (struct probe_and_objfile, probe_and_objfile_s): Delete. (collect_probes): Adjust return value to `VEC (probe_p) *'. (compare_entries): Rename to... (compare_probes): ...this. Adjust function to work with `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' respectively. (gen_ui_out_table_header_info): Adjust `probes' argument to be `VEC (probe_p) *'. (print_ui_out_info): Adjust argument to be `struct probe *'. (info_probes_for_ops): Adjust internal computations to use `VEC (probe_p) *'. (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax, gen_info_probes_table_values>: Remove `objfile' argument. (struct probe) <objfile>: New field. (find_probe_by_pc): Remove `objfile' argument. * stap-probe.c (stap_parse_probe_arguments): Likewise. (stap_get_probe_argument_count): Likewise. (stap_get_arg): Likewise. (stap_evaluate_probe_argument): Likewise. (stap_compile_to_ax): Likewise. (compile_probe_arg): Refactor not to pass `objfile' anymore. (handle_stap_probe): Fill `objfile' field from `struct probe'. (stap_gen_info_probes_table_header): Remove `objfile' argument. * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument, sym_compile_to_ax>: Likewise.
2012-07-18 18:12:17 +02:00
represented by PROBE. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
static void
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
print_ui_out_info (probe *probe)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
/* `values' refers to the actual values of each new field in the output
of `info probe'. `headings' refers to the names of each new field. */
2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com> * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. (elf_compile_to_ax): Likewise. * infrun.c (insert_exception_resume_from_probe): Likewise. (check_exception_resume): Remove `objfile' variable. * probe.c (find_probe_by_pc): Remove `objfile' argument. (struct probe_and_objfile, probe_and_objfile_s): Delete. (collect_probes): Adjust return value to `VEC (probe_p) *'. (compare_entries): Rename to... (compare_probes): ...this. Adjust function to work with `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' respectively. (gen_ui_out_table_header_info): Adjust `probes' argument to be `VEC (probe_p) *'. (print_ui_out_info): Adjust argument to be `struct probe *'. (info_probes_for_ops): Adjust internal computations to use `VEC (probe_p) *'. (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax, gen_info_probes_table_values>: Remove `objfile' argument. (struct probe) <objfile>: New field. (find_probe_by_pc): Remove `objfile' argument. * stap-probe.c (stap_parse_probe_arguments): Likewise. (stap_get_probe_argument_count): Likewise. (stap_get_arg): Likewise. (stap_evaluate_probe_argument): Likewise. (stap_compile_to_ax): Likewise. (compile_probe_arg): Refactor not to pass `objfile' anymore. (handle_stap_probe): Fill `objfile' field from `struct probe'. (stap_gen_info_probes_table_header): Remove `objfile' argument. * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument, sym_compile_to_ax>: Likewise.
2012-07-18 18:12:17 +02:00
gdb_assert (probe != NULL);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
std::vector<struct info_probe_column> headings
= probe->get_static_ops ()->gen_info_probes_table_header ();
std::vector<const char *> values
= probe->gen_info_probes_table_values ();
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
gdb_assert (headings.size () == values.size ());
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
for (int ix = 0; ix < headings.size (); ++ix)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
struct info_probe_column column = headings[ix];
const char *val = values[ix];
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
if (val == NULL)
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
current_uiout->field_skip (column.field_name);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
else
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
current_uiout->field_string (column.field_name, val);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
}
/* Helper function that returns the number of extra fields which POPS will
need. */
static int
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
get_number_extra_fields (const static_probe_ops *spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
return spops->gen_info_probes_table_header ().size ();
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* Helper function that returns true if there is a probe in PROBES
featuring the given SPOPS. It returns false otherwise. */
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
static bool
exists_probe_with_spops (const std::vector<bound_probe> &probes,
const static_probe_ops *spops)
{
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe : probes)
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (probe.prob->get_static_ops () == spops)
return true;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
return false;
}
/* Helper function that parses a probe linespec of the form [PROVIDER
[PROBE [OBJNAME]]] from the provided string STR. */
static void
parse_probe_linespec (const char *str, std::string *provider,
std::string *probe_name, std::string *objname)
{
*probe_name = *objname = "";
Rename _const functions to use overloading instead This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-10 22:19:19 +02:00
*provider = extract_arg (&str);
if (!provider->empty ())
{
Rename _const functions to use overloading instead This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-10 22:19:19 +02:00
*probe_name = extract_arg (&str);
if (!probe_name->empty ())
Rename _const functions to use overloading instead This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-10 22:19:19 +02:00
*objname = extract_arg (&str);
}
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* See comment in probe.h. */
void
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
info_probes_for_spops (const char *arg, int from_tty,
const static_probe_ops *spops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
std::string provider, probe_name, objname;
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
int any_found;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
int ui_out_extra_fields = 0;
size_t size_addr;
size_t size_name = strlen ("Name");
size_t size_objname = strlen ("Object");
size_t size_provider = strlen ("Provider");
size_t size_type = strlen ("Type");
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
struct gdbarch *gdbarch = get_current_arch ();
parse_probe_linespec (arg, &provider, &probe_name, &objname);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
std::vector<bound_probe> probes
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
= collect_probes (objname, provider, probe_name, spops);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (spops == &any_static_probe_ops)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* If SPOPS is &any_static_probe_ops, it means the user has
requested a "simple" `info probes', i.e., she wants to print
all information about all probes. For that, we have to
identify how many extra fields we will need to add in the
ui_out table.
To do that, we iterate over all static_probe_ops, querying
each one about its extra fields, and incrementing
`ui_out_extra_fields' to reflect that number. But note that
we ignore the static_probe_ops for which no probes are
defined with the given search criteria. */
for (const static_probe_ops *po : all_static_probe_ops)
if (exists_probe_with_spops (probes, po))
ui_out_extra_fields += get_number_extra_fields (po);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
else
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
ui_out_extra_fields = get_number_extra_fields (spops);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
ui_out_emit_table table_emitter (current_uiout,
5 + ui_out_extra_fields,
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
probes.size (), "StaticProbes");
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
std::sort (probes.begin (), probes.end (), compare_probes);
/* What's the size of an address in our architecture? */
size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10;
/* Determining the maximum size of each field (`type', `provider',
`name' and `objname'). */
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe : probes)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const char *probe_type = probe.prob->get_static_ops ()->type_name ();
size_type = std::max (strlen (probe_type), size_type);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
size_name = std::max (probe.prob->get_name ().size (), size_name);
size_provider = std::max (probe.prob->get_provider ().size (),
size_provider);
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
size_objname = std::max (strlen (objfile_name (probe.objfile)),
size_objname);
}
current_uiout->table_header (size_type, ui_left, "type", _("Type"));
current_uiout->table_header (size_provider, ui_left, "provider",
_("Provider"));
current_uiout->table_header (size_name, ui_left, "name", _("Name"));
current_uiout->table_header (size_addr, ui_left, "addr", _("Where"));
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (spops == &any_static_probe_ops)
{
/* We have to generate the table header for each new probe type
that we will print. Note that this excludes probe types not
having any defined probe with the search criteria. */
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
for (const static_probe_ops *po : all_static_probe_ops)
if (exists_probe_with_spops (probes, po))
gen_ui_out_table_header_info (probes, po);
}
else
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
gen_ui_out_table_header_info (probes, spops);
current_uiout->table_header (size_objname, ui_left, "object", _("Object"));
current_uiout->table_body ();
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe : probes)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const char *probe_type = probe.prob->get_static_ops ()->type_name ();
ui_out_emit_tuple tuple_emitter (current_uiout, "probe");
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
current_uiout->field_string ("type", probe_type);
current_uiout->field_string ("provider",
probe.prob->get_provider ().c_str ());
current_uiout->field_string ("name", probe.prob->get_name ().c_str ());
current_uiout->field_core_addr ("addr", probe.prob->get_gdbarch (),
probe.prob->get_relocated_address
(probe.objfile));
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (spops == &any_static_probe_ops)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
for (const static_probe_ops *po : all_static_probe_ops)
{
if (probe.prob->get_static_ops () == po)
print_ui_out_info (probe.prob);
else if (exists_probe_with_spops (probes, po))
print_ui_out_not_applicables (po);
}
}
else
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
print_ui_out_info (probe.prob);
current_uiout->field_string ("object",
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
objfile_name (probe.objfile));
current_uiout->text ("\n");
}
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
any_found = !probes.empty ();
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
if (!any_found)
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("No probes matched.\n"));
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
/* Implementation of the `info probes' command. */
static void
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (cmd_set_record_btrace, cmd_show_record_btrace) (cmd_set_record_btrace_bts, cmd_show_record_btrace_bts) (cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
info_probes_command (const char *arg, int from_tty)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
info_probes_for_spops (arg, from_tty, &any_static_probe_ops);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
/* Implementation of the `enable probes' command. */
static void
enable_probes_command (const char *arg, int from_tty)
{
std::string provider, probe_name, objname;
parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
std::vector<bound_probe> probes
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
if (probes.empty ())
{
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("No probes matched.\n"));
return;
}
/* Enable the selected probes, provided their backends support the
notion of enabling a probe. */
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe: probes)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (probe.prob->get_static_ops ()->can_enable ())
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->enable ();
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("Probe %s:%s enabled.\n"),
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
else
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("Probe %s:%s cannot be enabled.\n"),
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
}
/* Implementation of the `disable probes' command. */
static void
disable_probes_command (const char *arg, int from_tty)
{
std::string provider, probe_name, objname;
parse_probe_linespec ((const char *) arg, &provider, &probe_name, &objname);
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
std::vector<bound_probe> probes
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
= collect_probes (objname, provider, probe_name, &any_static_probe_ops);
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
if (probes.empty ())
{
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("No probes matched.\n"));
return;
}
/* Disable the selected probes, provided their backends support the
notion of enabling a probe. */
Make collect_probes return an std::vector Change collect_probes so it returns an std::vector<bound_probe> instead of a VEC(bound_probe_s). This allows removing some cleanups. It also seems like enable_probes_command and disable_probes_command were not freeing that vector. The comparison function compare_probes needs to be updated to return a bool indicating whether the first parameter is "less than" the second parameter. I defined two constructors to bound_probe. The default constructor is needed, for example, so the instance in struct bp_location can be constructed without parameters. The constructor with parameters is useful so we can use emplace_back and pass the values directly. The s390 builder on the buildbot shows a weird failure that I can't explain: ../../binutils-gdb/gdb/elfread.c: In function void probe_key_free(bfd*, void*): ../../binutils-gdb/gdb/elfread.c:1346:8: error: types may not be defined in a for-range-declaration [-Werror] for (struct probe *probe : *probes) ^~~~~~ I guess it's a bug with that specific version< of the compiler, since no other gcc gives me that error. It is using: g++ (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1) Any idea about this problem? gdb/ChangeLog: * probe.h (struct bound_probe): Define constructors. * probe.c (bound_probe_s): Remove typedef. (DEF_VEC_O (bound_probe_s)): Remove VEC. (collect_probes): Change return type to std::vector, remove cleanup. (compare_probes): Return bool, change parameter type. Change semantic to "less than". (gen_ui_out_table_header_info): Change parameter to std::vector and update. (exists_probe_with_pops): Likewise. (info_probes_for_ops): Update to std::vector change. (enable_probes_command): Likewise. (disable_probes_command): Likewise.
2017-09-12 13:55:32 +02:00
for (const bound_probe &probe : probes)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (probe.prob->get_static_ops ()->can_enable ())
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->disable ();
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("Probe %s:%s disabled.\n"),
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
else
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
current_uiout->message (_("Probe %s:%s cannot be disabled.\n"),
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
probe.prob->get_provider ().c_str (),
probe.prob->get_name ().c_str ());
}
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* See comments in probe.h. */
struct value *
probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n)
{
change probes to be program-space-independent This changes the probes to be independent of the program space. After this, when a probe's address is needed, it is determined by applying offsets at the point of use. This introduces a bound_probe object, similar to bound minimal symbols. Objects of this type are used when it's necessary to pass a probe and its corresponding objfile. This removes the backlink from probe to objfile, which was primarily used to fetch the architecture to use. This adds a get_probe_address function which calls a probe method to compute the probe's relocated address. Similarly, it adds an objfile parameter to the semaphore methods so they can do the relocation properly as well. 2014-03-03 Tom Tromey <tromey@redhat.com> * break-catch-throw.c (fetch_probe_arguments): Use bound probes. * breakpoint.c (create_longjmp_master_breakpoint): Use get_probe_address. (add_location_to_breakpoint, bkpt_probe_insert_location) (bkpt_probe_remove_location): Update. * breakpoint.h (struct bp_location) <probe>: Now a bound_probe. * elfread.c (elf_symfile_relocate_probe): Remove. (elf_probe_fns): Update. (insert_exception_resume_breakpoint): Change type of "probe" parameter to bound_probe. (check_exception_resume): Update. * objfiles.c (objfile_relocate1): Don't relocate probes. * probe.c (bound_probe_s): New typedef. (parse_probes): Use get_probe_address. Set sal's objfile. (find_probe_by_pc): Return a bound_probe. (collect_probes): Return a VEC(bound_probe_s). (compare_probes): Update. (gen_ui_out_table_header_info): Change type of "probes" parameter. Update. (info_probes_for_ops): Update. (get_probe_address): New function. (probe_safe_evaluate_at_pc): Update. * probe.h (struct probe_ops) <get_probe_address>: New field. <set_semaphore, clear_semaphore>: Add objfile parameter. (struct probe) <objfile>: Remove field. <arch>: New field. <address>: Update comment. (struct bound_probe): New. (find_probe_by_pc): Return a bound_probe. (get_probe_address): Declare. * solib-svr4.c (struct probe_and_action) <address>: New field. (hash_probe_and_action, equal_probe_and_action): Update. (register_solib_event_probe): Add address parameter. (solib_event_probe_at): Update. (svr4_create_probe_breakpoints): Add objfile parameter. Use get_probe_address. * stap-probe.c (struct stap_probe) <sem_addr>: Update comment. (stap_get_probe_address): New function. (stap_can_evaluate_probe_arguments, compute_probe_arg) (compile_probe_arg): Update. (stap_set_semaphore, stap_clear_semaphore): Compute semaphore's address. (handle_stap_probe): Don't relocate the probe. (stap_relocate): Remove. (stap_gen_info_probes_table_values): Update. (stap_probe_ops): Remove stap_relocate. * symfile-debug.c (debug_sym_relocate_probe): Remove. (debug_sym_probe_fns): Update. * symfile.h (struct sym_probe_fns) <sym_relocate_probe>: Remove. * symtab.c (init_sal): Use memset. * symtab.h (struct symtab_and_line) <objfile>: New field. * tracepoint.c (start_tracing, stop_tracing): Update.
2013-12-02 21:58:59 +01:00
struct bound_probe probe;
unsigned n_args;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
2012-07-18 Sergio Durigan Junior <sergiodj@redhat.com> * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. (elf_compile_to_ax): Likewise. * infrun.c (insert_exception_resume_from_probe): Likewise. (check_exception_resume): Remove `objfile' variable. * probe.c (find_probe_by_pc): Remove `objfile' argument. (struct probe_and_objfile, probe_and_objfile_s): Delete. (collect_probes): Adjust return value to `VEC (probe_p) *'. (compare_entries): Rename to... (compare_probes): ...this. Adjust function to work with `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' respectively. (gen_ui_out_table_header_info): Adjust `probes' argument to be `VEC (probe_p) *'. (print_ui_out_info): Adjust argument to be `struct probe *'. (info_probes_for_ops): Adjust internal computations to use `VEC (probe_p) *'. (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. * probe.h (struct probe_ops) <get_probe_argument_count, compile_to_ax, gen_info_probes_table_values>: Remove `objfile' argument. (struct probe) <objfile>: New field. (find_probe_by_pc): Remove `objfile' argument. * stap-probe.c (stap_parse_probe_arguments): Likewise. (stap_get_probe_argument_count): Likewise. (stap_get_arg): Likewise. (stap_evaluate_probe_argument): Likewise. (stap_compile_to_ax): Likewise. (compile_probe_arg): Refactor not to pass `objfile' anymore. (handle_stap_probe): Fill `objfile' field from `struct probe'. (stap_gen_info_probes_table_header): Remove `objfile' argument. * symfile.h (struct sym_probe_fns) <sym_evaluate_probe_argument, sym_compile_to_ax>: Likewise.
2012-07-18 18:12:17 +02:00
probe = find_probe_by_pc (get_frame_pc (frame));
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (!probe.prob)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
return NULL;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
n_args = probe.prob->get_argument_count (frame);
if (n >= n_args)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
return NULL;
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
return probe.prob->evaluate_argument (n, frame);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}
/* See comment in probe.h. */
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const struct static_probe_ops *
probe_linespec_to_static_ops (const char **linespecp)
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
for (const static_probe_ops *ops : all_static_probe_ops)
if (ops->is_linespec (linespecp))
return ops;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
return NULL;
}
/* See comment in probe.h. */
int
probe_is_linespec_by_keyword (const char **linespecp, const char *const *keywords)
{
const char *s = *linespecp;
const char *const *csp;
for (csp = keywords; *csp; csp++)
{
const char *keyword = *csp;
size_t len = strlen (keyword);
if (strncmp (s, keyword, len) == 0 && isspace (s[len]))
{
*linespecp += len + 1;
return 1;
}
}
return 0;
}
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* Implementation of `is_linespec' method. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
bool
any_static_probe_ops::is_linespec (const char **linespecp) const
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
static const char *const keywords[] = { "-p", "-probe", NULL };
return probe_is_linespec_by_keyword (linespecp, keywords);
}
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* Implementation of 'get_probes' method. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
void
any_static_probe_ops::get_probes (std::vector<std::unique_ptr<probe>> *probesp,
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
struct objfile *objfile) const
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
/* No probes can be provided by this dummy backend. */
}
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
/* Implementation of the 'type_name' method. */
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
const char *
any_static_probe_ops::type_name () const
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
return NULL;
}
/* Implementation of the 'gen_info_probes_table_header' method. */
std::vector<struct info_probe_column>
any_static_probe_ops::gen_info_probes_table_header () const
{
return std::vector<struct info_probe_column> ();
}
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
/* See comments in probe.h. */
struct cmd_list_element **
info_probes_cmdlist_get (void)
{
static struct cmd_list_element *info_probes_cmdlist;
if (info_probes_cmdlist == NULL)
add_prefix_cmd ("probes", class_info, info_probes_command,
_("\
Show available static probes.\n\
Usage: info probes [all|TYPE [ARGS]]\n\
TYPE specifies the type of the probe, and can be one of the following:\n\
- stap\n\
If you specify TYPE, there may be additional arguments needed by the\n\
subcommand.\n\
If you do not specify any argument, or specify `all', then the command\n\
will show information about all types of probes."),
&info_probes_cmdlist, "info probes ",
0/*allow-unknown*/, &infolist);
return &info_probes_cmdlist;
}
/* This is called to compute the value of one of the $_probe_arg*
convenience variables. */
static struct value *
compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar,
void *data)
{
struct frame_info *frame = get_selected_frame (_("No frame selected"));
CORE_ADDR pc = get_frame_pc (frame);
int sel = (int) (uintptr_t) data;
struct bound_probe pc_probe;
unsigned n_args;
/* SEL == -1 means "_probe_argc". */
gdb_assert (sel >= -1);
pc_probe = find_probe_by_pc (pc);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (pc_probe.prob == NULL)
error (_("No probe at PC %s"), core_addr_to_string (pc));
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
n_args = pc_probe.prob->get_argument_count (frame);
if (sel == -1)
return value_from_longest (builtin_type (arch)->builtin_int, n_args);
if (sel >= n_args)
error (_("Invalid probe argument %d -- probe has %u arguments available"),
sel, n_args);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
return pc_probe.prob->evaluate_argument (sel, frame);
}
/* This is called to compile one of the $_probe_arg* convenience
variables into an agent expression. */
static void
compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr,
struct axs_value *value, void *data)
{
CORE_ADDR pc = expr->scope;
int sel = (int) (uintptr_t) data;
struct bound_probe pc_probe;
int n_args;
struct frame_info *frame = get_selected_frame (NULL);
/* SEL == -1 means "_probe_argc". */
gdb_assert (sel >= -1);
pc_probe = find_probe_by_pc (pc);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
if (pc_probe.prob == NULL)
error (_("No probe at PC %s"), core_addr_to_string (pc));
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
n_args = pc_probe.prob->get_argument_count (frame);
if (sel == -1)
{
value->kind = axs_rvalue;
value->type = builtin_type (expr->gdbarch)->builtin_int;
ax_const_l (expr, n_args);
return;
}
gdb_assert (sel >= 0);
if (sel >= n_args)
error (_("Invalid probe argument %d -- probe has %d arguments available"),
sel, n_args);
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
pc_probe.prob->compile_to_ax (expr, value, sel);
}
static const struct internalvar_funcs probe_funcs =
{
compute_probe_arg,
compile_probe_arg,
NULL
};
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
std::vector<const static_probe_ops *> all_static_probe_ops;
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
void
_initialize_probe (void)
{
Convert generic probe interface to C++ (and perform some cleanups) This patch converts the generic probe interface (gdb/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 probe' to 'class probe', and 'struct probe_ops' to 'class static_probe_ops'. The former now contains all the "dynamic", generic methods that act on a probe + the generic data related to it; the latter encapsulates a bunch of "static" methods that relate to the probe type, but not to a specific probe itself. I've had to do a few renamings (e.g., on 'struct bound_probe' the field is called 'probe *prob' now, instead of 'struct probe *probe') because GCC was complaining about naming the field using the same name as the class. Nothing major, though. Generally speaking, the logic behind and the design behind the code are the same. 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> * break-catch-throw.c (fetch_probe_arguments): Use 'probe.prob' instead of 'probe.probe'. * breakpoint.c (create_longjmp_master_breakpoint): Call 'can_evaluate_arguments' and 'get_relocated_address' methods from probe. (create_exception_master_breakpoint): Likewise. (add_location_to_breakpoint): Use 'sal->prob' instead of 'sal->probe'. (bkpt_probe_insert_location): Call 'set_semaphore' method from probe. (bkpt_probe_remove_location): Likewise, for 'clear_semaphore'. * elfread.c (elf_get_probes): Use 'static_probe_ops' instead of 'probe_ops'. (probe_key_free): Call 'delete' on probe. (check_exception_resume): Use 'probe.prob' instead of 'probe.probe'. * location.c (string_to_event_location_basic): Call 'probe_linespec_to_static_ops'. * probe.c (class any_static_probe_ops): New class. (any_static_probe_ops any_static_probe_ops): New variable. (parse_probes_in_pspace): Receive 'static_probe_ops' as argument. Adjust code to reflect change. (parse_probes): Use 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. (find_probes_in_objfile): Call methods to get name and provider from probe. (find_probe_by_pc): Use 'result.prob' instead of 'result.probe'. Call 'get_relocated_address' method from probe. (collect_probes): Adjust comment and argument list to receive 'static_probe_ops' instead of 'probe_ops'. Adjust code to reflect change. Call necessary methods from probe. (compare_probes): Call methods to get name and provider from probes. (gen_ui_out_table_header_info): Receive 'static_probe_ops' instead of 'probe_ops'. Use 'std::vector' instead of VEC, adjust code accordingly. (print_ui_out_not_applicables): Likewise. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Receive 'static_probe_ops' as argument instead of 'probe_ops'. Adjust code. Call necessary methods from probe. (info_probes_command): Use 'info_probes_for_spops'. (enable_probes_command): Pass correct argument to 'collect_probes'. Call methods from probe. (disable_probes_command): Likewise. (get_probe_address): Move to 'any_static_probe_ops::get_address'. (get_probe_argument_count): Move to 'any_static_probe_ops::get_argument_count'. (can_evaluate_probe_arguments): Move to 'any_static_probe_ops::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'any_static_probe_ops::evaluate_argument'. (probe_safe_evaluate_at_pc): Use 'probe.prob' instead of 'probe.probe'. (probe_linespec_to_ops): Rename to... (probe_linespec_to_static_ops): ...this. Adjust code. (probe_any_is_linespec): Rename to... (any_static_probe_ops::is_linespec): ...this. (probe_any_get_probes): Rename to... (any_static_probe_ops::get_probes): ...this. (any_static_probe_ops::type_name): New method. (any_static_probe_ops::gen_info_probes_table_header): New method. (compute_probe_arg): Use 'pc_probe.prob' instead of 'pc_probe.probe'. Call methods from probe. (compile_probe_arg): Likewise. (std::vector<const probe_ops *> all_probe_ops): Delete. (std::vector<const static_probe_ops *> all_static_probe_ops): New variable. (_initialize_probe): Use 'all_static_probe_ops' instead of 'all_probe_ops'. * probe.h (struct info_probe_column) <field_name>: Delete extraneous newline (info_probe_column_s): Delete type and VEC. (struct probe_ops): Delete. Replace with... (class static_probe_ops): ...this and... (clas probe): ...this. (struct bound_probe) <bound_probe>: Delete extraneous newline. Adjust constructor to receive 'probe' instead of 'struct probe'. <probe>: Rename to... <prob>: ...this. Delete extraneous newline. <objfile>: Delete extraneous newline. (register_probe_ops): Delete unused prototype. (info_probes_for_ops): Rename to... (info_probes_for_spops): ...this. Adjust comment. (get_probe_address): Move to 'probe::get_address'. (get_probe_argument_count): Move to 'probe::get_argument_count'. (can_evaluate_probe_arguments): Move to 'probe::can_evaluate_arguments'. (evaluate_probe_argument): Move to 'probe::evaluate_argument'. * solib-svr4.c (struct svr4_info): Adjust comment. (struct probe_and_action) <probe>: Rename to... <prob>: ...this. (register_solib_event_probe): Receive 'probe' instead of 'struct probe' as argument. Use 'prob' instead of 'probe' when applicable. (solib_event_probe_action): Call 'get_argument_count' method from probe. Adjust comment. (svr4_handle_solib_event): Adjust comment. Call 'evaluate_argument' method from probe. (svr4_create_probe_breakpoints): Call 'get_relocated_address' from probe. (svr4_create_solib_event_breakpoints): Use 'probe' instead of 'struct probe'. Call 'can_evaluate_arguments' from probe. * symfile.h: Forward declare 'class probe' instead of 'struct probe'. * symtab.h: Likewise. (struct symtab_and_line) <probe>: Rename to... <prob>: ...this. * tracepoint.c (start_tracing): Use 'prob' when applicable. Call probe methods. (stop_tracing): Likewise.
2017-11-13 06:28:24 +01:00
all_static_probe_ops.push_back (&any_static_probe_ops);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
create_internalvar_type_lazy ("_probe_argc", &probe_funcs,
(void *) (uintptr_t) -1);
create_internalvar_type_lazy ("_probe_arg0", &probe_funcs,
(void *) (uintptr_t) 0);
create_internalvar_type_lazy ("_probe_arg1", &probe_funcs,
(void *) (uintptr_t) 1);
create_internalvar_type_lazy ("_probe_arg2", &probe_funcs,
(void *) (uintptr_t) 2);
create_internalvar_type_lazy ("_probe_arg3", &probe_funcs,
(void *) (uintptr_t) 3);
create_internalvar_type_lazy ("_probe_arg4", &probe_funcs,
(void *) (uintptr_t) 4);
create_internalvar_type_lazy ("_probe_arg5", &probe_funcs,
(void *) (uintptr_t) 5);
create_internalvar_type_lazy ("_probe_arg6", &probe_funcs,
(void *) (uintptr_t) 6);
create_internalvar_type_lazy ("_probe_arg7", &probe_funcs,
(void *) (uintptr_t) 7);
create_internalvar_type_lazy ("_probe_arg8", &probe_funcs,
(void *) (uintptr_t) 8);
create_internalvar_type_lazy ("_probe_arg9", &probe_funcs,
(void *) (uintptr_t) 9);
create_internalvar_type_lazy ("_probe_arg10", &probe_funcs,
(void *) (uintptr_t) 10);
create_internalvar_type_lazy ("_probe_arg11", &probe_funcs,
(void *) (uintptr_t) 11);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
add_cmd ("all", class_info, info_probes_command,
_("\
Show information about all type of probes."),
info_probes_cmdlist_get ());
add_cmd ("probes", class_breakpoint, enable_probes_command, _("\
Enable probes.\n\
Usage: enable probes [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
PROVIDER matches probe provider names.\n\
NAME matches the probe names.\n\
OBJECT matches the executable or shared library name.\n\
If you do not specify any argument then the command will enable\n\
all defined probes."),
&enablelist);
add_cmd ("probes", class_breakpoint, disable_probes_command, _("\
Disable probes.\n\
Usage: disable probes [PROVIDER [NAME [OBJECT]]]\n\
Each argument is a regular expression, used to select probes.\n\
PROVIDER matches probe provider names.\n\
NAME matches the probe names.\n\
OBJECT matches the executable or shared library name.\n\
If you do not specify any argument then the command will disable\n\
all defined probes."),
&disablelist);
2012-04-27 Sergio Durigan Junior <sergiodj@redhat.com> Tom Tromey <tromey@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> * Makefile.in (SFILES): Add `probe' and `stap-probe'. (COMMON_OBS): Likewise. (HFILES_NO_SRCDIR): Add `probe'. * NEWS: Mention support for static and SystemTap probes. * amd64-tdep.c (amd64_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * arm-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (arm_stap_is_single_operand): New function. (arm_stap_parse_special_token): Likewise. (arm_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * ax-gdb.c (require_rvalue): Removing static declaration. (gen_expr): Likewise. * ax-gdb.h (gen_expr): Declaring function. (require_rvalue): Likewise. * breakpoint.c: Include `gdb_regex.h' and `probe.h'. (bkpt_probe_breakpoint_ops): New variable. (momentary_breakpoint_from_master): Set the `probe' value. (add_location_to_breakpoint): Likewise. (break_command_1): Using proper breakpoint_ops according to the argument passed by the user in the command line. (bkpt_probe_insert_location): New function. (bkpt_probe_remove_location): Likewise. (bkpt_probe_create_sals_from_address): Likewise. (bkpt_probe_decode_linespec): Likewise. (tracepoint_probe_create_sals_from_address): Likewise. (tracepoint_probe_decode_linespec): Likewise. (tracepoint_probe_breakpoint_ops): New variable. (trace_command): Using proper breakpoint_ops according to the argument passed by the user in the command line. (initialize_breakpoint_ops): Initializing breakpoint_ops for static probes on breakpoints and tracepoints. * breakpoint.h (struct bp_location) <probe>: New field. * cli-utils.c (skip_spaces_const): New function. (extract_arg): Likewise. * cli-utils.h (skip_spaces_const): Likewise. (extract_arg): Likewise. * coffread.c (coff_sym_fns): Add `sym_probe_fns' value. * configure.ac: Append `stap-probe.o' to be generated when ELF support is present. * configure: Regenerate. * dbxread.c (aout_sym_fns): Add `sym_probe_fns' value. * elfread.c: Include `probe.h' and `arch-utils.h'. (probe_key): New variable. (elf_get_probes): New function. (elf_get_probe_argument_count): Likewise. (elf_evaluate_probe_argument): Likewise. (elf_compile_to_ax): Likewise. (elf_symfile_relocate_probe): Likewise. (stap_probe_key_free): Likewise. (elf_probe_fns): New variable. (elf_sym_fns): Add `sym_probe_fns' value. (elf_sym_fns_lazy_psyms): Likewise. (elf_sym_fns_gdb_index): Likewise. (_initialize_elfread): Initialize objfile cache for static probes. * gdb_vecs.h (struct probe): New forward declaration. (probe_p): New VEC declaration. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * gdbarch.sh (stap_integer_prefix): New variable. (stap_integer_suffix): Likewise. (stap_register_prefix): Likewise. (stap_register_suffix): Likewise. (stap_register_indirection_prefix): Likewise. (stap_register_indirection_suffix): Likewise. (stap_gdb_register_prefix): Likewise. (stap_gdb_register_suffix): Likewise. (stap_is_single_operand): New function. (stap_parse_special_token): Likewise. (struct stap_parse_info): Forward declaration. * i386-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. (i386_elf_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * i386-tdep.h (i386_stap_is_single_operand): New function. (i386_stap_parse_special_token): Likewise. * machoread.c (macho_sym_fns): Add `sym_probe_fns' value. * mipsread.c (ecoff_sym_fns): Likewise. * objfiles.c (objfile_relocate1): Support relocation for static probes. * parse.c (prefixify_expression): Remove static declaration. (initialize_expout): Likewise. (reallocate_expout): Likewise. * parser-defs.h (initialize_expout): Declare function. (reallocate_expout): Likewise. (prefixify_expression): Likewise. * ppc-linux-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (ppc_stap_is_single_operand): New function. (ppc_stap_parse_special_token): Likewise. (ppc_linux_init_abi): Initializing proper fields used by SystemTap probes' arguments parser. * probe.c: New file, for generic statically defined probe support. * probe.h: Likewise. * s390-tdep.c: Including headers needed to perform the parsing of SystemTap probes' arguments. (s390_stap_is_single_operand): New function. (s390_gdbarch_init): Initializing proper fields used by SystemTap probes' arguments parser. * somread.c (som_sym_fns): Add `sym_probe_fns' value. * stap-probe.c: New file, for SystemTap probe support. * stap-probe.h: Likewise. * symfile.h: Include `gdb_vecs.h'. (struct sym_probe_fns): New struct. (struct sym_fns) <sym_probe_fns>: New field. * symtab.c (init_sal): Initialize `probe' field. * symtab.h (struct probe): Forward declaration. (struct symtab_and_line) <probe>: New field. * tracepoint.c (start_tracing): Adjust semaphore on breakpoints locations. (stop_tracing): Likewise. * xcoffread.c (xcoff_sym_fns): Add `sym_probe_fns' value.
2012-04-27 22:47:57 +02:00
}