summaryrefslogtreecommitdiff
path: root/Tools/gdb/libpython.py
AgeCommit message (Collapse)AuthorLines
2018-10-15bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)Miss Islington (bot)-13/+33
python-gdb.py now handles errors on computing the line number of a Python frame. Changes: * PyFrameObjectPtr.current_line_num() now catchs any Exception on calling addr2line(), instead of failing with a surprising "<class 'TypeError'> 'FakeRepr' object is not subscriptable" error. * All callers of current_line_num() now handle current_line_num() returning None. * PyFrameObjectPtr.current_line() now also catchs IndexError on getting a line from the Python source file. (cherry picked from commit 2e438cc2554495b28480a3ffe5cdf41b6ab823a0) Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-06-15[3.7] bpo-32962: Backport python-gdb.py and test_gdb.py from master (GH-7710)Victor Stinner-12/+25
* bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692) python-gdb now catchs ValueError on read_var(): when Python has no debug symbols for example. (cherry picked from commit 019d33b7a447e78057842332fb5d3bad01922122) * bpo-32962: python-gdb catchs UnicodeDecodeError (GH-7693) python-gdb now catchs UnicodeDecodeError exceptions when calling string(). (cherry picked from commit d22fc0bc7de7882da204abe50884bbde2da4f9e7) * bpo-32962: Fix test_gdb failure in debug build with -mcet -fcf-protection -O0 (GH-6754) When Python is built with the intel control-flow protection flags, -mcet -fcf-protection, gdb is not able to read the stack without actually jumping inside the function. This means an extra 'next' command is required to make the $pc (program counter) enter the function and make the stack of the function exposed to gdb. (cherry picked from commit 9b7c74ca32d1bec7128d550a9ab1b2ddc7046287)
2018-04-20bpo-33312: update Tools/gdb/libpython.py to match. (GH-6549)Miss Islington (bot)-1/+1
(cherry picked from commit 53f67d401df40486fd0fb8fbcf9da725cd37290c)
2017-08-21bpo-30983: [gdb] Fix py-bt, etc. for non-debug shared builds (#3153)Łukasz Langa-9/+11
PEP 523 introduced _PyEval_EvalFrameDefault which inlines PyEval_EvalFrameEx on non-debug shared builds. This breaks the ability to use py-bt, py-up, and a few other Python-specific gdb integrations. This patch fixes the problem by only looking for _PyEval_EvalFrameDefault frames. test_gdb passes on both a debug and a non-debug build. Original patch by Bruno "Polaco" Penteado.
2017-08-16bpo-30983: Revert changes which broke most buildbots (#3100)Victor Stinner-4/+2
* Revert "Add Bruno Penteado to ACKS (#3091)" This reverts commit f978405b3f092e4005b92ba1dbaab15f609b3bb0. * Revert "bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (#2803)" This reverts commit 2e0f4db114424a00354eab889ba8f7334a2ab8f0.
2017-08-14bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (#2803)Bruno "Polaco" Penteado-2/+4
pep 0523 renames PyEval_EvalFrameEx to _PyEval_EvalFrameDefault while the gdb python extension only looks for PyEval_EvalFrameEx to understand if it is dealing with a frame. Final effect is that attaching gdb to a python3.6 process doesnt resolve python objects. Eg. py-list and py-bt dont work properly. This patch fixes that. Tested locally on python3.6
2017-05-18bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)Jon Dufresne-2/+2
* Replaced list(<generator expression>) with list comprehension * Replaced dict(<generator expression>) with dict comprehension * Replaced set(<list literal>) with set literal * Replaced builtin func(<list comprehension>) with func(<generator expression>) when supported (e.g. any(), all(), tuple(), min(), & max())
2017-03-01Fixes bpo-29680: Older gdb does not have gdb.error. (#363)Lev Abalkin-1/+1
This change is required to make python-dbg.py compatible with GDB versions before 7.3.
2017-02-03Issue #29263: LOAD_METHOD support for C methodsINADA Naoki-4/+1
Calling builtin method is at most 10% faster.
2017-02-01python-gdb.py supports method-wrapperVictor Stinner-5/+48
Issue #29367: python-gdb.py now supports also method-wrapper (wrapperobject) objects.
2017-01-18Update and enhance python-gdb.pyVictor Stinner-16/+10
Issue #29259: * Detect PyCFunction is the current frame, not only in the older frame * Ignore PyCFunction_Call() since it now calls _PyCFunction_FastCallDict(), and _PyCFunction_FastCallDict() is already detected
2017-01-18Fix Python 2.6 support in python-gdb.pyVictor Stinner-2/+2
Issue #29259.
2017-01-16Optimize _PyCFunction_FastCallKeywords()Victor Stinner-1/+2
Issue #29259: Write fast path in _PyCFunction_FastCallKeywords() for METH_FASTCALL, avoid the creation of a temporary dictionary for keyword arguments. Cleanup also _PyCFunction_FastCallDict(): * Don't dereference func before checking that it's not NULL * Move code to raise the "no keyword argument" exception into a new no_keyword_error label. Update python-gdb.py for the change.
2016-12-16Merge 3.5Victor Stinner-2/+18
2016-12-16python-gdb.py: catch gdb.error on gdb.selected_frame()Victor Stinner-2/+18
2016-11-22Issue #28770: Update python-gdb.py for fastcallsVictor Stinner-16/+31
Frame.is_other_python_frame() now also handles _PyCFunction_FastCallDict() frames. Thanks to the new code to handle fast calls, python-gdb.py is now also able to detect the <built-in id method of module ...> frame.
2016-11-22Issue #28023: Fix python-gdb.py on old GDB versionsVictor Stinner-2/+6
Replace int(value.address)+offset with value.cast(unsigned char*)+offset. It seems like int(value.address) fails on old versions of GDB.
2016-11-22Issue #28023: Fix python-gdb.py didn't support new dict implementationINADA Naoki-2/+26
2016-09-08Remove legacy "from __future__ import with_statement" lines.Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)-1/+1
2016-04-20gdb/libpython.py: inline _type_void_ptr()Victor Stinner-10/+4
The function was only called in _sizeof_void_p()
2016-04-20python-gdb.py: get C types at runtimeVictor Stinner-14/+33
Issue #26799: Fix python-gdb.py: don't get once C types when the Python code is loaded, but get C types on demande. The C types can change if python-gdb.py is loaded before the Python executable. Patch written by Thomas Ilsche.
2015-11-02Issue #25523: Correct "a" article to "an" articleMartin Panter-2/+2
This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
2014-01-16Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka-0/+0
requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts.
2014-01-16Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka-0/+0
requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang line to use python3 executable in the unittestgui script.
2013-11-23Undo (hopefully) buildbot failuresAntoine Pitrou-1/+1
2013-11-23Undo (hopefully) buildbot failuresAntoine Pitrou-1/+1
2013-11-23Issue #19308: fix the gdb plugin on gdbs linked with Python 3Antoine Pitrou-50/+67
2013-11-23Issue #19308: fix the gdb plugin on gdbs linked with Python 3Antoine Pitrou-50/+67
2013-08-29Issue #18743: Fix references to non-existant "StringIO" moduleSerhiy Storchaka-1/+1
in docstrings and comments.
2013-08-29Issue #18743: Fix references to non-existant "StringIO" moduleSerhiy Storchaka-1/+1
in docstrings and comments.
2013-08-26#18803: merge with 3.3.Ezio Melotti-1/+1
2013-08-26#18803: fix more typos. Patch by Févry Thibault.Ezio Melotti-1/+1
2013-08-24Issue #18772: fix the gdb plugin after the set implementation changesAntoine Pitrou-21/+19
2013-05-06#17833: merge with 3.3David Malcolm-1/+1
2013-05-06#17833: fix test_gdb failures seen on PPC64 Linux in test_threads ↵David Malcolm-1/+1
(test.test_gdb.PyBtTests)
2013-04-11python-gdb.py: Replace invalid Unicode character with U+FFFD to be able toVictor Stinner-1/+3
display invalid strings. Such strings can be found while Python is creating a new string, in a text decoder for example, when Python is compiled in debug mode.
2013-01-27Fix a few typos and a double semicolon. Patch by Eitan Adler.Ezio Melotti-1/+1
2012-10-09compare singletons by identity not equality (closes #16712)Benjamin Peterson-1/+1
Patch from Serhiy Storchaka.
2012-06-27Issue #12605: Show information on more C frames within gdb backtracesDavid Malcolm-9/+92
The gdb hooks for debugging CPython (within Tools/gdb) have been enhanced to show information on more C frames relevant to CPython within the "py-bt" and "py-bt-full" commands: * C frames that are waiting on the GIL * C frames that are garbage-collecting * C frames that are due to the invocation of a PyCFunction
2012-04-23Implement PEP 412: Key-sharing dictionaries (closes #13903)Benjamin Peterson-3/+8
Patch from Mark Shannon.
2011-12-19(Merge 3.2) Issue #13628: python-gdb.py is now able to retrieve more frames inVictor Stinner-13/+32
the Python traceback if Python is optimized. * delay the lookup of the size_t type, it is not available at startup * The second argument of the PyFrameObjectPtr constructor is optional, as done in other constructors * iter_builtins() and iter_globals() methods of PyFrameObjectPtr returns an empty tuple instead of None if Python is optimized * Fix py-bt and py-bt-full to handle correctly "optimized" frames * Frame.get_pyop() tries to get the frame pointer from PyEval_EvalCodeEx() if the pointer is optimized out in PyEval_EvalFrameEx()
2011-12-19Issue #13628: python-gdb.py is now able to retrieve more frames in the PythonVictor Stinner-13/+32
traceback if Python is optimized. * delay the lookup of the size_t type, it is not available at startup * The second argument of the PyFrameObjectPtr constructor is optional, as done in other constructors * iter_builtins() and iter_globals() methods of PyFrameObjectPtr returns an empty tuple instead of None if Python is optimized * Fix py-bt and py-bt-full to handle correctly "optimized" frames * Frame.get_pyop() tries to get the frame pointer from PyEval_EvalCodeEx() if the pointer is optimized out in PyEval_EvalFrameEx()
2011-12-12Fix test_gdb failureAntoine Pitrou-1/+0
2011-12-12Issue #13575: there is only one class type.Florent Xicluna-41/+3
2011-12-08libpython.py: defer call to gdb.lookup_type('PyUnicodeObject')Victor Stinner-1/+6
The lookup fails at startup if Python is linked to a shared library.
2011-11-04Oops, really fix gdb/libpython.py for not ready Unicode stringsVictor Stinner-1/+2
2011-11-04Fix gdb/libpython.py for not ready Unicode stringsVictor Stinner-5/+0
_PyUnicode_CheckConsistency() checks also hash and length value for not ready Unicode strings.
2011-10-08Fix test_gdb following the small unicode struct change in c25262e97304 ↵Antoine Pitrou-1/+1
(issue #13130)
2011-10-03PyUnicode_Ready() now sets ascii=1 if maxchar < 128Victor Stinner-2/+3
ascii=1 is no more reserved to PyASCIIObject. Use PyUnicode_IS_COMPACT_ASCII(obj) to check if obj is a PyASCIIObject (as before).
2011-09-28Update for PEP 393.Martin v. Löwis-12/+25