#59 Add perl debugger support to PDL

open
nobody
None
6
2014-08-18
2011-11-03
No

This would include:
- use of niceslice syntax for interactive debugger operations
- display of niceslice syntax lines for list commands
- ability to call the enhanced debugger like 'pdl -d'

The idea is that the PDL debugging be supported
with functionality and capabilities to simplify debugging
of scientific code. Another nice feature might be a way
to visualize PDL data rather than just brute-force print
of desired elements....

Here is the text from a perldl list discussion on this
topic: at
http://mailman.jach.hawaii.edu/pipermail/perldl/2011-November/005550.html

On 11/1/2011 11:44 PM, Karl Glazebrook wrote:
> Hi Chris
>
> Just tried this quickly - seems to work great!
>
> I will make it my default and see how it goes in
> my next debugging frenzy - was there many changes
> from the original perl5db.pl?

Two lines: one to require PDL::NiceSlice and the other to
run the perldlpp() converter on the command line before
the interactive eval takes place. The hard part is grokking
enough of the debugger to see what to do.

> One comment: just like with normal perl5db.pl
> the 'l' commands shows the code AFTER source
> filtering. But now we have Niceslice working it would
> be nice to have this PRE source filtering. Are there
> any hooks in the debugger for that?

This definitely should be possible but much trickier to
get right. Would be nice to have once the new, improved
NiceSlice filtering is done. The difficulty is making
sure not to break the debugger in the process. I feel
confident that the 2 line change above doesn't. :-)

> Very happy to have this! 'pdl -d' would be a nice touch.

Agreed.

>
> On 21/10/2011, at 6:10 AM, Chris Marshall wrote:
>
>> [ Resending announcement since I missed a cc to the list ]
>>
>> Karl et. al.,
>>
>> I just implemented a PDLdb.pl debugger with support
>> for PDL::NiceSlice syntax. You can get it from the PDL
>> git repo and use it by placing it in your @INC path
>> somewhere and by setting the PERL5DB environment
>> variable to 'BEGIN { require "PDLdb.pl" }'
>>
>> Let me know how it works and if it seems stable enough
>> we could consider adding it to the distribution. Maybe
>> even with something clever like 'pdl -d' calling it under
>> the hood...
>>
>> Cheers,
>> Chris
>>
>> On Sat, Oct 15, 2011 at 6:55 PM, chm<devel.chm.01 at gmail.com> wrote:
>>> On 10/15/2011 5:58 PM, Karl Glazebrook wrote:
>>>>
>>>> On 15/10/2011, at 12:47 AM, Chris Marshall wrote:
>>>>
>>>>> Not yet. There are only two options that I know of:
>>>>>
>>>>> (1) use the original throw-away tmp syntax for slice
>>>>> assignments: E.g., ( my $tmp = $a(:) ) .= $b
>>>>>
>>>>> (2) use perl-5.15 which appears to have replaced the
>>>>> lvalue failure by a warning. I don't have that perl
>>>>> available to test so I cannot verify.
>>>>
>>>> Hi Chris
>>>>
>>>> I am not sure I understand your ref to lvalues?
>>>
>>> Sorry, I crossed wires with the lvalue subs problem
>>> with the debugger. It would be nice to use niceslice
>>> constructs from the perl debugger command line.
>>>
>>> Taking a look at the DB module, it seems that
>>> it might be possible to add niceslice processing
>>> to the evalcode feature (once it is working cleanly
>>> for our own evals).
>>>
>>> --Chris
>>>
>>>> For me it does not work even for rvalues
>>>>
>>>> e.g.
>>>>
>>>> DB<4> $r = random(10,10)
>>>>
>>>> DB<5> p $r(0:3,0:3)
>>>> syntax error at (eval 52)[/System/Library/Perl/5.10/perl5db.pl:638] line
>>>> 2, near "$r("
>>>>
>>>> DB<6> p $r->slice('0:3,0:3')
>>>>
>>>> [
>>>> [ 0.43491887 0.9474565 0.41647159 0.79907819]
>>>> [0.0043885932 0.043438065 0.86013387 0.21898749]
>>>> [ 0.13279017 0.44450159 0.77473655 0.10607898]
>>>> [ 0.26784251 0.77686852 0.58402126 0.45321226]
>>>> ]

Discussion

  • Chris Marshall

    Chris Marshall - 2011-11-03

    Also need to support debugging of niceslice construct syntax
    as well as getting diagnostic messages at runtime without
    debugging into the nslice or range routines. We want the
    access to be opaque.

     
  • Chris Marshall

    Chris Marshall - 2013-01-02
    • priority: 5 --> 6
     
  • Chris Marshall

    Chris Marshall - 2013-01-02

    There is a problem in debugging lvalue subroutines in the debugger where various slice operations get stepped into when going a line at a time. This makes it *really* tedious to debug PDL code. I'm not sure what needs to be done for a fix but it would be nice to have a small test case showing the problem. Maybe something pure perl (without XS) is possible. Bumping up the priority since this is the kind of nuisance that can make PDL less useful for users---I know it gets to me.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks