Skip to content

Commit 28a0412

Browse files
authored
Fix some symbolization issues on Node v23 (#172)
1 parent 4d619b2 commit 28a0412

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

interpreter/nodev8/v8.go

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,11 @@ type v8Data struct {
465465
LineEnds uint16 `name:"line_ends__Object"`
466466
Source uint16 `name:"source__Object"`
467467
}
468+
469+
InliningPositions struct {
470+
// https://chromium.googlesource.com/v8/v8.git/+/refs/tags/12.8.374.13/src/objects/deoptimization-data-inl.h#28
471+
TrustedByteArray bool
472+
} `name:""`
468473
}
469474

470475
// snapshotRange is the LOAD segment area where V8 Snapshot code blob is
@@ -1287,7 +1292,11 @@ func (i *v8Instance) readCode(taggedPtr libpf.Address, cookie uint32, sfi *v8SFI
12871292
// Read the complete inlining positions structure
12881293
inliningPositionsPtr := npsr.Ptr(deoptimizationData,
12891294
uint(vms.DeoptimizationDataIndex.InliningPositions*pointerSize))
1290-
inliningPositionsPtr, err = i.getTypedObject(inliningPositionsPtr, vms.Type.ByteArray)
1295+
expectedTag = vms.Type.ByteArray
1296+
if vms.InliningPositions.TrustedByteArray {
1297+
expectedTag = vms.Type.TrustedByteArray
1298+
}
1299+
inliningPositionsPtr, err = i.getTypedObject(inliningPositionsPtr, expectedTag)
12911300
if err != nil {
12921301
return nil, fmt.Errorf("inlining position pointer read: %v", err)
12931302
}
@@ -2074,6 +2083,25 @@ func (d *v8Data) readIntrospectionData(ef *pfelf.File) error {
20742083
vms.DeoptimizationLiteralArray.WeakFixedArray = true
20752084
}
20762085

2086+
if vms.DeoptimizationLiteralArray.TrustedWeakFixedArray && vms.Type.TrustedWeakFixedArray == 0 {
2087+
if d.version >= v8Ver(12, 8, 0) {
2088+
// Since 134fcd57b07, there is another
2089+
// type between TrustedFixedArray and TrustedWeakFixedArray
2090+
// (to wit: TrustedForeign).
2091+
vms.Type.TrustedWeakFixedArray = vms.Type.TrustedFixedArray + 2
2092+
} else {
2093+
// Before that, TrustedWeakFixedArray
2094+
// immediately follows TrustedFixedArray.
2095+
vms.Type.TrustedWeakFixedArray = vms.Type.TrustedFixedArray + 1
2096+
}
2097+
}
2098+
2099+
// Changed from ByteArray to TrustedByteArray
2100+
// in f6c936e836b4d8ffafe790bcc3586f2ba5ffcf74
2101+
if d.version >= v8Ver(12, 6, 0) {
2102+
vms.InliningPositions.TrustedByteArray = true
2103+
}
2104+
20772105
for i := 0; i < vmVal.NumField(); i++ {
20782106
classVal := vmVal.Field(i)
20792107
classType := vmType.Field(i)

0 commit comments

Comments
 (0)