• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What about a conditional print?
 
Greenhorn
Posts: 18
jQuery Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe this helps

FAQ How do I set a conditional breakpoint?

netbeans has something like this
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like a NetBeans-related question which would sit better on our IDEs forum. Moving.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic