More visibility for PackHeader when debug(-D)

modified:   packhead.cpp
	modified:   packmast.cpp
	modified:   pefile.h
This commit is contained in:
John Reiser
2017-05-26 13:02:32 -07:00
parent f42a37555d
commit d1a869496b
3 changed files with 14 additions and 7 deletions
+4
View File
@@ -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");
+8 -6
View File
@@ -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 !
+2 -1
View File
@@ -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,