Files
GDB-tutorial/GDB-and-Python-Basics.adoc

24 lines
449 B
Plaintext

= *GDB and Python Basics*
=== Using Python within GDB
Different ways to invoke python in GDB.
[source,]
----
(gdb) python
>print('hi')
>end
hi
(gdb) python print('hi')
hi
(gdb) pi
>>> print('hi')
hi
>>>
----
To exit out of python interactive mode in GDB we can use Ctrl-D.
We can write python script using gdb library in python to automate
some functionality in gdb and execute the python script in gdb
using `(gdb)source <python-file>` command.