Mbed Studio Debugging show wrong Source File and Line

hi,
i have a lot of trouble using the mbed studio debugger. i am using:

  • mbed os 6.9
  • target NUCLEO_F767ZI
  • build profile debug
  • mbed studio 1.4.1

i know, target NUCLEO_F767ZI is not yet officially supported for debugging, but in principle it works so far. the most relevant problems i have with the debugger is the following:

  • the debugger does often not show the correct location (file and line number) when halted, e.g. due to a break point.
  • the debugger does almost never show the local variables
  • the debugger sometimes simply unexpectedly quit when continue run, complaining receiving ctrl-c

here a screenshot of debugger showing wrong location:

  • debug console and call stack left hand name are correct
  • call stack right hand file and line number are wrong and completely unrelated
  • it points at the right source window lwip_api_msg.c which is wrong
  • the correct location would be the left source file (opened manually, just for showing)

since i am using a non-officially supported target for debugging, i can imagine that there could still be some problems in using the debugger. but the problems presented here are generic and fundamental, probably related to parsing map or elf file or something, and probably not due to using a specific target.

thanks for helping!

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

thanks for the quick reply.
i changed my project to -O0 according to your suggestion, but unfortunately this is not the whole story. I enable one breakpoint early in main, and run to there. here my observations:

  • it halts there
  • breakpoints window shows correct location
  • callstack window shows correctly “main”, but greyed out, and missing line number
  • source window shows no location

then, i click on step-into.

  • the debugger does not stop at all
  • looks like the board crashed, with the characteristic green LED flashing pattern
  • console says “single stepping until exit from function main”

thanks
oli4