[New-bugs-announce] [issue33294] Support complex expressions for py-print command.

Martin Liška report at bugs.python.org
Tue Apr 17 03:02:12 EDT 2018

New submission from Martin Liška <marxin.liska at gmail.com>:

The patch is based on a blog post: http://kouk.surukle.me/2014/09/25/debugging-python-objects-and-fields-with-gdb/.
Adding him: @kouk

Purpose of the pull request is to support more complex expressions for py-print command.
Small example:

(gdb) py-print self
local 'self' = <OptimizationLevel(level='', options=[<MarchFlag(name='-mtune=', options={'x86_64': ('native', 'i386', 'i486', 'i586', 'pentium', 'lakemont', 'pentium-mmx', 'pentiumpro', 'i686', 'pentium2', 'pentium3', 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'core2', 'nehalem', 'westmere', 'sandybridge', 'ivybridge', 'haswell', 'broadwell', 'skylake', 'bonnell', 'silvermont', 'knl', 'skylake-avx512', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', 'bdver1', 'bdver2', 'bdver3', 'bdver4', 'znver1', 'btver1', 'btver2', 'winchip-c6', 'winchip2', 'c3', 'c3-2', 'geode'), 'ppc64': ['401', '403', '405', '405fp', '440', '440fp', '464', '464fp', '476', '476fp', '505', '601', '602', '603', '603e', '604', '604e', '620', '630', '740', '7400', '7450', '750', '801', '821', '823', '860', '970', '8540', 'a2', 'e300c2', 'e300c3', 'e500mc', 'e500mc64', 'e5500', 'e6...(truncated)

(gdb) py-print self.options.0.options.x86_64.3
local 'self.options.0.options.x86_64.3' = 'i586'
I consider it very handy. For now I support objects, dictionary, tuple and list types of objects.
I guess a test-case and a documentation entry will be needed. But I would first like to get a feedback about the intention of the change.

components: Demos and Tools
messages: 315381
nosy: Martin Liška
priority: normal
severity: normal
status: open
title: Support complex expressions for py-print command.
type: enhancement

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list