binutils-gdb/gdb/testsuite/gdb.guile
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
..
guile.exp [gdb/testsuite] Remove superfluous 3rd argument from gdb_test call (2) 2019-10-31 23:03:25 +01:00
scm-arch.c
scm-arch.exp
scm-block.c
scm-block.exp
scm-breakpoint.c Fix scripted probe breakpoints 2019-12-09 16:51:33 -05:00
scm-breakpoint.exp Fix scripted probe breakpoints 2019-12-09 16:51:33 -05:00
scm-cmd.c
scm-cmd.exp
scm-disasm.c
scm-disasm.exp
scm-equal.c
scm-equal.exp
scm-error-1.scm
scm-error-2.scm
scm-error.exp
scm-frame-args.c
scm-frame-args.exp
scm-frame-args.scm
scm-frame-inline.c
scm-frame-inline.exp
scm-frame.c
scm-frame.exp
scm-gsmob.exp
scm-iterator.c
scm-iterator.exp
scm-lazy-string.c
scm-lazy-string.exp
scm-math.c
scm-math.exp
scm-objfile-script-gdb.in
scm-objfile-script.c
scm-objfile-script.exp
scm-objfile.c
scm-objfile.exp
scm-parameter.exp
scm-ports.c
scm-ports.exp
scm-pretty-print.c
scm-pretty-print.exp
scm-pretty-print.scm
scm-progspace.c
scm-progspace.exp
scm-section-script.c
scm-section-script.exp
scm-section-script.scm
scm-symbol.c
scm-symbol.exp
scm-symtab-2.c
scm-symtab.c
scm-symtab.exp
scm-type.c
scm-type.exp
scm-value-cc.cc
scm-value-cc.exp
scm-value.c
scm-value.exp
source2.scm
types-module.cc
types-module.exp