Commit Graph

8 Commits

Author SHA1 Message Date
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Sergio Durigan Junior 08a6411c71 Sanitize access to gdbarch on the SDT probe API (and fix ARM bug)
This patch sanitizes the access to gdbarch made by various functions of
the SDT probe API.  Before this patch, gdbarch was being accessed via
the probe's objfile; however, this proved to cause a bug on 32-bit ARM
targets because during the parsing of the probe's arguments the code
needed to access some pseudo-registers of the architecture, and this
information is not fully correct on the objfile's gdbarch.

Basically, the approach taken was to instead pass the current/selected
frame to the parsing and evaluation functions, so that they can extract
the gdbarch directly from the frame.  It solved the ARM bug reported
above, and also contributed to make the API cleaner.

Tested on x86_64 and 32-bit ARM.

2013-12-11  Sergio Durigan Junior  <sergiodj@redhat.com>

	* break-catch-throw.c (fetch_probe_arguments): Pass selected frame
	to get_probe_argument_count and evaluate_probe_argument.
	* probe.c (get_probe_argument_count): Adjust declaration to accept
	frame.  Pass frame to probe_ops's get_probe_argument_count.
	(evaluate_probe_argument): Likewise, for evaluate_probe_argument.
	(probe_safe_evaluate_at_pc): Pass frame to
	get_probe_argument_count and evaluate_probe_argument.
	* probe.h (struct probe_ops) <get_probe_argument_count,
	evaluate_probe_argument>: Adjust declarations to accept frame.
	(get_probe_argument_count, evaluate_probe_argument): Likewise.
	* solib-svr4.c (solib_event_probe_action): Get current frame.
	Pass it to get_probe_argument_count.
	(svr4_handle_solib_event): Get current frame.  Pass it to
	get_probe_argument_count and evaluate_probe_argument.
	* stap-probe.c (stap_parse_probe_arguments): Adjust declaration to
	accept gdbarch.  Do not obtain it from the probe's objfile.
	(stap_get_probe_argument_count): Adjust declaration to accept
	frame.  Obtain gdbarch from the frame.  Call generic
	can_evaluate_probe_arguments.  Pass gdbarch to
	stap_parse_probe_arguments.
	(stap_get_arg): Adjust declaration to accept gdbarch.  Pass it to
	stap_parse_probe_arguments.
	(stap_evaluate_probe_argument): Adjust declaration to accept
	frame.  Obtain gdbarch from the frame.  Pass gdbarch to
	stap_get_arg.
	(stap_compile_to_ax): Pass agent_expr's gdbarch to stap_get_arg.
	(compute_probe_arg): Obtain gdbarch from frame.  Pass frame to
	get_probe_argument_count and evaluate_probe_argument.
2013-12-10 23:59:00 -02:00
Tom Tromey 37fbcad0be remove some sym_probe_fns methods
While looking into the probe API, it seemed to me that there were a
number of methods in sym_probe_fns that were not needed.  This patch
removes them.

Specifically, it seems to me that sym_probe_fns ought to be concerned
with the API for constructing the probes.  Any method relating to some
aspect of an individual probe can be handled via the probe's own
vtable.  That is, the double indirection here doesn't seem useful --
it certainly isn't in fact used, but also I couldn't think of a
potential use.

2013-12-06  Tom Tromey  <tromey@redhat.com>

	* break-catch-throw.c (fetch_probe_arguments): Use
	get_probe_argument_count and evaluate_probe_argument.
	* elfread.c (elf_get_probe_argument_count)
	(elf_can_evaluate_probe_arguments, elf_evaluate_probe_argument)
	(elf_compile_to_ax): Remove.
	(elf_probe_fns): Update.
	* probe.c (get_probe_argument_count, can_evaluate_probe_arguments)
	(evaluate_probe_argument): Call method on probe, not via sym
	functions.
	* stap-probe.c (compute_probe_arg): Use get_probe_argument_count,
	evaluate_probe_argument.
	(compile_probe_arg): Use get_probe_argument_count.  Call method on
	probe, not via sym functions.
	* symfile-debug.c (debug_sym_get_probe_argument_count)
	(debug_can_evaluate_probe_arguments)
	(debug_sym_evaluate_probe_argument, debug_sym_compile_to_ax):
	Remove.
	(debug_sym_probe_fns): Remove.
	* symfile.h (struct sym_probe_fns) <sym_get_probe_argument_count,
	can_evaluate_probe_arguments, sym_evaluate_probe_argument,
	sym_compile_to_ax>: Remove fields.
2013-12-06 08:57:55 -07:00
Tom Tromey cc16e6c915 PR c++/13588:
* NEWS: Update.
	* break-catch-throw.c (struct exception_catchpoint)
	<exception_rx, pattern>: New fields.
	(fetch_probe_arguments, dtor_exception_catchpoint)
	(check_status_exception_catchpoint)
	(print_one_detail_exception_catchpoint): New functions.
	(handle_gnu_v3_exceptions): Add "except_rx" argument.
	Compile regular expression if needed.
	(extract_exception_regexp): New function.
	(catch_exception_command_1): Use extract_exception_regexp.
	(compute_exception): Use fetch_probe_arguments.
	(initialize_throw_catchpoint_ops): Set dtor, print_one_detail,
	and check_status fields.
	* cp-abi.c (cplus_typename_from_type_info): New function.
	* cp-abi.h (cplus_typename_from_type_info): Declare.
	(struct cp_abi_ops) <get_typename_from_type_info>: New field.
	* gdb_regex.h (compile_rx_or_error): Declare.
	* gnu-v3-abi.c (gnuv3_get_typename_from_type_info): Update
	comment.
	(init_gnuv3_ops): Set get_type_from_type_info field.
	* probe.c (compile_rx_or_error): Move...
	* utils.c (compile_rx_or_error): ... here.
gdb/doc
	* gdb.texinfo (Set Catchpoints): Document regexp syntax for
	exception catchpoints.
gdb/testsuite
	* gdb.cp/exceptprint.exp: Add regexp catchpoint tests.
2013-04-15 18:13:01 +00:00
Tom Tromey 72f1fe8a88 PR c++/15176:
* NEWS: Update.
	* break-catch-throw.c (compute_exception): New function.
	(exception_funcs): New global.
	(_initialize_break_catch_throw): Create $_exception.
	* cp-abi.c (cplus_type_from_type_info): New function.
	* cp-abi.h (cplus_type_from_type_info): Declare.
	(struct cp_abi_ops) <get_type_from_type_info>: New field.
	* gnu-v3-abi.c (gnuv3_get_typename_from_type_info)
	(gnuv3_get_type_from_type_info): New functions.
	(init_gnuv3_ops): Set get_type_from_type_info ABI field.
gdb/doc
	* gdb.texinfo (Set Catchpoints): Document $_exception.
	(Convenience Vars): Mention $_exception.
gdb/testsuite
	* gdb.base/default.exp: Update for $_exception.
	* gdb.cp/exceptprint.cc: New file.
	* gdb.cp/exceptprint.exp: New file.
	* lib/gdb.exp (skip_libstdcxx_probe_tests): New proc.
2013-04-15 18:09:02 +00:00
Tom Tromey fc4746a2bd * break-catch-throw.c (struct exception_names): New.
(exception_functions): Change type.
	(re_set_exception_catchpoint): Look for SDT probes.
2013-04-15 18:06:42 +00:00
Tom Tromey 15a73f5615 PR c++/10119:
* break-catch-throw.c (exception_functions): New global.
	(gnu_v3_exception_catchpoint_ops): Move earlier.
	(struct exception_catchpoint): New.
	(classify_exception_breakpoint): Rewrite.
	(re_set_exception_catchpoint): New function.
	(handle_gnu_v3_exceptions): Return void.  Use init_catchpoint.
	Allocate a struct exception_catchpoint.
	(catch_exception_command_1): Update.
	(initialize_throw_catchpoint_ops): Set 're_set' method.
2013-04-15 18:05:48 +00:00
Tom Tromey 916703c090 * Makefile.in (SFILES): Add break-catch-throw.c
(COMMON_OBS): Add break-catch-throw.o.
	* break-catch-throw.c: New file.
	* breakpoint.c: Move exception-catching code to new file.
	(ep_parse_optional_if_clause): No longer static.
	* breakpoint.h (ep_parse_optional_if_clause): Declare.
2013-04-15 18:04:53 +00:00