user2984297
user2984297

Reputation: 363

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?

Upvotes: 12

Views: 18545

Answers (2)

Yola
Yola

Reputation: 19033

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

Upvotes: 10

etr
etr

Reputation: 1262

You should be able to just hover at debug time and see the values. Check your preference setting at

Tools > Options > Debugger > General > “Use tooltips in main editor while debugging”

Upvotes: 0

Related Questions