Breakpoints – Conditional and Hit Count

Sysprogs forums Forums VisualGDB Breakpoints – Conditional and Hit Count

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #949
    robinwatts
    Participant

    Hi,

    I have been using VisualGDB both for remote debugging on Android and Linux. It’s now absolutely essential to me, and I’ve been recommending it to all my colleagues.

    One feature that I just cannot get to work though (and that I really miss) is the ability to set either conditional breakpoints, or breakpoints that trigger when the hit count reaches a certain point.

    Example 1: I have a program that dies in the ‘bar’ function. When I run the debugger I see that it has been called with param ‘baz’ having the value 57. I therefore put a breakpoint in the top of the ‘bar’ function and set the condition to be ‘baz == 57’. I then rerun the program. What *should* happen is that that the program will stop at the top of bar and allow me to step through it. What actually happens is that the breakpoint never triggers and we go straight to a crash.

    Example 2: I have a program that when I run it crashes in the ‘foo’ function. I put a breakpoint in the ‘foo’ function, and set it to trigger whenever the hit count >= 100000. I run the program, and when the program crashes, I can look to see that the hit count is now 65512. I then reset the breakpoint to trigger when the hit count >= 65512, and rerun the program. What *should* happen is that the program will stop at the top of foo just before it crashes. What actually happens is that the breakpoint never triggers and we go straight to a crash.

    Is there some reason why this functionality doesn’t work? Is it a limitation of gdb?

    Fixing this would make a massive difference to the usability of VisualGDB for me.

    Thanks,

    Robin

    #3491
    support
    Keymaster

    Hi,

    We actually do support conditional breakpoints and hit count. However you may encounter problems with this features if:
    * You are using an old gdb that does not support them
    * Your symbols do not have information about the variable you are using in the condition

    Please try reproducing it on a very simple scenario:

    
    for(int i = 0; i < 10; i++)
    {
    printf("%dn", i);
    }
    

    Your GDB log (GDB Session -> View Mode -> All GDB Interaction) should contain something similar to this:

    -break-insert -f /tmp/VisualGDB/e/PROJECTS/TEMP/LinuxProject9/LinuxProject9.cpp:19
    ^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x080488b8",func="main(int, char**)",file="LinuxProject9.cpp",fullname="/tmp/VisualGDB/e/PROJECTS/TEMP/LinuxProject9/LinuxProject9.cpp",line="19",thread-groups=["i1"],times="0",original-location="/tmp/VisualGDB/e/PROJECTS/TEMP/LinuxProject9/LinuxProject9.cpp:19"}
    -break-condition 2 i == 3
    

    If it does not work, do you see any error messages when VisualGDB sets the condition? If the basic sample scenario works, but the more complex one does not work, please recheck your symbols.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.