This chapter provides an introduction to debugging OOMMF and OOMMF extension source code, providing background to the OOMMF build architecture and detailing some tools and techniques for uncovering programming errors. It begins with a look at the OOMMF pimake application used for compiling and linking OOMMF programs, followed by some considerations involving the oommf.tcl bootstrap wrapper. Then configuration files governing build and runtime behavior are detailed. After this methods for identifying and locating runtime errors are presented, including a brief introduction on using debugger applications with OOMMF. Although the primary focus of this chapter is on errors in C++ code, the interface and glue code linking the various OOMMF applications rely on Tcl script. An example of working with Tcl in OOMMF is provided in Fig. 5.1
Throughout this chapter, unless otherwise stated, commands are implicitly assumed to be run from the OOMMF root directory (i.e. the directory containing the file oommf.tcl), and directory paths are taken relative to this directory (e.g., app/oxs/ refers to the directory <oommf_root>/app/oxs/).
In text blocks containing command statements and program output,
command statements are indicated with a leading character
representing the shell command prompt. On Windows this character is
typically “>
”, whereas the Unix and macOS shells more commonly
use “$
” with bash shells or “%
” with
zsh. All three are used below, but “%
” is limited to
macOS specific examples to minimize confusion with the Tcl command
prompt, which is also “%
”. For additional visibility shell
commands are colored cyan and program commands
(Tcl and debugger) are colored red. (Computer
responses remain in black text.)
Some details in what follows may vary depending on the particular operating system and application version, but hopefully the differences are sufficiently small that this description remains a useful guide.