@@ -245,6 +245,92 @@ 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 , String displayName , int typeIndex , int offset , short segment ) {
291+ super (cvDebugInfo , CVDebugConstants .S_LDATA32 , symbolName , displayName , typeIndex , offset , segment );
292+ }
293+
294+ CVSymbolLData32Record (CVDebugInfo cvDebugInfo , String symbolName , int typeIndex , int offset , short segment ) {
295+ super (cvDebugInfo , CVDebugConstants .S_LDATA32 , symbolName , symbolName , typeIndex , offset , segment );
296+ }
297+
298+ @ Override
299+ public String toString () {
300+ return String .format ("S_LDATA32 name=%s(%s) offset=0x%x type=0x%x" , symbolName , displayName , offset , typeIndex );
301+ }
302+ }
303+
304+ public static class CVSymbolRegRel32Record extends CVSymbolSubrecord {
305+
306+ private final String name ;
307+ private final int typeIndex ;
308+ private final int offset ;
309+ private final short register ;
310+
311+ CVSymbolRegRel32Record (CVDebugInfo debugInfo , String name , int typeIndex , int offset , short register ) {
312+ super (debugInfo , CVDebugConstants .S_REGREL32 );
313+ this .name = name ;
314+ this .typeIndex = typeIndex ;
315+ this .offset = offset ;
316+ this .register = register ;
317+ }
318+
319+ @ Override
320+ protected int computeContents (byte [] buffer , int initialPos ) {
321+ int pos = CVUtil .putInt (offset , buffer , initialPos );
322+ pos = CVUtil .putInt (typeIndex , buffer , pos );
323+ pos = CVUtil .putShort (register , buffer , pos );
324+ pos = CVUtil .putUTF8StringBytes (name , buffer , pos );
325+ return pos ;
326+ }
327+
328+ @ Override
329+ public String toString () {
330+ return String .format ("S_REGREL32 name=%s offset=(r%d + 0x%x) type=0x%x)" , name , register , offset , typeIndex );
331+ }
332+ }
333+
248334 /*
249335 * Creating a proc32 record has a side effect: two relocation entries are added to the section
250336 * relocation table; they refer back to the global symbol.
@@ -258,15 +344,14 @@ public static class CVSymbolGProc32Record extends CVSymbolSubrecord {
258344 private final int debugStart ;
259345 private final int debugEnd ;
260346 private final int typeIndex ;
261- private final int offset ;
262347 private final short segment ;
263348 private final byte flags ;
264349 private final String symbolName ;
265350 private final String displayName ;
266351
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 );
352+ CVSymbolGProc32Record (CVDebugInfo cvDebugInfo , String symbolName , String displayName , int pparent , int pend , int pnext , int proclen , int debugStart , int debugEnd , int typeIndex ,
353+ short segment , byte flags ) {
354+ super (cvDebugInfo , CVDebugConstants . S_GPROC32 );
270355 this .symbolName = symbolName ;
271356 this .displayName = displayName ;
272357 this .pparent = pparent ;
@@ -276,16 +361,10 @@ public static class CVSymbolGProc32Record extends CVSymbolSubrecord {
276361 this .debugStart = debugStart ;
277362 this .debugEnd = debugEnd ;
278363 this .typeIndex = typeIndex ;
279- this .offset = offset ;
280364 this .segment = segment ;
281365 this .flags = flags ;
282366 }
283367
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-
289368 @ Override
290369 protected int computeContents (byte [] buffer , int initialPos ) {
291370 int pos = CVUtil .putInt (pparent , buffer , initialPos );
@@ -303,8 +382,8 @@ protected int computeContents(byte[] buffer, int initialPos) {
303382
304383 @ Override
305384 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 );
385+ 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 ,
386+ debugEnd , proclen , segment , typeIndex , flags );
308387 }
309388 }
310389
@@ -351,6 +430,30 @@ public String toString() {
351430 }
352431 }
353432
433+ public static final class CVSymbolUDTRecord extends CVSymbolSubrecord {
434+
435+ private final int typeIdx ;
436+ private final String typeName ;
437+
438+ CVSymbolUDTRecord (CVDebugInfo cvDebugInfo , int typeIdx , String typeName ) {
439+ super (cvDebugInfo , CVDebugConstants .S_UDT );
440+ this .typeIdx = typeIdx ;
441+ this .typeName = typeName ;
442+ }
443+
444+ @ Override
445+ protected int computeContents (byte [] buffer , int initialPos ) {
446+ int pos = CVUtil .putInt (typeIdx , buffer , initialPos );
447+ pos = CVUtil .putUTF8StringBytes (typeName , buffer , pos );
448+ return pos ;
449+ }
450+
451+ @ Override
452+ public String toString () {
453+ return String .format ("S_UDT type=0x%x typename=%s" , typeIdx , typeName );
454+ }
455+ }
456+
354457 public static class CVSymbolEndRecord extends CVSymbolSubrecord {
355458
356459 CVSymbolEndRecord (CVDebugInfo cvDebugInfo , short cmd ) {
0 commit comments