summaryrefslogtreecommitdiffstats
path: root/src/PEImage.cpp
diff options
context:
space:
mode:
authorsagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2010-08-08 08:37:12 (GMT)
committersagitario <sagitario@fc51e93f-b9fe-4711-8d8d-3ae870c5f7d8>2010-08-08 08:37:12 (GMT)
commit59dc1509092a46bb18e08f54ac5c4f859ca0ffa8 (patch)
tree44b893a9c077e1f531e87ac7bb9953a46e254548 /src/PEImage.cpp
parent81f3ca8636f863d32f0da61c214077305f28ccfc (diff)
downloadcv2pdb-59dc1509092a46bb18e08f54ac5c4f859ca0ffa8.zip
cv2pdb-59dc1509092a46bb18e08f54ac5c4f859ca0ffa8.tar.gz
cv2pdb-59dc1509092a46bb18e08f54ac5c4f859ca0ffa8.tar.bz2
Version 0.15
* thanks to patches by Z3N, the resulting pdb is now usable by more debuggers * now uses shared file access to executable * incomplete structs/classes are now added as user defined types to avoid confusing debugger for following symbols * fixed name demangling of very long names * added name demangling support for @safe/@trusted/@property/pure/nothrow/ref * base classes are added to D/cpp-interfaces to allow viewing the virtual function table pointer * structs, classes and interfaces now have an internal qualifier attached that allows the preview in autoexp.dat to show better info for structs and interfaces
Diffstat (limited to 'src/PEImage.cpp')
-rw-r--r--src/PEImage.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/PEImage.cpp b/src/PEImage.cpp
index 2a3cbc0..bc996a7 100644
--- a/src/PEImage.cpp
+++ b/src/PEImage.cpp
@@ -15,6 +15,7 @@ extern "C" {
#include <fcntl.h>
#include <ctype.h>
#include <direct.h>
+#include <share.h>
#include <sys/stat.h>
///////////////////////////////////////////////////////////////////////
@@ -42,7 +43,7 @@ bool PEImage::load(const char* iname)
if (fd != -1)
return setError("file already open");
- fd = open(iname, O_RDONLY | O_BINARY);
+ fd = sopen(iname, O_RDONLY | O_BINARY, SH_DENYWR);
if (fd == -1)
return setError("Can't open file");
@@ -156,9 +157,14 @@ bool PEImage::replaceDebugSection (const void* data, int datalen)
memcpy(dbgDir, &debugdir, sizeof(debugdir));
dbgDir->PointerToRawData = sec[s].PointerToRawData;
+#if 0
dbgDir->AddressOfRawData = sec[s].PointerToRawData;
dbgDir->SizeOfData = sec[s].SizeOfRawData;
-
+#else // suggested by Z3N
+ dbgDir->AddressOfRawData = sec[s].VirtualAddress;
+ dbgDir->SizeOfData = sec[s].SizeOfRawData - sizeof(IMAGE_DEBUG_DIRECTORY);
+#endif
+
free_aligned(dump_base);
dump_base = newdata;
dump_total_len += fill + xdatalen;