summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Schuetze <r.sagitario@gmx.de>2018-12-12 07:37:42 (GMT)
committerRainer Schuetze <r.sagitario@gmx.de>2018-12-12 07:37:42 (GMT)
commitad510831cafa07d45d973e5fc941c62b9d8946f9 (patch)
tree97c0a9ef52c2d663e0a7581fc0158f895e0ac575
parent6af8029154cd76b998d3be2fe59c461295eef0e9 (diff)
downloadcv2pdb-ad510831cafa07d45d973e5fc941c62b9d8946f9.zip
cv2pdb-ad510831cafa07d45d973e5fc941c62b9d8946f9.tar.gz
cv2pdb-ad510831cafa07d45d973e5fc941c62b9d8946f9.tar.bz2
fix #40: set architecture of .pdb for a 64 bit .dbg
-rw-r--r--src/PEImage.cpp4
-rw-r--r--src/PEImage.h15
2 files changed, 12 insertions, 7 deletions
diff --git a/src/PEImage.cpp b/src/PEImage.cpp
index 644f36e..d3651c8 100644
--- a/src/PEImage.cpp
+++ b/src/PEImage.cpp
@@ -54,6 +54,7 @@ PEImage::PEImage(const TCHAR* iname)
, strtable(0)
, bigobj(false)
, dbgfile(false)
+, x64(false)
{
if(iname)
loadExe(iname);
@@ -266,6 +267,7 @@ bool PEImage::initCVPtr(bool initDbgDir)
hdr32 = 0;
else
hdr64 = 0;
+ x64 = hdr64 != nullptr;
if(IMGHDR(Signature) != IMAGE_NT_SIGNATURE)
return setError("optional header does not have PE signature");
@@ -324,6 +326,7 @@ bool PEImage::initDbgPtr(bool initDbgDir)
if(dbg->DebugDirectorySize <= IMAGE_DIRECTORY_ENTRY_DEBUG)
return setError("too few entries in data directory");
+ x64 = dbg->Machine == IMAGE_FILE_MACHINE_AMD64 || dbg->Machine == IMAGE_FILE_MACHINE_IA64;
dbgfile = true;
dbgDir = 0;
dirHeader = 0;
@@ -389,6 +392,7 @@ bool PEImage::initDWARFPtr(bool initDbgDir)
hdr32 = 0;
else
hdr64 = 0;
+ x64 = hdr64 != nullptr;
if(IMGHDR(Signature) != IMAGE_NT_SIGNATURE)
return setError("optional header does not have PE signature");
diff --git a/src/PEImage.h b/src/PEImage.h
index 6ebd131..2935419 100644
--- a/src/PEImage.h
+++ b/src/PEImage.h
@@ -70,7 +70,7 @@ public:
bool relocateDebugLineInfo(unsigned int img_base);
bool hasDWARF() const { return debug_line != 0; }
- bool isX64() const { return hdr64 != 0; }
+ bool isX64() const { return x64; }
bool isDBG() const { return dbgfile; }
int countCVEntries() const;
@@ -111,12 +111,13 @@ private:
IMAGE_DEBUG_DIRECTORY* dbgDir;
OMFDirHeader* dirHeader;
OMFDirEntry* dirEntry;
- int nsec;
- int nsym;
- const char* symtable;
- const char* strtable;
- bool bigobj;
- bool dbgfile; // is DBG file
+ int nsec;
+ int nsym;
+ const char* symtable;
+ const char* strtable;
+ bool x64; // targets 64-bit machine
+ bool bigobj;
+ bool dbgfile; // is DBG file
public:
//dwarf