473,326 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

Jun 26 '06 #1
2 1835
mi*******@hotmail.com writes:
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.


Dunno about Python but www.askigor.com automatically finds
the bugs in C programs. It's amazing.
Jun 26 '06 #2
mi*******@hotmail.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
Jul 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bryan Bullard | last post by:
#include <cstring> #include <iostream> #include <string> std::string foo() { char buf; strcpy(buf, "this is a test.");
1
by: Rhino | last post by:
Is there any way to install the IBM Distributed Debugger V9.2 on Windows XP without first uninstalling DB2? I installed the IBM Distributed Debugger V9.2 on my Windows XP box in the hopes of...
7
by: Johann Blake | last post by:
It would be nice to have Visual Studio .NET automatically break into the code whenever an event is generated without having to explicity set a breakpoint. It often happens that when a piece of code...
1
by: Raghu Raman | last post by:
Hi, i have developed a sample webapp in my machine and it is working nice.I copied my project to other machine and pasted it and i created the same virtual directory as u created in the first...
4
by: daftspaniel | last post by:
Sorry if this is a FAQ but Google returns a *lot* of results for Python Logging :-) I am looking for a tool that will automatically add logging to existing code e.g. Function Entries and Exits,...
2
by: Maxwell2006 | last post by:
Hi, The inelisence description of "UnhandledExceptionMode.Automatic" explains this: Route all exceptions to the System.Windows.Forms.Application.ThreadException handler, unless the...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
0
by: nemo | last post by:
Hello, I m looking for a feature that could really help everyone debugging code. I often have to use the "Attach to Process..." function from Visual Studio 2005 Prof. to debugg my code called...
3
by: myjish18 | last post by:
Hello, We have a DB2 UDB database v8.2.7 (db2 v8.2 fixpak 14) on AIX 5.3 which has Automatic Storage (AS) enabled. We want to disable automatic storage on entire database and/or disable...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.