Does "conditional watchpoint" exist in gdb?

This is a discussion on Does "conditional watchpoint" exist in gdb? within the C++ Programming forums, part of the General Programming Boards category; Hi, Is there anyway to set "conditional watchpoint", like "watch var1 if var1==0"? In my case, the condition does't work. ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    159

    Does "conditional watchpoint" exist in gdb?

    Hi,
    Is there anyway to set "conditional watchpoint", like "watch var1 if var1==0"? In my case, the condition does't work. gdb stops whenever var1's value is changed, instead of untill "var1==0" is true. My gdb is GNU gdb 6.8-debian.

    Thanks and regards!

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,581
    IIRC, and I can't test it right now, watch conditions will still inspect and break at variable change. The only difference is that the watch result will include 'True' or 'False' information letting you know of the state of your condition.

    What you do want to do is instead create a conditional breakpoint.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. buffered vs unbuffered question
    By Overworked_PhD in forum Linux Programming
    Replies: 6
    Last Post: 07-04-2008, 05:57 PM
  2. Memory allocation error
    By cunnus88 in forum C++ Programming
    Replies: 5
    Last Post: 01-25-2008, 04:24 PM
  3. Contiguous Array version of Linked List
    By ampersand11 in forum C Programming
    Replies: 19
    Last Post: 10-07-2007, 04:05 AM
  4. Too much output in GDB
    By MacNilly in forum Tech Board
    Replies: 0
    Last Post: 09-13-2006, 01:45 PM
  5. does gdb lie?
    By dinjas in forum C Programming
    Replies: 8
    Last Post: 03-10-2005, 05:17 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21