How working with user-defined commands in GDB can make you more productive

GDB versus the Python way

GDB built-in user-defined commands

(gdb) define bugreport
> set pagination off
> thread apply all backtrace full
> shell uname -a
> end
(gdb)
(gdb) bugreport
(gdb) define bugreport
> set pagination off
> set logging file /tmp/bugreport.txt
> set logging on
> thread apply all backtrace full
> shell uname -a
> set logging off
> end
(gdb)
(gdb) bugreport
(gdb) shell cat /tmp/bugreport.txt

GDB hook command

(gdb) define hook - run
> set arg 3
> end
(gdb)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Undo Bytes

Undo Bytes

Undo is the time travel debugging company for Linux. We equip developers with the technology to understand complex code and fix bugs faster. https://undo.io