Debugging eval'ed code

Help
2009-05-27
2013-05-20
  • Woodzmeister
    Woodzmeister
    2009-05-27

    Hi

    Thanks for you help with my last query - much appreciated.

    I'm currently looking at some legacy Perl code - which has a number of Perl files which are loaded in at run time using 'eval "cat <filename>"' from the main Perl script.

    Unfortunately this means that it appears that I can't appear to debug these (the debugger crashes out).

    I have tried using 'do' to include the files - which I understand is a 'eval "cat .."' replacement - but unfortunately the legacy code is written to use items in scope from the main Perl script - which 'do' does not allow you to do.

    Disappointingly I'm not in the position of being able to re-write the Perl files to work with 'do' - and I have a bad feeling that there's no way to debug eval'ed code.

    So in a last straw-grasping moment - has anybody got any suggestions as whether it's possible to use the EPIC debugger on eval'ed code or not? Any help much appreciated.

    Kind regards,

    Stephen

     
    • Jan Ploski
      Jan Ploski
      2009-05-27

      Debugging eval expressions is not supported, mostly because there is nowhere to set breakpoints and nowhere to display the source code at present. You could coerce EPIC to let you step into an eval, but the instruction pointer would remain at the eval line the whole time (blind single-stepping so to say). You'd have to hack StepIntoCommand.java and comment out the call to maybeSkipStringEval in there. It's probably not worth the effort.

       
      • Woodzmeister
        Woodzmeister
        2009-05-27

        Cheers - suspected that might be the case...