Questions tagged [gdb-python]

Questions related to GDB's Python API.

Questions related to GDB's Python API.

121 questions
1
vote
0 answers

How to make GDB + GEF print a list of local variables in context?

I am coming from debugging python3 using pudb3, which is a delight. Now I am trying to debug C code in gdb, and I am trying to get a similar experience. In order to get there, today I installed gef. It looks good, but after searching in the…
onlycparra
  • 607
  • 4
  • 22
1
vote
2 answers

GDB error raised: "no executable file specified"

I am trying to use gdb to debug a program that includes a module written in C++. I downloaded the latest version of gdb using homebrew. I tried to run the following command: (gdb) run Pyrh_test.py However, I get the following error: Starting…
1
vote
1 answer

How to start GDB for C++ called from Python?

I need to debug a C++ function that is called from Python code. How to start GDB (or better DDD) in such a way that it debugs the C++ code called from a given Python command line? The given Python command line is: python3 -m…
porton
  • 5,214
  • 11
  • 47
  • 95
1
vote
1 answer

Better text UI debugger for C++, like pudb for python

I'm trying to debug a large C++ project on Linux remotely, which is a little difficult to re-build via Visual Studio locally. Therefore I attempt to debug it via console. While, the gdb or gdb --tui or gdb-dashboard tools is not convenient for…
Tong
  • 83
  • 5
1
vote
1 answer

Is there any way to stop a background process when you enter pdb?

So, I have some code like this: class ProgressProc(multiprocessing.Process): def __init__(self): multiprocessing.Process.__init__(self) def run(self): while True: markProgress() …
1
vote
1 answer

gdb python disas - parse output

Setup: GDB running the internal python interpreter with a script. The content of the script runs the disas on some memory. I need the output of this command in a python string. How can I do this? Thought about logging, but it turned out that only…
Cutton Eye
  • 3,207
  • 3
  • 20
  • 39
1
vote
1 answer

How to convert gdb.TYPE_CODE_PTR to void * in C?

I have following 2 functions defined in a library: void print_root(topo *root){ int i; for (i=0; i<10; i++) { print_topo_arr(i,root); } } int add(int x, int y) { return (x+y); } I can call add() without any issues from…
1
vote
1 answer

Display a particular std::vector's element in GDB pretty printer

Suppose I have a simple struct: struct S { int index; const std::vector& vec; }; I want to write a pretty printer for GDB that would display vec[index] for an object of type S. This is how I do it now: class SPrinter: def…
Evg
  • 25,259
  • 5
  • 41
  • 83
1
vote
0 answers

Debugging for hard to recreate C bug. Dynamic breakpoint

I have a hard to recreate bug and I'm hoping to use a python GDB script to stop the process when the bug is detected (I'll run it in debug till the error is regenerated). In reference to Stray chars seen out of snprintf. I've currently made a script…
clamentjohn
  • 3,417
  • 2
  • 18
  • 42
1
vote
1 answer

Apply GDB FrameDecorator when stepping

I've written a frame filter that applies a FrameDecorator object to all frames, and it works for backtraces (when using the bt command). However, when I use up, down, or explicitly go to a frame like f 0, gdb prints the undecorated frame. Is there a…
Alexander Kondratskiy
  • 4,156
  • 2
  • 30
  • 51
1
vote
1 answer

gdb cracking && cryptanalysis CTF

hello guys i am playing CTF and i have to crack a program to get shell the source code is : /* * gcc ch21.c -lcrypt -o ch21 */ #include #include #include #include #include #include…
mahmoudadel
  • 157
  • 1
  • 2
  • 11
1
vote
0 answers

gdb how to continue exec with stdin args with continue command

i am playing ctf and the program is checking if input is proccess pid then get shell now i getpid with gdb-peda by getpid command of gdb-peda how i can continue exec with stdin args that i will input the pid within it ? i have tried gdb> break…
mahmoudadel
  • 157
  • 1
  • 2
  • 11
1
vote
1 answer

Python multiprocessing.Manager dict containing value a list

I am sharing a dictionary between processes and each process inserts a entry into the dict, where the value for the keys in the dictionary can be a list or a gdb.Value instance. Each processes is doing something like this mydict["key"] = [[2],…
PMat
  • 2,039
  • 2
  • 29
  • 46
1
vote
1 answer

Is there any way to obtain type's alignment in GDB's Python API (or directly in GDB)?

For a pretty-printer that I'm writing, I would like to know the alignment or the type which is used in a container. Unfortunately using alignof() or any similar "standard" operator doesn't work…
Freddie Chopin
  • 8,440
  • 2
  • 28
  • 58
1
vote
2 answers

Using gdb's Python to backtrace different OS threads, when gdb is not OS-aware

I am still learning about debugging C using python within gdb (arm-none-eabi-gdb, in my case). I am trying to use this facility to get thread information of a real-time OS running on ARM Cortex-M. Reading some OS structures, I can access the thread…
hesham_EE
  • 1,125
  • 13
  • 24
1 2 3
8 9