1

I am using eclipse for developing my java application .

I am debugging something . I wish to know if while stepping through we can escape one statement to be escaped to be run . I.e. while debugging I wish to see behaviour of my application if that statement was not present . I do not want to run debug again with that statement commented out :)

MAG
  • 2,841
  • 6
  • 27
  • 47

1 Answers1

0

IMHO there is no direct solution for this, But,

  1. Java debugger supports hot code replacement, so just comment out the code you want to skip while debugging. After saving the file debug point will be move back to the current method starting point. If the statement to be commented is far away from the method starting point then keep one break point just one statement before. When debug cursor move back to the method starting point you can press F8 to come to your point of interest quickly.

    Note that hot code replacement NOT works always. There are some limitation to this.

  2. Cover the statement or block of statements to be skipped with and if statement, Ex int flag = 1; if (flag == 0) { //Statements to be skipped. } Keep the break point at the line with the statement int flag = 1; and change the value of this variable to 0 when debugger points suspends at this point in Variables view.

Also refer this post How to skip loops while debugging Java code?

Community
  • 1
  • 1
Chandrayya G K
  • 8,719
  • 5
  • 40
  • 68