• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

debug - breakpoint -- only stop when a variable is a certain value?

 
Ben David
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I want to debug a program that runs through a lot of loops within loops. I want to set a break point, but the iteration I want to look at is hundreds of iterations in.

Is there a way to set a conditional breakpoint? So that it will only stop at the breakpoint when a variable I specify has a value that I specify?

 
Campbell Ritchie
Sheriff
Pie
Posts: 48938
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about a conditional print?
 
Ernesto Chicas
Greenhorn
Posts: 18
Debian Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe this helps

FAQ How do I set a conditional breakpoint?

netbeans has something like this
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ben,

As you can see, the answer to 'can I' is "yes" -- but the answer to 'how can I' depends entirely on what debugger (i.e., what development tools) you're using, which you neglected to mention. Let us know and somebody can probably tell you exactly what to do.
 
Ben David
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest Friedman-Hill wrote:Hi Ben,

As you can see, the answer to 'can I' is "yes" -- but the answer to 'how can I' depends entirely on what debugger (i.e., what development tools) you're using, which you neglected to mention. Let us know and somebody can probably tell you exactly what to do.


oops!! -- my bad!! I was totally meant to say I was using netbeans, but failed to get that into the post!

Anyway Ernesto Chicas comment helped me out. Dont know why i didnt try right clicking the breakpoint after setting it. I can then click "properties" and have a box where I can set the condition.


Thanks all!


 
Campbell Ritchie
Sheriff
Pie
Posts: 48938
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like a NetBeans-related question which would sit better on our IDEs forum. Moving.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic