@@ -344,6 +344,8 @@ private int writeStructField(DebugContext context, FieldEntry fieldEntry, byte[]
344344 pos = writeEmbeddedArrayDataType (context , foreignValueType , valueSize , fieldSize / valueSize , buffer , pos );
345345 } else {
346346 if (foreignValueType .isPointer ()) {
347+ TypeEntry pointerTo = foreignValueType .getPointerTo ();
348+ assert pointerTo != null : "ADDRESS field pointer type must have a known target type" ;
347349 // type the array using the referent of the pointer type
348350 //
349351 // n.b it is critical for correctness to use the index of the referent rather
@@ -355,7 +357,7 @@ private int writeStructField(DebugContext context, FieldEntry fieldEntry, byte[]
355357 // of the referring type and the latter precedes the definition of the
356358 // referent type then the layout index of the referring type may still be unset
357359 // at this point.
358- valueTypeIdx = getTypeIndex (foreignValueType . getPointerTo () );
360+ valueTypeIdx = getTypeIndex (pointerTo );
359361 } else {
360362 valueTypeIdx = getIndirectLayoutIndex (foreignValueType );
361363 }
@@ -1354,6 +1356,8 @@ private int writeEmbeddedArrayDataType(DebugContext context, ForeignTypeEntry fo
13541356 String elementTypeName = foreignValueType .getTypeName ();
13551357 int elementTypeIdx ;
13561358 if (foreignValueType .isPointer ()) {
1359+ TypeEntry pointerTo = foreignValueType .getPointerTo ();
1360+ assert pointerTo != null : "ADDRESS field pointer type must have a known target type" ;
13571361 // type the array using the referent of the pointer type
13581362 //
13591363 // n.b it is critical for correctness to use the index of the referent rather than
@@ -1363,7 +1367,7 @@ private int writeEmbeddedArrayDataType(DebugContext context, ForeignTypeEntry fo
13631367 // However, if this embedded struct field definition precedes the definition of the
13641368 // referring type and the latter precedes the definition of the referent type then
13651369 // the layout index of the referring type may still be unset at this point.
1366- elementTypeIdx = getTypeIndex (foreignValueType . getPointerTo () );
1370+ elementTypeIdx = getTypeIndex (pointerTo );
13671371 } else {
13681372 // type the array using the layout type
13691373 elementTypeIdx = getIndirectLayoutIndex (foreignValueType );
0 commit comments