[IronPython] Debugging IronPython - Question

Harald Krapfenbauer krapfenbauer at ict.tuwien.ac.at
Tue Jun 5 01:50:46 PDT 2007


Hello!

I have a question regarding debugging of IronPython. I use version 1.1
and debugged a modified version of the "first.py" file from the Tutorial
directory:
----------------------------------------------
def add(a, b):
	"add(a, b) -> returns a + b"
	temp1 = a*2
	temp2 = b*2
	temp3 = temp1+temp2
	return temp3 / 2

def factorial(n):
	"factorial(n) -> returns factorial of n"
	if n <= 1: return 1
	return n * factorial(n-1)

print "Hello from IronPython!"
number = 5
result = factorial (number)
print "Factorial(",number,") is ",result
result2 = add(5,7)
print "5 + 7 =",result2
----------------------------------------------------

First, I debugged this program with Visual C# 2005 Express, i.e. MS CLR
debugger. I set a breakpoint on last line of add() function and got the
correct values of locals and parameters:

a		5		object{int}
b		7		object{int}
tbstatus	false		bool
temp1		10		object{int}
temp2		14		object{int}
temp3		24		object{int}
$line		21		int
retval	null		object


Then I tried to debug this program with the Mono debugger (MDB) under
Linux. If I compile the Python file before with -X:SaveAssemblies, I can
set a breakpoint on the same line. The "show locals" and "show params"
commands give me the variable names, but incorrect or missing values:

(mdb) show locals
tbstatus = (System.Boolean) true
temp2 = (object) object (0x0738a000)
temp3 = (object) &(System.Int32) 14
temp1 = (object) &(System.Int32) 24
$line = (System.Int32) 473472
retval = (object) object (0x00000015)
(mdb) show params
a = (System.Object) { }
b = (System.Object) { }



I suspect the Mono Debugger does something wrong, but I'm not sure. Is
it possible that Mono does something different with IronPython as .NET
under Windows?
What's this tbstatus variable for?
Does anyone have experience with debugging IronPython under Linux?


Best greetings + thanks,
Harald Krapfenbauer


More information about the users mailing list