Questions tagged [gdb-python]

Questions related to GDB's Python API.

Questions related to GDB's Python API.

121 questions
3
votes
2 answers

How to invoke "bt" command using JDebug for bt stack trace option

I am using Jdebug system call using python and trying to automate the process of "bt" command as shown below. It consists of two steps. jdebug core-tarball.0.tgz Response received: Using '/tmp' as temporary location jdebug version: 5.0.0 [File is…
Ammad
  • 4,031
  • 12
  • 39
  • 62
3
votes
2 answers

Get address of a global symbol from symbol name with GDB Python API

Is there a way by which I can get the address of a global symbol in my binary if I know its name with the GDB Python API ? Is python print(gdb.parse_and_eval('symbol').address) the correct method t o obtain this value ?
sbunny
  • 433
  • 6
  • 25
3
votes
0 answers

How can I pass the data type in a generic linked list to the GDB print command?

I am writing a GDB pretty printer in Python for this linked list data structure: struct listNode { void *data; /* node's data */ struct listNode *next; /* next node in list …
Telgar
  • 153
  • 5
3
votes
1 answer

GDB hangs when multi-threaded python extension is used to debug multi threaded program

I'm trying to develop a GDB python extension that defines a command that launches a new thread, in which the user can inspect an arbitrary type of variables. The skeleton of my python extension is this: import gdb import threading def…
Claudio
  • 61
  • 8
3
votes
2 answers

How to convert a gdb Value to a python numeral object while debugging C program

I'm using python2.6's gdb module while debugging a C program, and would like to convert a gdb.Value instance into a python numeral object (variable) based off the instance's '.Type'. E.g. turn my C program's SomeStruct->some_float_val = 1./6; to a…
user3407196
3
votes
1 answer

How to identify specific GDB breakpoint in python code?

I am trying to script GDB with python. I have a GDB's native script file which sources a python script file. In the .gdb file I am declaring some breakpoints on different functions. I am able to perform next/step/continue over these breakpoints…
user2061944
  • 319
  • 1
  • 3
  • 11
3
votes
1 answer

gdb python: How to do arithmetic operation on a gdb.value?

why i am getting wrong answer while doing arithmetic operation: (gdb) python address = gdb.parse_and_eval('&(((struct my_struct *)next->priv).wait_list)') (gdb) python print address 0x410027a00728 (gdb) python offset = gdb.parse_and_eval('&((struct…
Baijnath Jaiswal
  • 377
  • 5
  • 17
3
votes
4 answers

container_of macro in gdb python

i am trying to access kernel linked list, the structure is struct my_struct { struct my_hardware_context ahw; struct net_device *netdev; struct pci_dev *pdev; struct list_head mac_list; struct list_head wait_list; .... .... }; using gdb, i am able…
Baijnath Jaiswal
  • 377
  • 5
  • 17
3
votes
2 answers

gdb python : How to redirect the output of a gdb command to a variable?

I am using RHEL 5.3 OS, gdb 7.5 and python 2.7. I am writing a script in Python to automate some gdb debugging steps. Can we store the output of the following command ("name1") into a variable? (gdb) p *(ptr->name) $13 = "name1" I want to do this…
Baijnath Jaiswal
  • 377
  • 5
  • 17
2
votes
0 answers

Viewing Data in Python Extensions GDB

Suppose I have a class: class RawMessage(NamedTuple): data: Dict timestamp: float ... The keys and values in this dictionary are probably all integers, but I don't want to state that with certainty. I additionally hvae a core dump file…
2
votes
0 answers

Put a breakpoint in shared library with GEF GDB

I want to put a breakpoint in a Linux share library in specific offset ( in libTest.so in function 0x1234 ) while I debugging with GEF GDB. But I want to put it with gdb script. If I run vmmap libTest.so I got [ Legend: Code | Heap | Stack…
Polo1990
  • 89
  • 3
2
votes
2 answers

How to set a gdb breakpoint on a label in all template function instantiations

Suppose I have the following C++: template int bar(int i) { ++i; label1: return I * i; } int main(int argc, char **) { return bar<2>(argc); } Is it possible to set a gdb breakpoint on label1 for all instantiations of bar? In the above,…
Luke Peterson
  • 931
  • 1
  • 9
  • 25
2
votes
0 answers

Is there a gdb python API for 'info symbol'?

I'm trying to use info symbol $frameptr but in a gdb script. Is there an equivalent in the gdb python API?
BurntToast
  • 21
  • 1
2
votes
1 answer

Why does GDB not remove convenience variables?

Per the documentation here, gdb states: Function: gdb.set_convenience_variable (name, value) [...] If value is None, then the convenience variable is removed. but when I execute gdb.set_convenience_variable('foo',…
Chris Hunt
  • 3,840
  • 3
  • 30
  • 46
2
votes
2 answers

GDB: Pretty-Print class containing STL container

I'm trying to write a pretty-printer for a class containing a std::set of objects for which I'm also supplying my own pretty printer. Very basically, this is how my C++ code looks like: #include #include #include class…
Lukas Barth
  • 2,734
  • 18
  • 43
1
2
3
8 9