]> granicus.if.org Git - python/commitdiff
(Merge 3.2) Issue #13628: python-gdb.py is now able to retrieve more frames in
authorVictor Stinner <victor.stinner@haypocalc.com>
Mon, 19 Dec 2011 12:47:10 +0000 (13:47 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Mon, 19 Dec 2011 12:47:10 +0000 (13:47 +0100)
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()

1  2 
Lib/test/test_gdb.py
Misc/NEWS
Tools/gdb/libpython.py

index c6ea45c7d99168693e44813cdf64df065bc00094,a429db95016e65395b562932480a8b6375618198..82dba2e022e840bb63de60b736711918742903e1
@@@ -634,12 -644,12 +644,12 @@@ Traceback \(most recent call first\)
                                    cmds_after_breakpoint=['py-bt-full'])
          self.assertMultilineMatches(bt,
                                      r'''^.*
 -#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
 +#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 7, in bar \(a=1, b=2, c=3\)
      baz\(a, b, c\)
 -#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
 +#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 4, in foo \(a=1, b=2, c=3\)
      bar\(a, b, c\)
 -#[0-9]+ Frame 0x[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
 +#[0-9]+ Frame 0x-?[0-9a-f]+, for file .*gdb_sample.py, line 12, in <module> \(\)
- foo\(1, 2, 3\)
    foo\(1, 2, 3\)
  ''')
  
  class PyPrintTests(DebuggerTests):
          bt = self.get_stack_trace(script=self.get_sample_script(),
                                    cmds_after_breakpoint=['py-print len'])
          self.assertMultilineMatches(bt,
 -                                    r".*\nbuiltin 'len' = <built-in method len of module object at remote 0x[0-9a-f]+>\n.*")
 +                                    r".*\nbuiltin 'len' = <built-in method len of module object at remote 0x-?[0-9a-f]+>\n.*")
  
  class PyLocalsTests(DebuggerTests):
+     @unittest.skipIf(python_is_optimized(),
+                      "Python was compiled with optimizations")
      def test_basic_command(self):
          bt = self.get_stack_trace(script=self.get_sample_script(),
                                    cmds_after_breakpoint=['py-locals'])
diff --cc Misc/NEWS
index e04ae7aab1934acada85710c8a5e2c35b4e2d206,956146faef092636fb244eb4d00f7203e6f00d0d..aeb1c899664287a609f9414c9242357f22bb72da
+++ b/Misc/NEWS
@@@ -419,11 -97,7 +419,11 @@@ Core and Builtin
  Library
  -------
  
- - Issue #11813: Fix inspect.getattr_static for modules. Patch by Andreas 
 +- Issue #13635: Add ssl.OP_CIPHER_SERVER_PREFERENCE, so that SSL servers
 +  choose the cipher based on their own preferences, rather than on the
 +  client's.
 +
+ - Issue #11813: Fix inspect.getattr_static for modules. Patch by Andreas
    Stührk.
  
  - Issue #7502: Fix equality comparison for DocTestCase instances.  Patch by
  Tools/Demos
  -----------
  
++- Issue #13628: python-gdb.py is now able to retrieve more frames in the Python
++  traceback if Python is optimized.
++
 +- Issue #11996: libpython (gdb), replace "py-bt" command by "py-bt-full" and
 +  add a smarter "py-bt" command printing a classic Python traceback.
 +
  - Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
  
 +- Issue #10639: reindent.py no longer converts newlines and will raise
 +  an error if attempting to convert a file with mixed newlines.
 +  "--newline" option added to specify new line character.
 +
  Extension Modules
  -----------------
  
index b6ec063c93657095ff2464b93aecb3adf1cad431,8bbbb1048b616b16c2d809a957ef4a870c8f4afb..30347cbc9320b08e4271f302cf4cb0ba6bbf7058
@@@ -49,12 -49,6 +49,11 @@@ import sy
  _type_char_ptr = gdb.lookup_type('char').pointer() # char*
  _type_unsigned_char_ptr = gdb.lookup_type('unsigned char').pointer() # unsigned char*
  _type_void_ptr = gdb.lookup_type('void').pointer() # void*
- _type_size_t = gdb.lookup_type('size_t')
 +_type_unsigned_short_ptr = gdb.lookup_type('unsigned short').pointer()
 +_type_unsigned_int_ptr = gdb.lookup_type('unsigned int').pointer()
 +
 +# value computed later, see PyUnicodeObjectPtr.proxy()
 +_is_pep393 = None
  
  SIZEOF_VOID_P = _type_void_ptr.sizeof