How do I debug an executable created using the perl PAR packager (pp)?

283 views Asked by At

I've used the PAR packager (pp) to create a Windows executable foo.exe from a Perl script foo.pl. The Perl script runs fine (perl foo.pl <arguments>). The executable runs, too (foo.exe <arguments>), but doesn't produce the same results as the Perl script. I want to debug the perl script as run by the executable, to figure out where the difference comes from. How do I do that? In other words, how do I pass a -d to the perl.exe that starts when I execute foo.exe?

ADDENDUM 2020-05-26

Using "Process Explorer" I found the application that ends up getting executed. It was %TEMP%\par-<ID1>\cache-<ID2>\foo.exe, where <ID1> and <ID2> are short and long hexadecimal strings. I had hoped to find ...\perl.exe foo.pl instead, then I could have injected my -d into the command line.

Running foo.exe in that folder yields an error "Can't locate PAR.pm in @INC".

That same folder also contains numerous *.pm, *.dll (including perl528.dll), and a few *.pl files, with the *.pl and *.pm files having names that are short hexadecimal strings. One of the *.pl files (the one mentioned in the process's PAR_0 environment variable) turns out to have the same contents as foo.pl, with the following two lines prefixed:

package main;
#line 1 "script/foo.pl"

If I run perl -Iinc/lib <ID>.pl in that folder, with <ID>.pl the name of that perl script, then it produces the desired results, i.e., doesn't run into the problem that the exe runs into. I expect that the perl528.dll and other dlls in that folder are the bits that make up Perl, but don't know how to call them. The foo.exe in that folder is only 78 kB in size, so it cannot do much more than have those other bits do the work.

0

There are 0 answers