diff --git a/src/packhead.cpp b/src/packhead.cpp index 48375dc7..f508e946 100644 --- a/src/packhead.cpp +++ b/src/packhead.cpp @@ -181,6 +181,10 @@ bool PackHeader::fillPackHeader(const upx_bytep buf, int blen) { level = p[7]; filter_cto = 0; + if (opt->debug.debug_level) { + fprintf(stderr, " fillPackHeader version=%d format=%d method=%d level=%d\n", + version, format, method, level); + } const int size = getPackHeaderSize(); if (boff + size <= 0 || boff + size > blen) throwCantUnpack("header corrupted 2"); diff --git a/src/packmast.cpp b/src/packmast.cpp index a70400c2..ad9319be 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -137,12 +137,14 @@ Packer *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const optio void *user) { Packer *p = NULL; -#define D(klass) \ - ACC_BLOCK_BEGIN \ - if (o->debug.debug_level) \ - fprintf(stderr, "visitAllPackers: %s\n", #klass); \ - if ((p = func(new klass(f), user)) != NULL) \ - return p; \ +#define D(Klass) \ + ACC_BLOCK_BEGIN \ + Klass *const kp = new Klass(f); \ + if (o->debug.debug_level) \ + fprintf(stderr, "visitAllPackers: (ver=%d, fmt=%3d) %s\n", \ + kp->getVersion(), kp->getFormat(), #Klass); \ + if ((p = func(kp, user))) \ + return p; \ ACC_BLOCK_END // note: order of tries is important ! diff --git a/src/pefile.h b/src/pefile.h index becc464d..ec2fdd74 100644 --- a/src/pefile.h +++ b/src/pefile.h @@ -37,6 +37,8 @@ class PeFile : public Packer { typedef Packer super; +public: + virtual int getVersion() const { return 13; } protected: class Interval; class Reloc; @@ -47,7 +49,6 @@ protected: PeFile(InputFile *f); virtual ~PeFile(); - virtual int getVersion() const { return 13; } void readSectionHeaders(unsigned objs, unsigned sizeof_ih); unsigned readSections(unsigned objs, unsigned usize,