diff --git a/recitation/gdb-walkthrough.md b/recitation/gdb-walkthrough.md index f1b5e26..ef85b1e 100644 --- a/recitation/gdb-walkthrough.md +++ b/recitation/gdb-walkthrough.md @@ -82,7 +82,7 @@ You will notice that the object file has three sections. The `.text` section con Loads a program and lets you examine it while running including setting breakpoints, examining register contents, examining variables, changing values and so forth. ### Example -Create a file called `add.c` with the following contents: +Update `add.c` with the following contents: ``` #include @@ -104,7 +104,7 @@ gcc -O0 -fno-asynchronous-unwind-tables -fno-pie -no-pie -ggdb add.c Start gdb by specifying the program to be debugged on the command line. ``` -**gdb** a.out +gdb a.out ``` ### Common GDB Commands @@ -121,7 +121,9 @@ Once GDB is loaded you type commands to debug the code. Here are some of the mos * `step`
Step through the next source code line, diving into functions when called * `next`
Step through the next source code line skipping over function calls * `info registers`
Show the contents of all registers -* `set`
Set the value of a variable or register +* `print a`
Print the value of a variable +* `set $rax = 42`
Set the value of a register +* `set var a = 42`
Set the value of a variable * `layout asm`
Change the screen layout to show the disassembly. * `layout regs`
Change the screen layout to show the registers. * `set disassembly-flavor intel`
Disassemble in Intel syntax