mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 14:31:22 +00:00
refactor(firmware): share vector table omission reporting (#16761)
This commit is contained in:
1 parent
32769c78d2
commit
22d582d26a
1 file changed
+14
-19
@@ -358,30 +358,25 @@ const finalizeTableHeader = (input: TableHeaderInput) => {
|
||||
architecturalTableBytes === undefined
|
||||
? availableFromOffset
|
||||
: Math.min(availableFromOffset, architecturalTableBytes);
|
||||
const hasUndecodedSlots = decodedSlotBytes < effectiveTableBytes;
|
||||
const omissionStart = hasUndecodedSlots ? decodedSlotBytes : consumedBytes;
|
||||
const omissionEnd = hasUndecodedSlots
|
||||
? effectiveTableBytes
|
||||
: availableFromOffset;
|
||||
const coverageAcc = new CoverageAccumulator().recordComplete();
|
||||
if (customCapReason !== undefined) {
|
||||
coverageAcc.recordOmission(customCapReason);
|
||||
limitations.push(customCapReason);
|
||||
} else if (decodedSlotBytes < effectiveTableBytes) {
|
||||
const afterSlotsOffset = options.vectorTableOffset + decodedSlotBytes;
|
||||
const omission =
|
||||
let omission = customCapReason;
|
||||
if (omission === undefined && omissionStart < omissionEnd) {
|
||||
const afterSlotsOffset = options.vectorTableOffset + omissionStart;
|
||||
omission =
|
||||
entryCount === addressableEntries && entryCount < options.maxEntries
|
||||
? `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes); later slots would lie past the end of the ${options.architecture === "avr" ? "AVR program" : "32-bit"} address space and were not interpreted.`
|
||||
: entryCount < options.maxEntries
|
||||
? `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes); ${String(effectiveTableBytes - decodedSlotBytes)} trailing byte(s) past offset ${String(afterSlotsOffset)} do not form a complete ${slotWidthLabel} slot.`
|
||||
: consumedBytes > decodedSlotBytes
|
||||
? `Decoded ${String(entryCount)} slot(s) (${String(decodedSlotBytes)} slot bytes; ${String(consumedBytes)} bytes examined) up to max_entries; ${String(effectiveTableBytes - decodedSlotBytes)} vector-table byte(s) past offset ${String(afterSlotsOffset)} were not decoded as vector slots.`
|
||||
? `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes); ${String(omissionEnd - omissionStart)} trailing byte(s) past offset ${String(afterSlotsOffset)} do not form a complete ${slotWidthLabel} slot.`
|
||||
: consumedBytes > omissionStart
|
||||
? `Decoded ${String(entryCount)} slot(s) (${String(omissionStart)} slot bytes; ${String(consumedBytes)} bytes examined) up to max_entries; ${String(omissionEnd - omissionStart)} vector-table byte(s) past offset ${String(afterSlotsOffset)} were not decoded as vector slots.`
|
||||
: `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes) up to max_entries; bytes past offset ${String(afterSlotsOffset)} were not interpreted as vector slots.`;
|
||||
coverageAcc.recordOmission(omission);
|
||||
limitations.push(omission);
|
||||
} else if (consumedBytes < availableFromOffset) {
|
||||
const afterConsumedOffset = options.vectorTableOffset + consumedBytes;
|
||||
const omission =
|
||||
entryCount === addressableEntries && entryCount < options.maxEntries
|
||||
? `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes); later slots would lie past the end of the ${options.architecture === "avr" ? "AVR program" : "32-bit"} address space and were not interpreted.`
|
||||
: entryCount < options.maxEntries
|
||||
? `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes); ${String(availableFromOffset - consumedBytes)} trailing byte(s) past offset ${String(afterConsumedOffset)} do not form a complete ${slotWidthLabel} slot.`
|
||||
: `Decoded ${String(entryCount)} slots (${String(consumedBytes)} bytes) up to max_entries; bytes past offset ${String(afterConsumedOffset)} were not interpreted as vector slots.`;
|
||||
}
|
||||
if (omission !== undefined) {
|
||||
coverageAcc.recordOmission(omission);
|
||||
limitations.push(omission);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user