put breakpoint when variable changes

Sysprogs forums Forums VisualGDB put breakpoint when variable changes

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #8767
    b.timofte
    Participant

    I have a variable modified by some process in c++

    How do i put a breakpoint who will stop when variable is changed ?

    I dont know where its changed

    I tried Debug->New Breakpoint->Data Breakpoint… but its greyed out

     

    #8769
    b.timofte
    Participant

    I managed to put the breakpoint at runtime , but when i try to enable it i receve an error from VS something about garbage data returned, and then the breakpoint is rejected

    #8837
    support
    Keymaster

    Hi,

    Please try the new v5.2 Preview 2. It contains a workaround against this and also adds a context menu to the memory window to create data breakpoints.

    #22025
    Jensa
    Participant

    Hi,

    I tried to add data breakpoints today when running VisualGDB build 2436 but they don’t seem to get hit even though that memory is written to. Is this still working or am I doing something wrong?

    Tried both manually and using the context menu mentioned above but they are not hit when the memory is written to.

    Regards
    Jens Nilsson

    #22037
    support
    Keymaster

    Hi,

    This might be caused by VisualGDB not determining the variable address correctly, or by the target simply not supporting memory breakpoints.

    Please try running the gdb’s watch command manually via the GDB Session window. If it doesn’t work either, your target may not support it. Feel free to let us know the target type (Embedded/Linux/Android) and the debugger configuration (direct/gdbserver) you are using so we could suggest a few other things to try.

    If watchpoints work when created manually, but don’t when created with VisualGDB, please try setting them using both ways and send us a diagnostic GDB log showing both the commands entered manually (that work) and the commands issued by VisualGDB (that don’t) so we could see what could be causing the difference.

    #22062
    Jensa
    Participant

    Hi,

    I tried it with the watch command and the command was successful but the watchpoint was still not hit then either.
    After some googling I found I could change to SW watchpoints with the “set can-use-hw-watchpoints 0” and then they work. Unfortunately everything is way too slow then for my real applications so it doesn’t work there either.

    The target type is Linux and I’m using a gdbserver. The target is a yocto based linux distribution on a imx6dl CPU which should theoretically support HW watchpoints. Unfortunately that’s beyond my embedded linux knowledge.

    Thanks for trying!

    #22070
    support
    Keymaster

    Hi,

    Thanks for clarifying this. If set can-use-hw-watchpoints affects the behavior, it is indeed caused by the target limitations (e.g. the kernel might not be allowing the user-mode code to access debug registers required for hardware watchpoints). We would advise trying to run gdb on the target manually with a test program. If the hardware breakpoints work there, the problem might instead be caused by an incompatibility between gdb an gdbserver, and trying a different combination of those components might solve it.

    #22074
    Jensa
    Participant

    Hi,

    We managed to find the bug without HW breakpoints now. But we’ll probably get to the point where we need it again and I’ll try the suggestions again then.

    Thanks!

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