automatic debugger?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • micklee74@hotmail.com

    #1

    automatic debugger?

    hi
    is there something like an automatic debugger module available in
    python? Say if i enable this auto debugger, it is able to run thru the
    whole python program, print variable values at each point, or print
    calls to functions..etc. ..just like the pdb module, but now it's
    automatic.
    thanks

  • Paul Rubin

    #2
    Re: automatic debugger?

    micklee74@hotma il.com writes:[color=blue]
    > is there something like an automatic debugger module available in
    > python? Say if i enable this auto debugger, it is able to run thru the
    > whole python program, print variable values at each point, or print
    > calls to functions..etc. ..just like the pdb module, but now it's
    > automatic.[/color]

    Dunno about Python but www.askigor.com automatically finds
    the bugs in C programs. It's amazing.

    Comment

    • R. Bernstein

      #3
      Re: automatic debugger?

      micklee74@hotma il.com writes:
      hi
      is there something like an automatic debugger module available in
      python? Say if i enable this auto debugger, it is able to run thru the
      whole python program, print variable values at each point, or print
      calls to functions..etc. ..just like the pdb module, but now it's
      automatic.
      thanks
      pydb (http://bashdb.sourceforge.net) has a linetrace option sort of
      like what's done in POSIX shells.

      Here's an example:

      #!/usr/bin/python
      """Towers of Hanoi"""
      import sys,os

      def hanoi(n,a,b,c):
      if n-1 0:
      hanoi(n-1, a, c, b)
      print "Move disk %s to %s" % (a, b)
      if n-1 0:
      hanoi(n-1, c, b, a)

      i_args=len(sys. argv)
      if i_args != 1 and i_args != 2:
      print "*** Need number of disks or no parameter"
      sys.exit(1)

      n=3

      if i_args 1:
      try:
      n = int(sys.argv[1])
      except ValueError, msg:
      print "** Expecting an integer, got: %s" % repr(sys.argv[1])
      sys.exit(2)

      if n < 1 or n 100:
      print "*** number of disks should be between 1 and 100"
      sys.exit(2)

      hanoi(n, "a", "b", "c")


      $ pydb --basename --trace hanoi.py
      (hanoi.py:2):
      + """Towers of Hanoi"""
      (hanoi.py:3):
      + import sys,os
      (hanoi.py:5):
      + def hanoi(n,a,b,c):
      (hanoi.py:12):
      + i_args=len(sys. argv)
      (hanoi.py:13):
      + if i_args != 1 and i_args != 2:
      (hanoi.py:17):
      + n=3
      (hanoi.py:19):
      + if i_args 1:
      (hanoi.py:26):
      + if n < 1 or n 100:
      (hanoi.py:30):
      + hanoi(n, "a", "b", "c")
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:7): hanoi
      + hanoi(n-1, a, c, b)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:7): hanoi
      + hanoi(n-1, a, c, b)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk a to b
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:9): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk a to c
      (hanoi.py:9): hanoi
      + if n-1 0:
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk b to c
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk a to b
      (hanoi.py:9): hanoi
      + if n-1 0:
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:7): hanoi
      + hanoi(n-1, a, c, b)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk c to a
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:9): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk c to b
      (hanoi.py:9): hanoi
      + if n-1 0:
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      --Call--
      (hanoi.py:5): hanoi
      + def hanoi(n,a,b,c):
      (hanoi.py:6): hanoi
      + if n-1 0:
      (hanoi.py:8): hanoi
      + print "Move disk %s to %s" % (a, b)
      Move disk a to b
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:9): hanoi
      + if n-1 0:
      --Return--
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      --Return--
      (hanoi.py:10): hanoi
      + hanoi(n-1, c, b, a)
      --Return--
      (hanoi.py:30):
      + hanoi(n, "a", "b", "c")
      --Return--
      (<string>:1):
      + (bdb.py:366): run
      + exec cmd in globals, locals

      Comment

      Working...