man | RTFM (man is a fine manual) |
bochs | x86 emulator. Can be built with either an internal debugger (assembly) or a gdb stub (source-level). |
gdb | gdb debugger. Connect to bochs to facilitate source-level debugging. (Also works with many other emulators, virtual machines, and can run locally). |
less |
Many of the commands listed here output to the console. To scroll
through the output and search for text, pipe it through
less. You can find a string by typing
/thetext, then press enter. Usage:
$ verbose-command | less |
objdump |
Outputs an object file (ELF). Example usage:
$ objdump -M i8086,att -d file_16bit $ objdump -M att -d file_32bit $ objdump -M att -D file_32bitThe -M att flag causes the output to be in AT&T assembly syntax. The first example disassembles a 16 bit program (-M i8086). The second line ommits that flag, so the disassemby has a default size of 32 bits. The -d flag generates the disassembly; -D includes the data segments of the program, too. |
readelf | Output ELF file metadata. Useful when writing your createimage for Project 1. |
nm | Dump symbol addresses, linkage types, and names. Useful for setting break points in bochs or Qemu. Run this through awk to output symbols in a format that bochs can use... |
hexdump | Dump a file in hex, decimal, octal, and ascii in various widths. |
od | Dump a file in octal, decimal, hex, and ascii in various widths. Note: file offsets are in octal |
In general, testing your code on multiple computers is a good practice because each has a slightly different setup; there may be machine-specific settings which hide your bugs.
If you find that your code works in bochs, but not on other machines, consider these differences that are unique to bochs: