<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>This will add a traced variable named "layer" (the name is just for your information), which tracks the memory location of <code>layer_state</code>. It tracks 4 bytes (the size of <code>layer_state</code>), so any modification to the variable will be reported. By default you can not specify a size bigger than 4, but you can change it by adding <code>MAX_VARIABLE_TRACE_SIZE=x</code> to the end of the make command line.</p><p>In order to actually detect changes to the variables you should call <code>VERIFY_TRACED_VARIABLES</code> around the code that you think that modifies the variable. If a variable is modified it will tell you between which two <code>VERIFY_TRACED_VARIABLES</code> calls the modification happened. You can then add more calls to track it down further. I don't recommend spamming the codebase with calls. It's better to start with a few, and then keep adding them in a binary search fashion. You can also delete the ones you don't need, as each call need to store the file name and line number in the ROM, so you can run out of memory if you add too many calls.</p><p>Also remember to delete all the tracing code once you have found the bug, as you wouldn't want to create a pull request with tracing code.</p></div></div></main><footerclass="VPDocFooter"data-v-39a288b8data-v-09de1c0f><!--[--><!--]--><!----><navclass="prev-next"data-v-09de1c0f><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link prev"href="/feature_layouts"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Previous page</span><spanclass="title"data-v-09de1c0f>Community Layouts</span><!--]--></a></div><divclass="pager"data-v-09de1c0f><aclass="VPLink link pager-link next"href="/ref_functions"data-v-09de1c0f><!--[--><spanclass="desc"data-v-09de1c0f>Next page</span><spanclass="title"data-v-09de1c0f>Useful Functions</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><!----><!--[--><!--]--></div></div>