mirror of
https://github.com/Hizenberg469/GDB-tutorial.git
synced 2026-04-19 22:02:23 +03:00
Section 12: More Interactive Debugging --> complete
This commit is contained in:
24
GDB-and-Python-Basics.adoc
Normal file
24
GDB-and-Python-Basics.adoc
Normal 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.
|
||||
Reference in New Issue
Block a user