Skip to main content
Senior III
April 9, 2025
Solved

Debug - watch variable error

  • April 9, 2025
  • 1 reply
  • 424 views

I'm trying to debug my UART debug code. I suspect that I have calculated the Baud rate incorrectly.

I run the code in debug & I'm trying to view the value in `what_baud` but the debugger isn't having it, see below.

NicRoberts_0-1744210631725.png

How do I do this correctly?

 

Best answer by NicRoberts

It was a context issue, I can see it when I'm stepping through the function where it exists.

1 reply

Andrew Neil
Super User
April 9, 2025

Probably your what_baud variable has been optimised-out - hence:

AndrewNeil_0-1744211364068.png

 

You could try making it volatile

Or just watch the whole expression.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
NicRobertsAuthorBest answer
Senior III
April 10, 2025

It was a context issue, I can see it when I'm stepping through the function where it exists.

Andrew Neil
Super User
April 10, 2025

@NicRoberts wrote:

I can see it when I'm stepping through the function where it exists.


Of course - the whole point of local variables is that they do not exist outside their function!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.