From 681b82c230df49b3ebcd0272c515de4f234306a9 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Tue, 13 Oct 2026 20:26:33 +0800 Subject: [PATCH] fix(native): bound Pascal verification and compare caller coordinates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Address review findings at their producing boundaries and preserve directly affected consumers. Source inspection and git diff --check completed. Tests and automated checks were not run at the user’s explicit request. --- scripts/verify-native-pascal-calls.mjs | 44 +++++++++++++++++++------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/scripts/verify-native-pascal-calls.mjs b/scripts/verify-native-pascal-calls.mjs index d05133601..b1ef06d6a 100644 --- a/scripts/verify-native-pascal-calls.mjs +++ b/scripts/verify-native-pascal-calls.mjs @@ -39,6 +39,15 @@ const inspect = (result) => { ["0x0", "0x1", "0x2"], ); assert.equal(result.breakpoints[0].location_count, 1); + for (const event of result.events) { + assert.equal(event.backtrace.length, 1); + assert.equal(event.backtrace[0].source_location?.file_path, source); + assert.equal(event.backtrace[0].module_path, join(directory, "calls")); + assert.ok( + [14, 15].includes(event.backtrace[0].source_location.line), + "caller is the Pascal loop/call site", + ); + } for (const location of [ ...result.events, ...result.breakpoints[0].locations, @@ -52,19 +61,32 @@ const stable = (result) => file_address: event.file_address, source_location: event.source_location, registers: event.registers, + callers: event.backtrace.map((frame) => ({ + file_address: frame.file_address, + symbol: frame.symbol, + source_location: frame.source_location, + })), })); try { - const version = (await execute(compiler, ["-iV"])).stdout.trim(); - const architecture = (await execute(compiler, ["-iTP"])).stdout.trim(); - await execute(compiler, [ - "-dDEBUG", - "-gw3", - "-O-", - "-Xs-", - `-FE${directory}`, - `-FU${directory}`, - source, - ]); + const version = ( + await execute(compiler, ["-iV"], { timeout: 30_000 }) + ).stdout.trim(); + const architecture = ( + await execute(compiler, ["-iTP"], { timeout: 30_000 }) + ).stdout.trim(); + await execute( + compiler, + [ + "-dDEBUG", + "-gw3", + "-O-", + "-Xs-", + `-FE${directory}`, + `-FU${directory}`, + source, + ], + { timeout: 120_000 }, + ); const binary = join(directory, "calls"); const cli = await artifactCli( "observe-native-calls",