Compiler & Debugger
Depending on which operating system you are using for this class, you could be using one of two different C compilers and their corresponding debuggers.
Under macOS the default C compiler is
clang. Its debugger is therefore not
gdb, but rather
lldb. This compiler is a front-end to LLVM (Low-Level Virtual Machine), which then is compiled to the CPU target.
Debugging a program is an imperative skill and you simply must know how to do it. Littering your code with
printf()just isn't going to work at this level (especially not when we start compiling code for the MSP430).
Both debuggers work in generally the same way, it allows for the setting of breakpoints and the inspection of variables during runtime. Knowing how to do these two things should be sufficient to solve almost 90% of crashes. However, there are more powerful features available, below are some useful commands:
|Start Program with Arguments||
|Set a Breakpoint on a Function||
|Set a Breakpoint on a Line Number||
|Set a Breakpoint at a Memory Address||
|Print the Contents of a Register||
|Print a Variable in Scope||
|Examine the Contents of Memory||
See this page for a comparison between both debuggers and more advanced commands.