thecocce / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Don't work breakpoint stop in top of code hierarchy #458

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Code:
def test():
    print 'test'
    pass #breakpoint1 (work correct)
test()
pass #breakpoint2 (don'w work correct)
print 'finish'

When set breakpoint to line #breakpoint1 - it's work fine, but when set 
breakpoint to line #breakpoint2 - debugging don't stop on what line.
The same with Run To Cursor function.
Python 2.6.6
PyScripter-v2.4.1

Original issue reported on code.google.com by al.sko...@gmail.com on 22 Dec 2010 at 4:05

GoogleCodeExporter commented 9 years ago
This is because no instructions are generated for the second pass statement. 

If you look at the module dissassembly for function test() it is:

Disassembly of test:
  2           0 LOAD_CONST               1 ('test')
              3 PRINT_ITEM          
              4 PRINT_NEWLINE       

  3           5 LOAD_CONST               0 (None)
              8 RETURN_VALUE      

Now change the function to:  

def test():
    pass #breakpoint1 (does not work)
    print 'test'

The breakpoint in the pass statement will not work.  If you look at the 
dissassembly you will see that no instructions are generated for line 2:

Disassembly of test:
  3           0 LOAD_CONST               1 ('test')
              3 PRINT_ITEM          
              4 PRINT_NEWLINE       
              5 LOAD_CONST               0 (None)
              8 RETURN_VALUE        

For a breakpoint to work the specific line needs to generate some python 
instructions.

Original comment by pyscripter on 22 Dec 2010 at 6:26

GoogleCodeExporter commented 9 years ago
Thanks for explain. I usually use this technique to set breakpoint AFTER 
previous instruction. I should find another method :)

Original comment by al.sko...@gmail.com on 22 Dec 2010 at 10:47