Skip to content

Instantly share code, notes, and snippets.

@srpatcha
Last active September 19, 2018 01:13
Show Gist options
  • Save srpatcha/cf9ef3f55a2b952149e6f36f914d6b71 to your computer and use it in GitHub Desktop.
Save srpatcha/cf9ef3f55a2b952149e6f36f914d6b71 to your computer and use it in GitHub Desktop.

Revisions

  1. srpatcha revised this gist Apr 9, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions GDB_debugging :
    Original file line number Diff line number Diff line change
    @@ -26,12 +26,12 @@ Run in our local machine for debugging: $ gdb a.out

    gdb) target remote target_machine_IP:2345

    gdb) b main
    gdb) b main

    gdb) c

    gdb) list

    gdb) print x
    gdb) print x

    Will print next 20 instructions on target gdb) x/20i $pc
  2. srpatcha created this gist Apr 9, 2018.
    37 changes: 37 additions & 0 deletions GDB_debugging :
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    Compile Source Code with -g to load debugging symbols :

    Example : gcc -g -o hellow helloworld.c


    GDB Debugging :

    $ gdb a.out

    gdb) b main

    gdb) c

    gdb) list

    gdb) print x

    gdb) x/20i $pc


    GDB Target Debugging :

    Run command on board (target_machine) : $ sudo ./gdbserver.i686 host:2345 a.out

    Run in our local machine for debugging: $ gdb a.out

    gdb) target remote target_machine_IP:2345

    gdb) b main

    gdb) c

    gdb) list

    gdb) print x

    Will print next 20 instructions on target gdb) x/20i $pc