Sysprogs forums › Forums › VisualGDB › put breakpoint when variable changes
- This topic has 7 replies, 3 voices, and was last updated 6 years, 3 months ago by Jensa.
-
AuthorPosts
-
August 10, 2016 at 15:07 #8767b.timofteParticipant
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
August 10, 2016 at 22:43 #8769b.timofteParticipantI 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
August 14, 2016 at 03:45 #8837supportKeymasterHi,
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.
September 20, 2018 at 16:29 #22025JensaParticipantHi,
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 NilssonSeptember 21, 2018 at 22:18 #22037supportKeymasterHi,
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.
September 24, 2018 at 07:54 #22062JensaParticipantHi,
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!
September 25, 2018 at 01:52 #22070supportKeymasterHi,
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.
September 25, 2018 at 10:13 #22074JensaParticipantHi,
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!
-
AuthorPosts
- You must be logged in to reply to this topic.