mirror of
https://github.com/Hizenberg469/GDB-tutorial.git
synced 2026-04-19 22:02:23 +03:00
24 lines
449 B
Plaintext
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. |