Debugging variables /// erros in project but no errors shown

Technical questions regarding the XTC tools and programming with XMOS.
DemoniacMilk
XCore Addict
Posts: 191
Joined: Tue Jul 05, 2016 2:19 pm

Debugging variables /// erros in project but no errors shown

Post by DemoniacMilk »

I don't understand some of the debuggers behavior. There is another thread on this (some years old), but it didnt provide any help.

When the program reaches a breakpoint and I try to inspect the variables, it sometimes shows random values or nothing. Im compiling with "-O0 -g -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -report" flags.
HoverOverVariable.PNG
When hitting the breakpoint, uiCurrentBuffer is always shown as 265788, uiCharBufferPos always holds 0 instead of incrementing, I cannot access the values for uiTmpX.

It may or may not be the result of having code/build errors, as the IDE tells me, there were errors in the project, but it seems to compile correctly.
Im am setting all array elements in the buffer arrays to an initial value in a for-loop (for debug purposes), but changing this value doesnt have any effect, so I think the updated software is not being built and instead, an old version is uploaded? Is there a place other than the console that I might check for errors?
errorsExist.PNG
You do not have the required permissions to view the files attached to this post.


Gothmag
XCore Addict
Posts: 129
Joined: Wed May 11, 2016 3:50 pm

Post by Gothmag »

Unfortunately it switches to that view after building, you need to switch consoles back to the c/c++ build console to get the output of the debugger. I'm not sure where this behaviour is defined but I usually run into it also. Once in a while though... It doesn't leave build console. When you press the debug button though you will almost never be on the right console for build output.

As for viewing the value of variables during runtime you might find it easier to use printf statements ,they halt the cores but can be more useful. I believe by default and. When you break and view variables you get an Id, or memory address and need to check the value explicitly. You also need to make sure you're looking at the right thread since by defaultit only shows local variables for selected thread in debug view.
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

You should be able to add a lightweight print, such as printint (not printf), that won't disrupt the task too much if it's over xSCOPE rather than JTAG.

If print comes out with the right values, then it's probably a compiler/debugger issue.

It would be interesting to see if just adding the print makes a difference due to the altered program flow/register allocation.

Also, can you make sure it isn't a build related issue by doing a clean build?