Mbed Studio Debugging show wrong Source File and Line

Hi Oliver,

I assume that you are using default ARMC6 toolchain instead of GC_ARM. It is due to the default optimisation in ARMC6 (-O1 flag). Some lines are optimised and may not exist in optimised code. That’s why you can see debugger stopping at lines that seems wrong to you. You can disable optimisation by:

  1. Opening profile in your program mbed-os/tools/profiles/debug.json
  2. Finding an -O1 in ARMC6/common:

  1. Replacing it with -O0:

  2. Rebuilding the project

Thanks,
Arek - Studio team