Questions tagged [gdb-python]

Questions related to GDB's Python API.

Questions related to GDB's Python API.

121 questions
0
votes
2 answers

Running gud-pdb with conda environment

How can I run pdb from emacs on a file that is activated in a given conda environment. I have setup exec-path and PATH to contain the current conda path, eg. exec-path ("~/miniconda3/envs/sci/bin" ...) (getenv…
Rorschach
  • 31,301
  • 5
  • 78
  • 129
0
votes
1 answer

Programatically detect what breakpoint was reached with GDB

I have a script which debugs my application and it does set 2 breakpoints. If I would be debugging it manually I would be able to see which one got triggered. But doing it in an automatic manner, I don't know which breakpoint was reached, is there a…
Anton Krug
  • 1,555
  • 2
  • 19
  • 32
0
votes
1 answer

debug MATLAB mex from gdb via Python API

I know the process for debugging MATLAB mex files on Linux with gdb, as described here: https://www.mathworks.com/help/matlab/matlab_external/debugging-on-linux-platforms.html This process involves starting MATLAB via command line with matlab…
brneuro
  • 326
  • 1
  • 5
  • 15
0
votes
1 answer

calling gdb print from python script

I have a python gdb script that finds a pointer to some important value. I want to call gdb print command to have this value assigned to value history for future references in other debug commands. How to do it? I know that I can define python…
uuu777
  • 765
  • 4
  • 21
0
votes
0 answers

gdb cannot load Python

I get this warning/error message when launching gdb. It disabled some features. Anyone has a fixed? Thanks. Could not load the Python gdb module from/usr/local/share/gdb/python'.`
0
votes
0 answers

How to pass variables to sys.args? (python gdb script)

I want to pass command line arguments to sys.args (to a gdb python script). I saw this solution but would like pass arbitrary number of arguments. Like: gdb --batch -x myScript.py 2 3 4 12 23 .. myScript.py: import gdb import…
pmundt
  • 57
  • 9
0
votes
1 answer

How to return a gdb.Value() from a string?

Consider the following gdb commands that output the same text string. (gdb) print foo (gdb) python print(gdb.lookup_symbol('foo')) In this case gdb.lookup_symbol() returns a gdb.Value() instance as expected, and the stringification of it is…
Dov Grobgeld
  • 4,783
  • 1
  • 25
  • 36
0
votes
0 answers

Pretty printing eats Chinese characters

I used MinGW's gdb-python27.exe. Chinese characters are not displayed correctly, when using string. Such as string s1="a的"; Finally, it is shown as a, and the input GDB command is also shown as a in Eclipse CDT:
陈林熙
  • 21
  • 1
  • 4
0
votes
1 answer

Create new parameters with Gdb Python API

I can't figure out how to fully define a new parameter using the Python API in Gdb. A script that I source contains the following: python param = gdb.Parameter("test", gdb.COMMAND_NONE, gdb.PARAM_OPTIONAL_FILENAME) param.set_doc = "This is the…
gospes
  • 3,819
  • 1
  • 28
  • 31
0
votes
1 answer

Tracing instructions with GDB Python scripting

I am trying to write a Python script for GDB to trace a function. The idea is to set a breakpoint on an address location, let the program run and then, when it breaks, log to file registers, vectors and stack and find out what address the next…
Valerio Santinelli
  • 1,592
  • 2
  • 27
  • 45
0
votes
1 answer

gdb Python API: exceptions disappearing?

Does anyone know why, in certain places, Python code inside of gdb doesn't properly handle exceptions? Or, to clarify, perhaps the exception message is going somewhere other than the *gud buffer. gdb is not returning control to the prompt, as…
Geof Sawaya
  • 55
  • 2
  • 7
0
votes
1 answer

perl like Data::Dumper alternative for gdb

Does something like Data::Dumper exists in gdb? How can I pretty print complex C structures e.g. what if I have array of arrays which elements are some structures? I've read about scripting gdb with python but don't know if it can do this?
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
0
votes
1 answer

GDB python script for bounded instruction tracing

I'm trying to write a GDB script to do instruction tracing in a bounded maner (i.e start addr and stop addr). Perhaps I'm failing at google but I cant seem to find this in existence already. Here is my stab at it: python def start_logging(): …
Without Me It Just Aweso
  • 4,593
  • 10
  • 35
  • 53
0
votes
1 answer

How to step through code line-by-line with python and examine the stack

I am trying to set up a python script in gdb that steps through a program one line at a time and records the stack pointer at each step. I have been searching all over for some good online references for gdb-python scripting and have not been able…
Kevin
  • 2,112
  • 14
  • 15
0
votes
1 answer

gdb-python: why below code is not working under gdb?

below code is working fine as a python code(without gdb module), but it is not working inside gdb? #!/usr/bin/env python import csv import gdb list = [] x = open("file.txt") with x as csv_data: entries = csv.reader(csv_data, delimiter=",") …
Baijnath Jaiswal
  • 377
  • 5
  • 17
1 2 3
8
9