Discussion:
[Pdl-porters] debug tools for PDL-XS code
Chris Marshall
2014-05-19 20:10:26 UTC
Permalink
Hi-

I'm looking for effective strategies for debugging PDL XS
code such as the problem previously reported on perldl:

http://mailman.jach.hawaii.edu/pipermail/perldl/2014-May/008677.html

I was hoping that there were some tools that could be
used from perl to peek at the state of PDL and the piddles
to determine what might be the problem. Before I start
adding a bazillion print statements, I'm hoping someone
has seen some better ideas.

Thanks in advance,
Chris
David Mertens
2014-05-20 16:35:08 UTC
Permalink
I don't know if it's of much help, but I would simply point out that
pp_line_numbers can be very helpful for ensuring the proper line numbering.
It might be useful to insert a collection of pp_line_numbers directives in
the core so that any debugger line number reporting refers to the real line
in the source file, rather than whatever file in the generated XS file it
happens to be.

Apart from that, valgrind and the debugger are the best advice I've got.
That may sound like useless advice, but it comes honestly. I've recently
started reading "21st Century C". The second chapter spends a few pages
discussing the debugger and valgrind. Though it was brief, it gave me
enough information to start using the debugger to examine core dumps and
the like. It might be possible to combine this with a host of
pp_line_numbers commands in the core to correctly isolate the code that's
giving trouble.

Hope that helps.
David
Post by Chris Marshall
Hi-
I'm looking for effective strategies for debugging PDL XS
http://mailman.jach.hawaii.edu/pipermail/perldl/2014-May/008677.html
I was hoping that there were some tools that could be
used from perl to peek at the state of PDL and the piddles
to determine what might be the problem. Before I start
adding a bazillion print statements, I'm hoping someone
has seen some better ideas.
Thanks in advance,
Chris
_______________________________________________
PDL-porters mailing list
http://mailman.jach.hawaii.edu/mailman/listinfo/pdl-porters
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
Loading...