New submission from Dave Malcolm <dmalc...@redhat.com>:

Currently, Python's opcodes are defined as preprocessor #defines.  This means 
that they are 
invisible to the debugger.

I'm attaching:
  (i) a simple script (fixup-opcode-header.py) which converts Include/opcode.h 
to use an 
anonymous enum for the values
  (ii) a diff containing the results of running the script on trunk's 
Include/opcode.h
  (iii) a patch that converts usage of "int opcode" to "enum Py_Opcode opcode" 
in a few 
places

(Is the usage of an anonymous enum acceptable on all compilers that Python 
supports?  Is it 
going to generate equal machinecode on all compilers, relative to an int?)

With this patch, if I break into PyEval_EvalFrameEx in gdb, the debugger is 
able to emit 
symbolic values for "opcode":
(gdb) p opcode
$2 = LOAD_CONST

----------
components: Interpreter Core
messages: 96587
nosy: dmalcolm
severity: normal
status: open
title: RFE: introduce "enum Py_Opcode"
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7543>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to