Questions tagged [watchpoint]

Watchpoint is a point at which program executed via a debugger stops to let the programmer peek into memory and call stack or enter step by step execution mode.

98 questions
7
votes
1 answer

Setting a watchpoint on errno in gdb

I'm trying to find out when errno changes. At first, I tried "watch errno" in gdb, which led to the error Cannot find thread-local variables on this target I was able to fix this by compiling with "-pthread". However, it still doesn't work and I…
Hermann Speiche
  • 894
  • 1
  • 9
  • 16
6
votes
2 answers

Setting a watch point in GDB

I am operating a huge code base and want to monitor a value of a particular variable (which is buried deep down inside one of the files)especially when it gets set to zero. 1) Variable does not belong to global scope .Is there a better option than…
Manish
  • 1,729
  • 5
  • 32
  • 47
6
votes
1 answer

break *main VS break main() in GDB

what is the difference between break *main and break main() in essence? for example: #include using namespace std; int main() { int x=30; int y=40; x=y; return 0; } when I use break…
李鹏程
  • 81
  • 1
  • 4
6
votes
2 answers

XCode 4.5 watchpoints not working

I'm trying to debug C++ code in Xcode 4.5 on iOS, running the app on a connected iPad 2. I set a regular breakpoint on my code, and when I hit it, I look at my Local variables, click on a variable and select "Watch xxxxx". The lldb console shows:…
Marco83
  • 1,181
  • 1
  • 10
  • 28
6
votes
2 answers

Remove all hardware watchpoints in Linux kernel 3.0.0

After setting the first (and only possible) hardware watchpoint via watch varname in GDB, it's not possible to remove it via delete. Even if I just exit GDB, this watchpoint seems to be enabled till the next reboot. When I try to set another…
Sven
  • 7,335
  • 4
  • 15
  • 14
5
votes
2 answers

Watching local variables in gdb without stopping execution

I am attempting to have GDB print the value of a variable when it changes. Given an example program, I would like to get the value of x in func when it changes, but for the program to continue without prompt: #include #include…
Christian Gibbons
  • 4,272
  • 1
  • 16
  • 29
5
votes
1 answer

Setting watchpoints for large data structures in lldb

I am learning lldb and I am curious how you go about setting watchpoints for larger data structures for example a vector. I know that I can use print and that works but I get a message saying that watch points of size "x" are not supported. Is…
code kid
  • 374
  • 1
  • 6
  • 22
5
votes
3 answers

How to detect offending code for stack smashing error

In a complex program, I am encountering a stack smashing error, pasted below. I'm having trouble to find out where it happens. I located the function using printf-debugging, and noticed that the check actually happens during function return (the…
Bas Wijnen
  • 1,288
  • 1
  • 8
  • 17
5
votes
2 answers

How can I find out what is changing an object (or a simple variable) in Xcode 4 / lldb?

In some debuggers this is called "setting a trap" on a variable. What I want to do is trigger a breakpoint on any statement that changes the object. Or changes a property of the object. I have an NSMutableDictionary that gets a value/key added to it…
RobertL
  • 14,214
  • 11
  • 38
  • 44
4
votes
1 answer

Eclipse CDT cannot set watchpoint (always disabled - greyed out)

I cannot set a watchpoint in Eclipse (Photon) using CDT. According to this answer to this question about setting memory breakpoints in CDT, one should be able to set a watchpoint by doing the following: Highlight the variable in the editor, or…
Keith Morgan
  • 721
  • 7
  • 17
4
votes
1 answer

How to watch memory access with gdb on guest machine in qemu?

I can find instructions online to break on accesses to memory addresses using gdb (Watch a memory range in gdb?) but I can't figure out how to do so for memory addresses on the guest machine when I use qemu.
cstack
  • 2,152
  • 6
  • 28
  • 47
4
votes
1 answer

Want to watch consistently and examine occasionally the variable outside the current frame in gdb

Say I define a variable named varin the main function. And the I set a watchpoint to it. Then I enter another function called func(). At this time, the watchpoints may be deleted so that I have no access to that variable. Any method to make to…
walkerlala
  • 1,599
  • 1
  • 19
  • 32
4
votes
2 answers

What's the meaning of the EXC_BREAKPOINT code and subcode?

Usually when I set lldb watchpoints, when they're hit, lldb says watchpoint hit old value: new value. However, I set a watchpoint on an address that seems to be getting written to inside a 3rd party library (libjpeg-turbo) and instead of the usual…
Joey Carson
  • 2,973
  • 7
  • 36
  • 60
4
votes
5 answers

Linux C debugging library to detect memory corruptions

When working sometimes ago on an embedded system with a simple MMU, I used to program dynamically this MMU to detect memory corruptions. For instance, at some moment at runtime, the foo variable was overwritten with some unexpected data (probably by…
calandoa
  • 5,668
  • 2
  • 28
  • 25
4
votes
1 answer

Watchpoints in shared memory?

I'm debugging an issue in a patch to PostgreSQL where a word in shared memory seems to get overwritten unintentionally. Valgrind isn't any help as it can't keep track of interactions in shared memory between multiple processes. The address that gets…
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778