Post

Gdb Refresher

GDB Refresher

image

Compiling a c program and running it

1
gcc -g program.c -o program
  • To call run the debugger on the program now all you need to do is gdb program

Focus

  • You can change the focus of where the arrow keys interact with
    • Focus on the src
      • Focus src
    • Focus on the command line
      • Focus cmd

Layouts

  • show layout of the code image

  • You can change the focus of different parts of the gdb interface

    • show the actual code
      • layout src
        • image
    • show the registers
      • layout reg
        • image
    • show the assembly
      • layout asm
        • image

Printing

  • Printing the value that is stored in a variable
    • p/my_variable
  • Printing the memory location of a variable
    • x/1c &my_variable
    • x/1c my_ptr
This post is licensed under CC BY 4.0 by the author.