binutils-gdb/gdb/python
George Barrett bac7c5cf92 Fix scripted probe breakpoints
The documentation for make-breakpoint from the Guile API and the `spec'
variant of the gdb.Breakpoint constructor from the Python API state that
the format acceptable for location strings is the same as that accepted
by the break command. However, using the -probe qualifier at the
beginning of the location string causes a GDB internal error as it
attempts to decode a probe location in the wrong code path. Without this
functionality, there doesn't appear to be another way to set breakpoints
on probe points from Python or Guile scripts.

This patch introduces a new helper function that returns a
breakpoint_ops instance appropriate for a parsed location and updates
the Guile and Python bindings to use said function, rather than the
current hard-coded use of bkpt_breakpoint_ops. Since this logic is
duplicated in the handling of the `break' and `trace' commands, those
are also updated to call into the new helper function.

gdb/ChangeLog:
2019-12-10  George Barrett  <bob@bob131.so>

	Fix scripted probe breakpoints.
	* breakpoint.c (tracepoint_probe_breakpoint_ops): Move
	declaration forward.
	(breakpoint_ops_for_event_location_type)
	(breakpoint_ops_for_event_location): Add function definitions.
	(break_command_1, trace_command): Use
	breakpoint_ops_for_event_location.
	* breakpoint.h (breakpoint_ops_for_event_location): Add function
	declarations.
	* guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Use
	breakpoint_ops_for_event_location.
	* python/py-breakpoint.c (bppy_init): Use
	breakpoint_ops_for_event_location.

gdb/testsuite/ChangeLog:
2019-12-10  George Barrett  <bob@bob131.so>

	Test scripted probe breakpoints.
	* gdb.guile/scm-breakpoint.c (main): Add probe point.
	* gdb.python/py-breakpoint.c (main): Likewise.
	* gdb.guile/scm-breakpoint.exp (test_bkpt_probe): Add probe
	specifier test.
	* gdb.python/py-breakpoint.exp (test_bkpt_probe): Likewise.
2019-12-09 16:51:33 -05:00
..
lib/gdb [gdb/target] Fix pretty-printer for MPX bnd registers 2019-10-09 23:52:46 +02:00
py-all-events.def
py-arch.c
py-auto-load.c
py-block.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-bpevent.c
py-breakpoint.c Fix scripted probe breakpoints 2019-12-09 16:51:33 -05:00
py-cmd.c Allow . character as part of command names. 2019-11-30 09:37:49 +01:00
py-continueevent.c
py-event-types.def
py-event.c
py-event.h
py-events.h
py-evtregistry.c [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-frame.c
py-framefilter.c Replace SYMBOL_*_NAME accessors with member functions 2019-11-22 12:05:14 -06:00
py-function.c Let commands free "name" 2019-11-26 14:20:30 -07:00
py-gdb-readline.c Constify command_line_input 2019-11-08 06:59:36 -07:00
py-inferior.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-infevents.c
py-infthread.c
py-instruction.c
py-instruction.h [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
py-lazy-string.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-linetable.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-newobjfileevent.c
py-objfile.c
py-param.c
py-prettyprint.c
py-progspace.c gdb/python: Return None from Progspace.block_for_pc on error 2019-10-24 15:27:02 +01:00
py-record-btrace.c
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c
py-record.h
py-ref.h
py-signalevent.c
py-stopevent.c
py-stopevent.h
py-symbol.c Replace SYMBOL_*_NAME accessors with member functions 2019-11-22 12:05:14 -06:00
py-symtab.c Fix a bunch of python leaks due to missing calls to tp_free in *_dealloc functions. 2019-11-18 20:14:26 +01:00
py-threadevent.c
py-type.c Remove gdbarch parameter of lookup_typename 2019-12-05 13:44:30 -05:00
py-unwind.c
py-utils.c
py-value.c Remove la_get_string member 2019-11-05 15:36:28 -07:00
py-varobj.c
py-xmethods.c Remove gdbarch parameter of lookup_typename 2019-12-05 13:44:30 -05:00
python-config.py
python-internal.h gdb/python: Introduce gdb.lookup_static_symbols 2019-11-10 21:35:32 +00:00
python.c gdb: Introduce global_symbol_searcher 2019-11-27 12:01:47 +00:00
python.h