give me 15 minutes and i'll change your view of gdb

6
Copyright Undo Ltd, 2015 Give me fifteen minutes and I’ll change your view of GDB Greg Law Co-founder and CEO, Undo software

Upload: gregthelaw

Post on 13-Apr-2017

785 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

Give me fifteen minutes and I’ll change your view of GDB

Greg LawCo-founder and CEO, Undo software

Page 2: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

GDB - more than you knew

GDB may not be intuitive but it is very powerful▪ Easy to use, just not so easy to learn

Page 3: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

GDB - more than you knew

GDB may not be intuitive but it is very powerful▪ Easy to use, just not so easy to learn

TUI: Text User Interface▪ As useful as it is poorly named!

Page 4: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

GDB - more than you knew

GDB may not be intuitive but it is very powerful▪ Easy to use, just not so easy to learn

TUI: Text User Interface▪ As useful as it is poorly named!

Python: automate your debugging!

Page 5: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

GDB - more than you knew

GDB may not be intuitive but it is very powerful▪ Easy to use, just not so easy to learn

TUI: Text User Interface▪ As useful as it is poorly named!

Python: automate your debugging!Reversible debugging: how did that happen?

Page 6: Give me 15 minutes and i'll change your view of gdb

Copyright Undo Ltd, 2015

Other cool things...

▪ tbreak temporary breakpoint▪ rbreak reg-ex breakpoint▪ break xxx if yyy conditionally break at xxx if condition yyy holds▪ commands list of commands to be executed when a breakpoint is hit▪ silent special command to suppress output on breakpoint hit▪ save breakpoints save a list of breakpoints to a script▪ save history save history of executed gdb commands▪ call call a function in the inferior▪ watch -l watchpoint based on address (location)▪ rwatch read watchpoint▪ info line foo.c:42 show PC for line▪ info line * $pc show line begin/end for current program counter▪ thread apply all bt backtrace for every thread▪ dprintf dynamic printf▪ python: define custom commands by inheriting from gdb.Command class▪ python: hook events to invoke python functions using gdb.events.stop.connect▪ gcc’s -g and -O are orthogonal