Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last affectation (right before the END) can't be visualized in debugger #4

Open
Kurairaito opened this issue Jun 23, 2017 · 1 comment

Comments

@Kurairaito
Copy link
Contributor

Kurairaito commented Jun 23, 2017

With the folowing procedure :

DELIMITER //
CREATE PROCEDURE `test_procedure2`() NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER BEGIN
	DECLARE test_TINYINT TINYINT;
	SET test_TINYINT = 1;
	SET test_TINYINT = 2;
	SET test_TINYINT = 3;
END//
DELIMITER ;

when executing :

DELIMITER //
$install
$setup test_procedure2
$debug test_procedure2();
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;

you will have the folowing output value :

test_TINYINT = null
test_TINYINT = 1
test_TINYINT = 2 (old_value =1)
test_TINYINT = 2 (old_value =1)

instead of

test_TINYINT = null
test_TINYINT = 1
test_TINYINT = 2 (old_value =1)
test_TINYINT = 3 (old_value =2)

Edited to replace boolean by tinyint as value 2 and 3 could be confusing for a boolean value.... (even if boolean doesn't exist in SQL)

@pgulutzan
Copy link
Member

Actually it's not a bug.
If you look at the Debugger status line you will see
"
result: debuggee_wait_loop ended)(STOPPED AT ROUTINE EXIT)
"
If you look at the result of $refresh variables you will see the message
"
mysql>$refresh variables;
Routine has stopped. Suggested next step is: $EXIT
"

One way to look at it is:
$refresh can only work if you're at a breakpoint.
Breakpoints can only happen for executable statements.
But there are no executable statements because the procedure ended.

One way to work around it is:
Put an executable statement at the end and put a breakpoint on it.

I will keep this open as a feature request by
setting the "enhancement" label.
It might be possible to add an option for
"breakpoint on routine exit" or
"always refresh variables on routine exit".
If multiple people request this, it will be expedited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants