Skip to content
Snippets Groups Projects
  • George Barrett's avatar
    bac7c5cf
    Fix scripted probe breakpoints · bac7c5cf
    George Barrett authored
    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.
    bac7c5cf
    History
    Fix scripted probe breakpoints
    George Barrett authored
    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.