cancel
Showing results for 
Search instead for 
Did you mean: 

Debug - watch variable error

NicRoberts
Associate III

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

3 REPLIES 3

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.

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


@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.