If you are working on macOS, you may be building OOMMF with g++ or clang++. The native debugger for clang++ is lldb, which is included as part of the Xcode package. Both g++ and clang++ use the same debugging symbol format, so in principle you should be able to use either debugger with either compiler, but if you have problems with one try the other.
The lldb debugger is a command-line debugger very similar in concept to gdb, and although the command syntax is somewhat different, lldb provides a fair number of aliases to ease the transition for veteran gdb users. Fig. 5.6 lists a few of the more common lldb commands, and Figs. 5.7 and 5.8 illustrate an lldb debugging session analogous to the gdb session presented in Figs. 5.4 and 5.5.
Shell command: lldb [-c corefile (opt)] darwin/oxs | ||
Command | Abbr. | Description |
Process control | ||
process launch -- [args] | r [args] | run executable with args |
process launch | r | run executable with last args |
settings show target.run-args | display current args | |
settings set target.env-vars | env FOO=bar | set envr. variable FOO to “bar” |
FOO=bar | ||
Ctrl-C | stop and return to (lldb) prompt | |
process kill | kill | terminate current run |
quit | exit lldb | |
Introspection | ||
thread backtrace | bt | stack trace of current thread |
frame select 5 | f 5 | change to stack frame 5 |
frame variable | print args & vars for current frame | |
frame variable foo | p foo | print value of variable foo |
source list -f foo.cc -l 50 | l foo.cc:50 | list source after line 50 of foo.cc |
source list | l | list next ten lines |
source list -r | l - | list preceding ten lines |
source list -c 20 | list 20 lines | |
Flow control | ||
breakpoint set | set breakpoint at line 99 of foo.cc | |
--file foo.cc --line 99 | ||
breakpoint set | break at C++ routine foo::bar() | |
--name foo::bar | ||
breakpoint list | br l | list breakpoints |
breakpoint delete 4 | br del 4 | delete breakpoint 4 |
breakpoint delete | br del | delete all breakpoints |
breakpoint modify -i 100 3 | skip breakpoint 3 100 times | |
breakpoint modify -c i> 7 3 |
break if i> 7 at breakpoint 3 |
|
watchpoint set variable foo | break when foo changes value | |
thread continue | c | continue running |
thread step-in | s | take one step, into subroutines |
thread step-over | n | take one step, over subroutines |
thread step-out | finish | run to end of current subroutine |
Threads | ||
thread list | list all threads | |
thread select 2 | switch context to thread 2 |