summaryrefslogtreecommitdiffstats
path: root/Tools/gdb
Commit message (Collapse)AuthorAgeFilesLines
* bpo-44990: Change layout of evaluation frames. "Layout B" (GH-27933)Mark Shannon2021-08-251-2/+4
| | | Places the locals between the specials and stack. This is the more "natural" layout for a C struct, makes the code simpler and gives a slight speedup (~1%)
* bpo-44590: Lazily allocate frame objects (GH-27077)Mark Shannon2021-07-261-27/+122
| | | | | | | | | | | | | | * Convert "specials" array to InterpreterFrame struct, adding f_lasti, f_state and other non-debug FrameObject fields to it. * Refactor, calls pushing the call to the interpreter upward toward _PyEval_Vector. * Compute f_back when on thread stack, only filling in value when frame object outlives stack invocation. * Move ownership of InterpreterFrame in generator from frame object to generator object. * Do not create frame objects for Python calls. * Do not create frame objects for generators.
* bpo-44032: Move pointer to code object from frame-object to frame specials ↵Mark Shannon2021-06-181-11/+14
| | | | array. (GH-26771)
* bpo-43693: Un-revert commits 2c1e258 and b2bf2bc. (gh-26577)Eric Snow2021-06-071-4/+6
| | | | | | | | | | These were reverted in gh-26530 (commit 17c4edc) due to refleaks. * 2c1e258 - Compute deref offsets in compiler (gh-25152) * b2bf2bc - Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388) This change fixes the refleaks. https://bugs.python.org/issue43693
* bpo-43693: Revert commits 2c1e2583fdc4db6b43d163239ea42b0e8394171f and ↵Pablo Galindo2021-06-041-6/+4
| | | | | | | | | | | | | b2bf2bc1ece673d387341e06c8d3c2bc6e259747 (GH-26530) * Revert "bpo-43693: Compute deref offsets in compiler (gh-25152)" This reverts commit b2bf2bc1ece673d387341e06c8d3c2bc6e259747. * Revert "bpo-43693: Add new internal code objects fields: co_fastlocalnames and co_fastlocalkinds. (gh-26388)" This reverts commit 2c1e2583fdc4db6b43d163239ea42b0e8394171f. These two commits are breaking the refleak buildbots.
* bpo-43693: Add new internal code objects fields: co_fastlocalnames and ↵Eric Snow2021-06-031-4/+6
| | | | | | | | | | | | | | | | | co_fastlocalkinds. (gh-26388) A number of places in the code base (notably ceval.c and frameobject.c) rely on mapping variable names to indices in the frame "locals plus" array (AKA fast locals), and thus opargs. Currently the compiler indirectly encodes that information on the code object as the tuples co_varnames, co_cellvars, and co_freevars. At runtime the dependent code must calculate the proper mapping from those, which isn't ideal and impacts performance-sensitive sections. This is something we can easily address in the compiler instead. This change addresses the situation by replacing internal use of co_varnames, etc. with a single combined tuple of names in locals-plus order, along with a minimal array mapping each to its kind (local vs. cell vs. free). These two new PyCodeObject fields, co_fastlocalnames and co_fastllocalkinds, are not exposed to Python code for now, but co_varnames, etc. are still available with the same values as before (though computed lazily). Aside from the (mild) performance impact, there are a number of other benefits: * there's now a clear, direct relationship between locals-plus and variables * code that relies on the locals-plus-to-name mapping is simpler * marshaled code objects are smaller and serialize/de-serialize faster Also note that we can take this approach further by expanding the possible values in co_fastlocalkinds to include specific argument types (e.g. positional-only, kwargs). Doing so would allow further speed-ups in _PyEval_MakeFrameVector(), which is where args get unpacked into the locals-plus array. It would also allow us to shrink marshaled code objects even further. https://bugs.python.org/issue43693
* bpo-44206: Add a version number to dictionary keys (GH-26333)Mark Shannon2021-05-281-1/+1
| | | | | | | | * Store log2(size) instead of size in dict-keys. * Use enum instead of function pointer to record kind of keys. * Add version number to dict keys.
* bpo-44032: Move data stack to thread from FrameObject. (GH-26076)Mark Shannon2021-05-211-3/+17
| | | | | | | | | | | | | | | | * Remove 'zombie' frames. We won't need them once we are allocating fixed-size frames. * Add co_nlocalplus field to code object to avoid recomputing size of locals + frees + cells. * Move locals, cells and freevars out of frame object into separate memory buffer. * Use per-threadstate allocated memory chunks for local variables. * Move globals and builtins from frame object to per-thread stack. * Move (slow) locals frame object to per-thread stack. * Move internal frame functions to internal header.
* bpo-27129: Use instruction offsets, not byte offsets, in bytecode and ↵Mark Shannon2021-04-011-1/+1
| | | | | | | internally. (GH-25069) * Use instruction offset, rather than bytecode offset. Streamlines interpreter dispatch a bit, and removes most EXTENDED_ARGs for jumps. * Change some uses of PyCode_Addr2Line to PyFrame_GetLineNumber
* closes bpo-42726: gdb libpython: InstanceProxy support for py3 (GH-23912)Augusto Hack2020-12-241-1/+1
| | | | | | | On Fedora 31 gdb is using python 3.7.9, calling `proxyval` on an instance with a dictionary fails because of the `dict.iteritems` usage. This PR changes the code to be compatible with py2 and py3. This changed seemed small enough to not need an issue and news blurb, if one is required please let me know. Automerge-Triggered-By: GH:benjaminp
* bpo-42246: Partial implementation of PEP 626. (GH-23113)Mark Shannon2020-11-121-4/+13
| | | * Implement new line number table format, as defined in PEP 626.
* bpo-42208: Fix test_gdb for gc_collect_main() name (GH-23041)Victor Stinner2020-10-301-2/+2
| | | | The gcmodule.c collect() function was renamed to gc_collect_main(): update gdb/libpython.py (python-gdb.py).
* bpo-40019: Skip test_gdb if Python was optimized (GH-19081)Victor Stinner2020-03-201-7/+9
| | | | test_gdb now skips tests if it detects that gdb failed to read debug information because the Python binary is optimized.
* bpo-36184: Port python-gdb.py to FreeBSD (GH-18873)Victor Stinner2020-03-091-1/+1
| | | | | | python-gdb.py now checks for "take_gil" function name to check if a frame tries to acquire the GIL, instead of checking for "pthread_cond_timedwait" which is specific to Linux and can be a different condition than the GIL.
* closes bpo-16637: libpython: construct integer object directly from gdbvalue ↵Marc Hartmayer2019-09-241-1/+1
| | | | | | | | (GH-15232) This fixes the exception '`ValueError: invalid literal for int() with base 10` if `str(gdbval)` returns a hexadecimal value (e.g. '0xa0'). This is the case if the output-radix is set to 16 in gdb. See https://sourceware.org/gdb/onlinedocs/gdb/Numbers.html for more information.
* bpo-37151: remove special case for PyCFunction from PyObject_Call (GH-14684)Jeroen Demeyer2019-09-111-1/+1
| | | | | | | bpo-37151: remove special case for PyCFunction from PyObject_Call Alse, make the undocumented function PyCFunction_Call an alias of PyObject_Call and deprecate it.
* bpo-36974: separate vectorcall functions for each calling convention (GH-13781)Jeroen Demeyer2019-07-051-2/+2
|
* bpo-37151: remove _PyCFunction_FastCallDict (GH-14269)Jeroen Demeyer2019-06-201-2/+1
|
* bpo-36974: rename _FastCallKeywords -> _Vectorcall (GH-13653)Jeroen Demeyer2019-05-301-1/+1
|
* bpo-36974: Fix GDB integration (GH-13665)Petr Viktorin2019-05-291-1/+2
| | | | | | | | | | | As it changes the way functions are called, the PEP 590 implementation skipped the functions that the GDB integration is looking for (by name) to find function calls. Looking for the new helper `cfunction_call_varargs` hopefully fixes the tests, and thus buildbots. The changed frame nuber in test_gdb is due to there being fewer C calls when calling a built-in method.
* bpo-35132: Fixes missing target in gdb pep0393 check. (GH-11848)Lisa Roach2019-03-121-1/+1
|
* bpo-34989: python-gdb.py: fix current_line_num() (GH-9889)Victor Stinner2018-10-151-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.
* bpo-32962: python-gdb catchs UnicodeDecodeError (GH-7693)Victor Stinner2018-06-141-10/+16
| | | | python-gdb now catchs UnicodeDecodeError exceptions when calling string().
* bpo-32962: python-gdb catchs ValueError on read_var() (GH-7692)Victor Stinner2018-06-141-2/+9
| | | | python-gdb now catchs ValueError on read_var(): when Python has no debug symbols for example.
* bpo-33312: update Tools/gdb/libpython.py to match. (GH-6548)Gregory P. Smith2018-04-201-1/+1
|
* bpo-30983: [gdb] Fix py-bt, etc. for non-debug shared builds (#3153)Łukasz Langa2017-08-211-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.
* bpo-30983: Revert changes which broke most buildbots (#3100)Victor Stinner2017-08-161-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.
* bpo-30983: eval frame rename in pep 0523 broke gdb's python extension (#2803)Bruno "Polaco" Penteado2017-08-141-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
* bpo-30296 Remove unnecessary tuples, lists, sets, and dicts (#1489)Jon Dufresne2017-05-181-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())
* Fixes bpo-29680: Older gdb does not have gdb.error. (#363)Lev Abalkin2017-03-011-1/+1
| | | This change is required to make python-dbg.py compatible with GDB versions before 7.3.
* Issue #29263: LOAD_METHOD support for C methodsINADA Naoki2017-02-021-4/+1
| | | | Calling builtin method is at most 10% faster.
* python-gdb.py supports method-wrapperVictor Stinner2017-02-011-5/+48
| | | | | Issue #29367: python-gdb.py now supports also method-wrapper (wrapperobject) objects.
* Update and enhance python-gdb.pyVictor Stinner2017-01-181-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
* Fix Python 2.6 support in python-gdb.pyVictor Stinner2017-01-181-2/+2
| | | | Issue #29259.
* Optimize _PyCFunction_FastCallKeywords()Victor Stinner2017-01-161-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.
* Merge 3.5Victor Stinner2016-12-161-2/+18
|\
| * python-gdb.py: catch gdb.error on gdb.selected_frame()Victor Stinner2016-12-161-2/+18
| |
* | Issue #28770: Update python-gdb.py for fastcallsVictor Stinner2016-11-221-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.
* | Issue #28023: Fix python-gdb.py on old GDB versionsVictor Stinner2016-11-221-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.
* | Issue #28023: Fix python-gdb.py didn't support new dict implementationINADA Naoki2016-11-221-2/+26
| |
* | Remove legacy "from __future__ import with_statement" lines.Gregory P. Smith ext:(%20%5BGoogle%20Inc.%5D)2016-09-081-1/+1
|/
* gdb/libpython.py: inline _type_void_ptr()Victor Stinner2016-04-201-10/+4
| | | | The function was only called in _sizeof_void_p()
* python-gdb.py: get C types at runtimeVictor Stinner2016-04-201-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.
* Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-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.
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-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.
| * Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-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.
* | Undo (hopefully) buildbot failuresAntoine Pitrou2013-11-231-1/+1
|\ \ | |/
| * Undo (hopefully) buildbot failuresAntoine Pitrou2013-11-231-1/+1
| |
| * Issue #19308: fix the gdb plugin on gdbs linked with Python 3Antoine Pitrou2013-11-231-52/+69
| |
* | Issue #19308: fix the gdb plugin on gdbs linked with Python 3Antoine Pitrou2013-11-231-52/+69
| |