Using gdb with XMTC code

For a general introduction to gdb command usage visit this gdb tutorial

1. "Serialize" your code using xmtcser. For example if you had test.c, you would enter "xmtcser test.c". By default the output will be test.serialized.c
2. Compile using gcc and the -g flag: gcc -g test.serialized.c -o myprogram
3. Run gdb: gdb myprogram
- Set a breakpoint, for example enter "break main" at the gdb prompt
- Run the program by typing "run"
- "step" through (review the gdb tutorial above for assistance)
- You may also type print VARNAME to output the current state of a variable in the program.


For more detailed usage of gdb, be sure to review the general gdb tutorial

For another way of checking the final contents of a variable, take a look at -textdump and -dumpvar options in xmtsim
Back to class page