1

This is a general (and probably very naive) question about setting and using breakpoints in debugging. (I happen to be using PhpStorm and Xdebug to debug a php web page, but I think the question may be more general than that).

I've noticed that if I want to evaluate a variable while debugging, I have to set a breakpoint on a line after the variable I want to evaluate. But what if there are no further lines of code in the file? What is the "best practice" for that situation? Currently, I'm just adding echo ""; after my variable line, and breaking on that. That is working, but surely that's not the right way, is it?

3
  • Can you step over or into the last line? Is the problem that the debugger stops when it hits the end of the file? Commented Jul 8, 2018 at 22:05
  • Ah! That worked! I set the breakpoint on the line that contains the variable, then stepped over a few times, and all of the variables filled in. Thank you for the help. I realize this is a very newbie question, but the answer is invaluable. Commented Jul 8, 2018 at 22:10
  • No problem, stepping is very useful in debuggers. Commented Jul 8, 2018 at 22:12

1 Answer 1

1

As Devon pointed out in the comments, the answer is to set the breakpoint on the line that contains the variable I wanted, then Step Over a few times to allow the variable to evaluate.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.