Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does qt have a watch variable debugging function

I try to observe when a member of a class get changed in QTCreator 5.2 but I do not find any relevant function like "watch variable" in Eclipse.

Does anyone know weather there's any alternative way to watch a variable's value changes?

like image 312
user2984297 Avatar asked Jul 16 '14 16:07

user2984297


People also ask

What is a watch debugging?

The debugger watches a variable through the content of a storage address, computed at the time the watch condition is set. When the content at the storage address is changed from the value it had when the watch condition was set or when the last watch condition occurred, a breakpoint is set, and the program stops.

What is a variable watch?

Any item of data within a program that a programmer wants to observe when debugging. Watch variables may be viewed while the program runs on its own, is stepped through instruction by instruction or when the program crashes. Setting watch variables is part of the debugging operation in a compiler.


1 Answers

You can use data breakpoints for this. You need:

  1. Right-click in the Breakpoints view to open the context menu, and select Add Breakpoint.
  2. In the Breakpoint type field, select Break on data access at fixed address.
  3. In the Address field, specify the address of the memory block.
  4. Select OK.

If the address is displayed in the Locals and Expressions view, you can select Add Data Breakpoint at Object's Address in the context menu to set the data breakpoint.

You can read more here Qt Documentation: Interacting with the Debugger

like image 128
Yola Avatar answered Oct 01 '22 23:10

Yola