COMP 530: Tools

Familiarity with your environment is crucial for productive development and debugging. This page gives a brief overview of useful GDB commands. We still recommend reading the GDB manual, as this is a powerful tool worth knowing how to use.

All of the tools that you need to execute and complete the labs should be installed on department Linux machines.

If you wish to compile and run the tools on your own machine, t any standard Linux development environment should work. Note that we cannot guarantee that these tools will run on your computer, and we cannot support these tools on your own computer.

GDB
530 Debugging tips:

GDB

See the GDB manual for a full guide to GDB commands. Here are some particularly useful commands for 530, some of which don't typically come up outside of OS development.

Ctrl-c
Halt the machine and break in to GDB at the current instruction.
c (or continue)
Continue execution until the next breakpoint or Ctrl-c.
si (or stepi)
Execute one machine instruction.
b function or b file:line (or breakpoint)
Set a breakpoint at the given function or line.
b *addr (or breakpoint)
Set a breakpoint at the EIP addr.
set print pretty
Enable pretty-printing of arrays and structs.
info registers
Print the general purpose registers, eip, eflags, and the segment selectors.
x/Nx addr
Display a hex dump of N words starting at virtual address addr. If N is omitted, it defaults to 1. addr can be any expression.
x/Ni addr
Display the N assembly instructions starting at addr. Using $eip as addr will display the instructions at the current instruction pointer.
symbol-file file
Switch to symbol file file. For user-level code, GDB is often smart enough to find the correct symbols, but this command can be handy when symbols do not resolve properly. If the machine is running user code, say hello.c, you can switch to the hello symbol file using symbol-file obj/user/hello.

Last updated: 2022-11-03 10:50:48 -0400 [validate xhtml]