Watches / Data breakpoints

216 views
Skip to first unread message

Stephen Illingworth

unread,
Sep 26, 2019, 3:58:56 AM9/26/19
to golan...@googlegroups.com
Hi all,

I have an awkward bug I'm trying to understand and I'm missing something in my toolbox. Is there any way of monitoring a variable for changes made to it? For example, I have a pointer type and I want a debugger to break whenever its value (ie. what it points to) changes.

I call this a "watch" but I believe it's sometimes referred to as a "data breakpoint".

I've looked at delve and can't see anything like it. I've had a quick look at VSCode and Goland and I can't see anything there either. Is there anything I've missed?

Help

Stephen Illingworth.

David Finkel

unread,
Sep 26, 2019, 6:51:31 PM9/26/19
to Stephen Illingworth, golang-nuts
I don't see anything in Delve's docs either.
I'm pretty sure VSCode and Goland use Delve, so they won't work if Delve doesn't.

With that said, I think gdb works to some extent with Go, and it supports "watchpoints": https://sourceware.org/gdb/current/onlinedocs/gdb/Set-Watchpoints.html#Set-Watchpoints  (Note: I haven't tried debugging a go binary with gdb, so I can't do much more than point you at the manual)

Help

Stephen Illingworth.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAPmHGLPa0sgU9NkewBmZKhqVV-fZaaAni8Uaq%2BY_aUQstSEeYA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages