[Pythonmac-SIG] Restrictions on what you can do in a Python module?

Jack Jansen Jack.Jansen at cwi.nl
Sat Aug 30 00:11:37 EDT 2003


On 29-aug-03, at 18:38, Robb Brown wrote:

>> On woensdag 27 augustus 2003, at 20:12PM, Robb Brown wrote:
>>> Anyway, here's the code.  The crash is on line 104, where all the 
>>> setup is finished and I actually ask dcmtk to connect.
>>
>> That line looks harmless enough.
>
> You'd think....  How would one go about using a debugger on a Python 
> module (remember, the code does not crash when not compiled as a 
> module).

What I tend to do is as follows:
% gdb python
.....
(gdb) run
.....
 >>> import themoduletodebug
 >>> control-C
(gdb) break thefunctioninthemodulethatIwanttosee
(gdb) continue
 >>> do_something_that_calls_that_function

Then gdb should break on the function, and you can start 
single-stepping, etc.

Again, let me emphasize that -O0 is required if you want to keep your 
sanity.
gcc moves code all over the place without it.
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Pythonmac-SIG mailing list