platformio / platformio-vscode-ide

PlatformIO IDE for VSCode: The next generation integrated development environment for IoT
https://marketplace.visualstudio.com/items?itemName=platformio.platformio-ide
Apache License 2.0
1.22k stars 195 forks source link

memset() crashes debugger when size element is a variable on SAMD21 #1681

Open ASL07 opened 4 years ago

ASL07 commented 4 years ago

Hi I am debugging a SAMD21 mcu (Arduino mkr) Whenever the code reaches a memset() and the size arg is a variable, the debugger crashes with var-create error

This is really annoying, is there any workaround?

Please, see below a crash on Arduino Core the RingBuffer class

image

ASL07 commented 4 years ago

I have tested this using Cortex debug in VSCode, and it works without any problems

reese-grimsley commented 3 years ago

I believe I am seeing a similar issue myself with a custom D51 board. I am curious if anyone ever found a fix for this, but in my case, the issue is that memset (or memcp or snprintf or many other standard functions) will attempt to branch to some strange location that doesn't actually pertain to where that function would be expected to go. This usually generates a hardfault as it tries executing some nonsense bits as instructions.

Unclear if this is from PIO or not, but that standard library is coming from somewhere, and compiler directives to not link the standard library (-nostdlib) has no impact.