Printing PyObject while in gdb

Hi,

I wanted to debug CPython source using gdb, however when I step into the function and do a back trace I get some functions as follows,

in _PyEval_EvalFrameDefault ()
in _PyEval_EvalFrame ()
in _PyEval_Vector ()
in _PyFunction_Vectorcall ()

and these functions contain PyObjects, how to know what those objects contain exactly, is there any way to see this?

I want to print the contents of PyObject, ex if a PyObject is for some integer, I want to print that integer value or see that integer value. any help would be appreciated.

Looks like you probably want the repr of the object? PyObject_Repr should give you that.

1 Like

yep this is the one, thank you Chris.

1 Like