Section 12: More Interactive Debugging --> complete

This commit is contained in:
2025-10-28 22:45:29 +05:30
parent 4f4acf03e8
commit 5370ed1d5d
5 changed files with 803 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
= *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.