For debugging Python code I use PDB++. It is a nice drop-in replacement for PDB and allows me (in sticky mode) to step through code and interact with it in a text terminal in a visual way.
However, when a Python program is already running, it is not…
There is gdb.lookup_type("SomeType") in GDB python API as listed blow, but I cannot find a way to get the source file and line number where the type is defined, much like what the GDB command info types ^SomeType$ does. Is it possible via GDB python…
I've loaded up two versions of a C++ library in gdb, opened up the built-in Python interpreter, and run
import gdb
gdb.lookup_type('Foo')
In one version, it works just fine. However, in the other, I get
gdb.error: No type named…
I am creating a GDB TUI python extension for embedded debugging. The python script is being run by the GDB. Trying to create a handler for register_changed event in GDB according to the documentation like so:
def reg_changed_handler(event):
…
I am trying to debug an aarch64 Linux kernel loaded in QEMU from x86 host. When 'lx-symbols' command executed for loading the symbols from gdb, it has shown
Undefined command: "lx-symbols"
The I have tried executing 'add-auto-load-safe-path'…
I'm writing a debug script for GDB using python and faced some weird behavior. I made a mistake somewhere in the script and everything that got printed when calling this command from GDB was:
(gdb) some-command
Python Exception …
I want to pretty print this struct struct MyStruct { char buffer[16]; }. Depending on buffer[15] I want to print buffer as a 10 byte string or treat it as a pointer. The 10 byte case is simple and works return self.val['buffer'].string(length =…
I'm using python to analysis a core dump, and there is a variable named my_map having type std:map. I have got the gdb.Value object:
py_val = gdb.parse_and_eval('my_map')
and when I tried to iterate it with following code:
for…
I have a Python program that is feeding JSON input to a binary running in GDB which then reads that input using the C function fread().
The problem is that fread() needs a EOF/Ctrl-D to stop reading but the JSON input I am passing to the binary in…
I recently compiled gdb to 12.1 and attempted to install gef via the following cmd bash -c "$(curl -fsSL https://gef.blah.cat/sh)"
the code on line 52 in the image is import abc
the screenshot can be viewed here https://i.stack.imgur.com/vuGk7.png
I am trying to make some automation testing with an embedded application running in an ARM Microcontroller. For the I/O exchange I have setup the Semihosting using arm-none-eabi-gdb as GDB client:
arm-none-eabi-gdb my_binary.axf -ex "target…
In gdb currently I can print the contents of a container, such as std::list, which contains a structure type. This type, however, is quite large and I need only values of some selected fields in every item from the container. So, let's say, I have a…
I have a structure that wraps a std::map, whcih gdb knows how to pretty-print.
I want to write a custom pretty-printer (with python), that delegates to the inner std:::map and maybe shows the count of existing entries in the map (and hoping that…
In gdb's Values From Inferior documentation, there's a second constructor for creating objects within python. It states:
Function: Value.__init__ (val, type)
This second form of the gdb.Value constructor returns a gdb.Value of type type where the…
I want to get the address from a value in the same way that the x examine command works. Internally, this seems to use value_as_address, which turns any gdb expression into a core address. I have not managed to find a binding for this anywhere in…