Hi,

the recent post about the problem of DLLs being re-extracted reminded
me of a hack I once used to diagnose a similar problem. It should
be possible to start a packed binary (which after the first stage
of extraction is just a custom perl executable) under the perl
debugger (i.e. somehow pass a "-d" or more general "-d:foo"
option down). Looking at the current PAR::Packer I noticed
that since then someone hacked in this PERL_PROFILING
build-time #define that causes "-d:DProf" to be passed down.

Suggestion:
- generalize this, so that any first argument of the binary
matching /^-d/ is passed down to the custom perl executable
- but don't do this for each pp packed binary (as that would
be a large security problem), instead create two variants of
myldr: one without the debug feature, one with
- implement an option to pp to use the debuggable myldr when
assembling the packed binary (bonus points for automatically
packing perl5db.pl if this option is used)

Then we could ask people to prepare a debuggable binary
and run it. Note that this won't help per se in the case
of re-extracted DLLS, since this happens in a BEGIN block,
i.e. before the interactive debugger prompt. However, setting
the environment variable PERLDB_OPTS to something like
"NonStop=1 LineInfo=db.out AutoTrace=1" would generate
a statement trace even for this early parts of program execution.

Cheers, Roderich

Reply via email to