UP | HOME

Code Generation: Variables, Assignment, and Expressions
Lecture 10

Table of Contents

Functions

Registers

X86 instructions

Using GDB

Use gdb to step through your simplec output program. First, install it with

sudo apt install gdb

Clone and install this useful gdb assistant called peda. Make sure you have already compiled your simplec program as shown in "Using your compiler" above. Then step through the program like so:

gdb a.out
set disassembly-flavor att
# once inside of gdb
b main # set a breakpoint at main
run # start the program.  it will wait at main
si # step through each assembly instruction
# continue stepping through to track the behavior

If you've downloaded and installed peda, you will see the assembly code, registers, and stack displayed after each step.

Author: Paul Gazzillo

Created: 2020-11-13 Fri 15:17