473,788 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1852
mi*******@hotma il.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*******@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
Jul 15 '06 #3

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

Similar topics

9
1815
by: Bryan Bullard | last post by:
#include <cstring> #include <iostream> #include <string> std::string foo() { char buf; strcpy(buf, "this is a test.");
1
3008
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 debugging a Java stored procedure. Well, I never got the debugger to work despite my best efforts - see posts earlier this week - so now I'd like to uninstall the debugger. I looked into this but the README says: 3.1 Uninstalling on Windows
7
1435
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 is executed, it automatically forces events somewhere else in code to be raised. Sometimes these events are generated by the source code written by the developer and sometimes they are done by controls or other behind-the-scenes code that was...
1
1255
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 machine.If i run my project ,it says that 'Unable to run the project .denugger is not attached'. But i also gone to the attach process and attached the aspt_wp.exe and
4
2110
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, Return values etc. Thanks, Davy Mitchell Mood News
2
4550
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 application's configuration file specifies otherwise. How can I configure unhandled exception behavior in configuration file?
58
4690
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 the overhead of automatic variable sized arrays, I suspect it is smaller than that of malloc), although I'm not too worried about it. I was thinking that, with C99's variable length arrays, malloc shouldn't be needed most of the time. But I'm...
0
1239
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 by several programs. This programs use my dlls. When I want to debug my code I have to set breakpoints where the PC(ProgramCounter) stops. But at the moment I have to know what Member(or Method) of my code is called from the other Programm(using...
3
4654
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 automatic storage on all tablespaces. DB2 Manual says it once AS is enabled, it cant be changed. Is there any way to disable the AS or any other alternative? Please advice.
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.