rainers / cv2pdb

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

LineInfoData seems to be split into two #31

Closed dirty49374 closed 6 years ago

dirty49374 commented 6 years ago

It seems that LineInfoData struct in PEImage.cpp:565 should be split into two and second part of it can have multiple entries.

struct LineInfoData // size =12
{
    int funcoff;
    int funcidx;
    int funcsiz;
};
struct LineInfoData2
{
    int srcfileoff;
    int npairs;
    int size;
};

hex dump below is .debug$S section of my object file. (* - nparis, # - size)

  00000B20:                                  |F2  00  00  00  E8  00  00  00| E8 = 0C + 5C + 14 + 24 + 14 + 34
             --------------------------------+-------------++---------------+
  00000B30:  00  00  00  00  00  00  00  00  63  04  00  00||40  05  00  00 | 1st, *0A entries, size #5C
             -------------------------------+--------------++---------------+
  00000B40: *0A  00  00  00 #5C  00  00  00 :00  00  00  00  2F  01  00  80 |
             -------------------------------+                               |
  00000B50:  3A  00  00  00  2F  01  00  80  5D  00  00  00  2F  01  00  80 |
                                                                            |
  00000B60:  6B  00  00  00  2F  01  00  80  83  00  00  00  2F  01  00  80 |
                                                                            |  
  00000B70:  8A  00  00  00  2F  01  00  80  91  00  00  00  2F  01  00  80 |
                                                                            |  
  00000B80:  94  00  00  00  2F  01  00  80  9B  00  00  00  2F  01  00  80 |
                                           ++-------------------------------+
  00000B90:  9D  00  00  00  2F  01  00  80||C0  24  00  00 *01  00  00  00 | 2nd, *01 entry, size #14
             ---------------+--------------++--------------++---------------+
  00000BA0: #14  00  00  00 :D1  00  00  00  9C  02  00  80||40  05  00  00 | 3rd, *03 entries, size #24
             ---------------+---------------+--------------++---------------+
  00000BB0: *03  00  00  00 #24  00  00  00 :D8  00  00  00  2F  01  00  80 |
             -------------------------------+                               |
  00000BC0:  B4  01  00  00  2F  01  00  80  DE  01  00  00  2F  01  00  80 |
           ++-----------------------------------+---------------------------+
  00000BD0:||C0  24  00  00 *01  00  00  00 #14  00  00  00 :E8  01  00  00 | 4th, *01 entry, size #14
           ++--------------++-------------------------------+---------------+
  00000BE0:  05  03  00  80||40  05  00  00 *05  00  00  00 #34  00  00  00 : 5th, *05 entry, size #34 
             --------------++-----------------------------------------------+
  00000BF0:  0C  02  00  00  30  01  00  80  18  02  00  00  2F  01  00  80 |
                                                                            |  
  00000C00:  26  02  00  00  30  01  00  80  E1  03  00  00  3E  01  00  80 |
                                           ++-------------------------------+
  00000C10:  E7  03  00  00  44  01  00  80||                                
             ------------------------------++
rainers commented 6 years ago

You are probably right. Here is the respective definition by Microsoft: https://github.com/Microsoft/microsoft-pdb/blob/master/include/cvinfo.h#L4601. Unfortunately this file hasn't been available at the time.

Can you make an approriate pull request?