rainers / cv2pdb

converter of DMD CodeView/DWARF debug information to PDB files
Artistic License 2.0
466 stars 110 forks source link

handle > 2GB binary size #62

Open roytam1 opened 4 years ago

roytam1 commented 4 years ago

I tried to split debug symbols from xul.dll which is compiled with gcc 8.1, and xul.dll file size is 2,882,488,917 bytes and cv2pdb returns "Can't get size". I think it may be cause by fstat can't handle this big size.

rainers commented 4 years ago

Indeed, _fstat64 could be used instead, but I suspect that won't be the only place where assumptions will break. PR welcome ;-)

roytam1 commented 4 years ago

but I suspect that won't be the only place where assumptions will break

yeah, MSVC's read() (i.e. _read()) can't handle 64bit counts.

Feodor2 commented 4 years ago

Hi, i want to use cv2pdb for the same purpose too, malloc fails too. So i thing why it is to load the whole file, Setfilepointer handles >2gb good, then it will read\write the file by parts, not sure about mspdb stuff though, seems its undocumented i failed find any good info.

rainers commented 4 years ago

The best information available I know of is in these files: https://github.com/microsoft/microsoft-pdb/tree/master/include (these were not available at the time this program was written). LLVM also has tools to generate CodeView debug info.

If your file is below 4 GB, it might be easiest to fix cv2pdb using a 64-bit build and trying to be stricter about using unsigned/signed sizes. As you suggest it might be better to handle sections separately, though, to deal with even larger files (each section will have to be below 4 GB).

roytam1 commented 3 years ago

... and semi-OT: there is a patch for gcc/binutils to generate pdb directly: https://gcc.gnu.org/pipermail/gcc-patches/2021-March/567030.html