Questions tagged [gdb-python]

Questions related to GDB's Python API.

Questions related to GDB's Python API.

121 questions
1
vote
1 answer

gdb python module can't find any function of it's own

I compiled&installed gdb(7.1.1) from the source code by doing CC=gcc-6 ./configure --with-python=python3 && make then sudo make install. Then I invoked gdb from bash as usual. But when I tried to load my python script within gdb by doing source…
Korcan Karaokçu
  • 467
  • 4
  • 18
1
vote
1 answer

GDB Python resolve overloaded method

How do I look up overloaded methods in GDB using the python interface? I have a class which has several methods called 'el', one of which takes two ints. GDB is stopped at a breakpoint, with a member variable called _Dr in scope in the inferior…
Tom
  • 7,269
  • 1
  • 42
  • 69
1
vote
1 answer

Gdb Pretty Printer: *(char*){hex_address} equivalent in python

I have C++ classes in following format (copying just important parts): class my_stringimpl { public: static sample_string* create(const char* str, int len) { my_stringimpl* sample = static_cast(malloc(sizeof(my_stringimpl) +…
1
vote
1 answer

(gdb) p/x equivalent in gdb python script?

the main structure is struct my_struct { int x; void* md_template; void* md_capture_buff; .... }; When i am doing (gdb) p ((struct my_struct *)dev_base->next->priv) The output is like this $1 = { x= 15 '\017' md_template = , …
Baijnath Jaiswal
  • 377
  • 5
  • 17
1
vote
1 answer

Can I use stdout/stderr printout as a string, for pretty-printing?

I have a function dump() which, when invoked on an object of type X, prints out something useful to stderr. I'm trying to write a GDB pretty-print script that utilizes the output of some command to return a string describing a value, something along…
Oak
  • 26,231
  • 8
  • 93
  • 152
1
vote
1 answer

Core dump : Extract all the global variables , data structures and sub-structures from a core dump

how to extract all the global variables , data structures and sub-structures (with address, type and values) from core dump,using gdb-python, generated after crashing of a C code.?
Baijnath Jaiswal
  • 377
  • 5
  • 17
1
vote
1 answer

gdb python : Can anyone explain me how to use this script written in this post?

How to do it for a c code..? Is it possible..? I read this post. I also want to do similar things but i am not able to use the given updated script at link GDB-Python scripting: any samples iterating through C/C++ struct fields I followed the…
Baijnath Jaiswal
  • 377
  • 5
  • 17
0
votes
0 answers

Get the char* value with python gdb

With GDB and Python I tried to get the char* value on x1 register python a= gdb.execute("x/s $x1", to_string=True) print(a) end But I got 0xbb4aaa: "SomeString" I want to get only the SomeString without the address How can I do that directly…
python3.789
  • 164
  • 9
0
votes
0 answers

Get unique id of type using GDB Python API

I am writing some GDB extension using GDB Python API to be used for C++ applications. I need to write some index over detected types in debugged process/coredump. gdb.Type class has __eq__ defined but is not hashable thus can not be used as a key in…
tldr
  • 11
  • 1
0
votes
1 answer

How do I run GDB with the arguments I normally write in the terminal manually?

I have some program, the essence of which is to analyze crashes, it works with GDB. An example of how it works: I run an application in GDB which I want to analyze for crashes, then I load my program into GDB using "source", write "run" to make the…
0
votes
1 answer

Apply material and texture image using python in blender 3.4

Code is working it is importing my files and exporting into .glb format but issue when i open glb file it dose not contain texture image it shows grey... here is my code import bpy import os dir_path =…
0
votes
0 answers

Implement custom operators with GDB python API

As an example lets say I have a linked list implemented in C. Can I use the GDB python API to implement a custom array access operator so that I can get a value from the list like myList[0] while debugging? Have tried reading through the docs but…
YupDeDup
  • 41
  • 1
  • 3
0
votes
0 answers

writing a c++ script for using GDB commands and GDB results (like variable values) while running another c++ program

I need a c++ script to automate GDB debugging another c++ program. the c++ script has to be able to run gdb commands and get the results from it and use it inside the script to save variable values for later usage, my main questions are: is there a…
0
votes
0 answers

Python script to debug my binary using gdb on QNX OS

OS: QNX 11.1 Python: 3.10 Host OS: Windows SDP: qnx710 I'm trying to debug my application which will be running on QNX. When I execute the below python program, it doesn't execute os.system('file {}'.format(binpath)). It just stopped at gdb…
0
votes
0 answers

setting command alias through python API in gdb

I have written a small python script that adds new commands to gdb and for others to use it, they can just source the python file in their ~/.gdbinit, but I would now like to add some useful aliases to those commands. Right now I've added a README…
anirudh
  • 4,116
  • 2
  • 20
  • 35
1 2 3
8 9