Monday, July 28, 2014

Atollic debugging (Eclipse, gdb, etc)

First issue:  gdb runs but you can't step through the code.
Solution: gdb allocated too many breakpoints, and  HW breakpoint is necessary for single stepping.  Delete all breakpoints.

Second issue: gdb runs, but code never gets to main. seems to be stuck in the flash loader
Solution: code was not stuck in the flashloader, but in infinite loop of "abort()" within a static C++ constructor.
Things that were helpful:

    set verbose on

in gdb start-up script (Project Properties -> Run/Debug Settings -> Startup Scripts -> Debug)

Also, comment out continue at end of script

    #continue

so that debugger starts right after it loads the code. Also, replace "abort()" with https://github.com/scottt/debugbreak

No comments: