rdebug_set_breakpoint

NAME

rdebug_set_breakpoint(): Set/clear a breakpoint

TYPE

Procedure

DESCRIPTION

This procedure is part of the rdebug API.

rdebug_set_breakpoint() sets or clears a specific breakpoint in a specified routine.

A breakpoint is indicated by breakpoint/statement ID, as can be listed via rdebug_show_routine() or rdebug_show_routine_statements().

A breakpoint may be conditional [NOTE: as yet unsupported], such that it only applies when some condition evaluates as true (e.g. 'my_loop_counter > 3').

Current implementation [NOTE: subject to change] associates breakpoints with debug sessions, so that concurrent debuggers can have different breakpoints on same routines, without affecting one another. As result, execution of this routine only makes sense on an active debugging session, i.e. after calling rdebug_start() [NOTE: subject to change].

SYNOPSIS

rdebug_set_breakpoint(
    in rdebug_routine_schema varchar(128) charset utf8,
    in rdebug_routine_name   varchar(128) charset utf8,
    in rdebug_statement_id   int unsigned,
    in rdebug_conditional_expression text charset utf8,
    in breakpoint_enabled bool
  )
  READS SQL DATA

Input:

  • rdebug_routine_schema: schema where routine is located.
  • rdebug_routine_name: name of routine schema.
  • rdebug_statement_id: name of routine where breakpoint applies.
  • rdebug_conditional_expression: AS YET UNSUPPORTED - expression to evaluate upon reaching breakpoint. The breakpoint holds only when the expression evaluates to TRUE value; otherwise the breakpoint is skipped by such commands as rdebug_run().
  • breakpoint_enabled: a TRUE/FALSE or 1/0 value to indicate whether the breakpoint should be set or cleared, respectively.

EXAMPLES

Show routine code with breakpoint positions (IDs), then set a breakpoint:

mysql> call rdebug_show_routine('test','analyze_continents');
+-------------------------------------------------------------+
| `test`.`analyze_continents` breakpoints                     |
+-------------------------------------------------------------+
| main_body: begin                                            |
|   declare done bool default false;                          |
|   declare current_continent varchar(32) default null;       |
|   declare continents_cursor cursor for                      |
|             select distinct continent from world.Country;   |
|   declare continue handler for not found set done := true;  |
|                                                             |
|   [:80]open continents_cursor;                              |
|   [:86]cursor_loop: while not done do                       |
|     [:98]fetch continents_cursor into current_continent;    |
|     [:108]if done then                                      |
|       [:115]leave cursor_loop;                              |
|     [:121]end if;                                           |
|     [:127]call analyze_continent_cities(current_continent); |
|   [:136]end while;                                          |
|   [:142]close continents_cursor;                            |
| [:147]end                                                   |
+-------------------------------------------------------------+

mysql> call rdebug_set_breakpoint('test', 'analyze_continents', 127, null, TRUE);

Remove the above breakpoint:

mysql> call rdebug_set_breakpoint('test', 'analyze_continents', 127, null, FALSE);

ENVIRONMENT

MySQL 5.1 or newer

SEE ALSO

rdebug_run(), rdebug_show_routine(), rdebug_show_routine_statements()

AUTHOR

Shlomi Noach
 
common_schema documentation