@@ -245,6 +245,88 @@ public String toString() {
245245 }
246246 }
247247
248+ private abstract static class CVSymbolData32Record extends CVSymbolSubrecord {
249+
250+ protected final int typeIndex ;
251+ protected final int offset ;
252+ protected final short segment ;
253+ protected final String displayName ;
254+ protected final String symbolName ;
255+
256+ protected CVSymbolData32Record (CVDebugInfo cvDebugInfo , short cmd , String symbolName , String displayName , int typeIndex , int offset , short segment ) {
257+ super (cvDebugInfo , cmd );
258+ assert symbolName != null ;
259+ this .displayName = displayName ;
260+ this .symbolName = symbolName ;
261+ this .typeIndex = typeIndex ;
262+ this .offset = offset ;
263+ this .segment = segment ;
264+ }
265+
266+ @ Override
267+ protected int computeContents (byte [] buffer , int initialPos ) {
268+ int pos = CVUtil .putInt (typeIndex , buffer , initialPos );
269+ pos = cvDebugInfo .getCVSymbolSection ().markRelocationSite (buffer , pos , symbolName , offset );
270+ pos = CVUtil .putUTF8StringBytes (displayName , buffer , pos );
271+ return pos ;
272+ }
273+ }
274+
275+ public static class CVSymbolGData32Record extends CVSymbolData32Record {
276+
277+ CVSymbolGData32Record (CVDebugInfo cvDebugInfo , String symbolName , String displayName , int typeIndex , int offset , short segment ) {
278+ super (cvDebugInfo , CVDebugConstants .S_GDATA32 , symbolName , displayName , typeIndex , offset , segment );
279+ }
280+
281+ @ Override
282+ public String toString () {
283+ return String .format ("S_GDATA32 name=%s(%s) offset=0x%x type=0x%x" , symbolName , displayName , offset , typeIndex );
284+ }
285+ }
286+
287+ @ SuppressWarnings ("unused" )
288+ public static class CVSymbolLData32Record extends CVSymbolData32Record {
289+
290+ CVSymbolLData32Record (CVDebugInfo cvDebugInfo , String symbolName , int typeIndex , int offset , short segment ) {
291+ super (cvDebugInfo , CVDebugConstants .S_LDATA32 , symbolName , symbolName , typeIndex , offset , segment );
292+ }
293+
294+ @ Override
295+ public String toString () {
296+ return String .format ("S_LDATA32 name=%s offset=0x%x type=0x%x" , symbolName , offset , typeIndex );
297+ }
298+ }
299+
300+ public static class CVSymbolRegRel32Record extends CVSymbolSubrecord {
301+
302+ private final String name ;
303+ private final int typeIndex ;
304+ private final int offset ;
305+ private final short register ;
306+
307+ CVSymbolRegRel32Record (CVDebugInfo debugInfo , String name , int typeIndex , int offset , short register ) {
308+ super (debugInfo , CVDebugConstants .S_REGREL32 );
309+ this .name = name ;
310+ this .typeIndex = typeIndex ;
311+ this .offset = offset ;
312+ this .register = register ;
313+ }
314+
315+ @ Override
316+ protected int computeContents (byte [] buffer , int initialPos ) {
317+ int pos = CVUtil .putInt (offset , buffer , initialPos );
318+ pos = CVUtil .putInt (typeIndex , buffer , pos );
319+ pos = CVUtil .putShort (register , buffer , pos );
320+ pos = CVUtil .putUTF8StringBytes (name , buffer , pos );
321+ return pos ;
322+ }
323+
324+ @ Override
325+ public String toString () {
326+ return String .format ("S_REGREL32 name=%s offset=(r%d + 0x%x) type=0x%x)" , name , register , offset , typeIndex );
327+ }
328+ }
329+
248330 /*
249331 * Creating a proc32 record has a side effect: two relocation entries are added to the section
250332 * relocation table; they refer back to the global symbol.
@@ -258,15 +340,14 @@ public static class CVSymbolGProc32Record extends CVSymbolSubrecord {
258340 private final int debugStart ;
259341 private final int debugEnd ;
260342 private final int typeIndex ;
261- private final int offset ;
262343 private final short segment ;
263344 private final byte flags ;
264345 private final String symbolName ;
265346 private final String displayName ;
266347
267- CVSymbolGProc32Record (CVDebugInfo cvDebugInfo , short cmd , String symbolName , String displayName , int pparent , int pend , int pnext , int proclen , int debugStart , int debugEnd , int typeIndex ,
268- int offset , short segment , byte flags ) {
269- super (cvDebugInfo , cmd );
348+ CVSymbolGProc32Record (CVDebugInfo cvDebugInfo , String symbolName , String displayName , int pparent , int pend , int pnext , int proclen , int debugStart , int debugEnd , int typeIndex ,
349+ short segment , byte flags ) {
350+ super (cvDebugInfo , CVDebugConstants . S_GPROC32 );
270351 this .symbolName = symbolName ;
271352 this .displayName = displayName ;
272353 this .pparent = pparent ;
@@ -276,16 +357,10 @@ public static class CVSymbolGProc32Record extends CVSymbolSubrecord {
276357 this .debugStart = debugStart ;
277358 this .debugEnd = debugEnd ;
278359 this .typeIndex = typeIndex ;
279- this .offset = offset ;
280360 this .segment = segment ;
281361 this .flags = flags ;
282362 }
283363
284- CVSymbolGProc32Record (CVDebugInfo cvDebugInfo , String symbolName , String displayName , int pparent , int pend , int pnext , int proclen , int debugStart , int debugEnd , int typeIndex , int offset ,
285- short segment , byte flags ) {
286- this (cvDebugInfo , CVDebugConstants .S_GPROC32 , symbolName , displayName , pparent , pend , pnext , proclen , debugStart , debugEnd , typeIndex , offset , segment , flags );
287- }
288-
289364 @ Override
290365 protected int computeContents (byte [] buffer , int initialPos ) {
291366 int pos = CVUtil .putInt (pparent , buffer , initialPos );
@@ -303,8 +378,8 @@ protected int computeContents(byte[] buffer, int initialPos) {
303378
304379 @ Override
305380 public String toString () {
306- return String .format ("S_GPROC32 name=%s/%s parent=%d debugstart=0x%x debugend=0x%x len=0x%x seg:offset=0x%x:0x%x type=0x%x flags=0x%x)" , displayName , symbolName , pparent , debugStart ,
307- debugEnd , proclen , segment , offset , typeIndex , flags );
381+ return String .format ("S_GPROC32 name=%s/%s parent=%d debugstart=0x%x debugend=0x%x len=0x%x seg:offset=0x%x:0 type=0x%x flags=0x%x)" , displayName , symbolName , pparent , debugStart ,
382+ debugEnd , proclen , segment , typeIndex , flags );
308383 }
309384 }
310385
@@ -351,6 +426,30 @@ public String toString() {
351426 }
352427 }
353428
429+ public static final class CVSymbolUDTRecord extends CVSymbolSubrecord {
430+
431+ private final int typeIdx ;
432+ private final String typeName ;
433+
434+ CVSymbolUDTRecord (CVDebugInfo cvDebugInfo , int typeIdx , String typeName ) {
435+ super (cvDebugInfo , CVDebugConstants .S_UDT );
436+ this .typeIdx = typeIdx ;
437+ this .typeName = typeName ;
438+ }
439+
440+ @ Override
441+ protected int computeContents (byte [] buffer , int initialPos ) {
442+ int pos = CVUtil .putInt (typeIdx , buffer , initialPos );
443+ pos = CVUtil .putUTF8StringBytes (typeName , buffer , pos );
444+ return pos ;
445+ }
446+
447+ @ Override
448+ public String toString () {
449+ return String .format ("S_UDT type=0x%x typename=%s" , typeIdx , typeName );
450+ }
451+ }
452+
354453 public static class CVSymbolEndRecord extends CVSymbolSubrecord {
355454
356455 CVSymbolEndRecord (CVDebugInfo cvDebugInfo , short cmd ) {
0 commit comments