mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 22:32:06 +00:00
Fix runtime stack trace computation (#11581)
Co-authored-by: paperdave <paperdave@users.noreply.github.com>
This commit is contained in:
8
src/api/schema.d.ts
generated
vendored
8
src/api/schema.d.ts
generated
vendored
@@ -355,14 +355,8 @@ export interface StackFrame {
|
||||
}
|
||||
|
||||
export interface StackFramePosition {
|
||||
source_offset: int32;
|
||||
line: int32;
|
||||
line_start: int32;
|
||||
line_stop: int32;
|
||||
column_start: int32;
|
||||
column_stop: int32;
|
||||
expression_start: int32;
|
||||
expression_stop: int32;
|
||||
column: int32;
|
||||
}
|
||||
|
||||
export interface SourceLine {
|
||||
|
||||
9
src/api/schema.js
generated
9
src/api/schema.js
generated
@@ -148,14 +148,9 @@ function encodeStackFrame(message, bb) {
|
||||
function decodeStackFramePosition(bb) {
|
||||
var result = {};
|
||||
|
||||
result["source_offset"] = bb.readInt32();
|
||||
result["line"] = bb.readInt32();
|
||||
result["line_start"] = bb.readInt32();
|
||||
result["line_stop"] = bb.readInt32();
|
||||
result["column_start"] = bb.readInt32();
|
||||
result["column_stop"] = bb.readInt32();
|
||||
result["expression_start"] = bb.readInt32();
|
||||
result["expression_stop"] = bb.readInt32();
|
||||
result["column"] = bb.readInt32();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const bun = @import("root").bun;
|
||||
|
||||
pub const Reader = struct {
|
||||
const Self = @This();
|
||||
@@ -423,56 +424,7 @@ pub const Api = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const StackFramePosition = packed struct {
|
||||
/// source_offset
|
||||
source_offset: i32 = 0,
|
||||
|
||||
/// line
|
||||
line: i32 = 0,
|
||||
|
||||
/// line_start
|
||||
line_start: i32 = 0,
|
||||
|
||||
/// line_stop
|
||||
line_stop: i32 = 0,
|
||||
|
||||
/// column_start
|
||||
column_start: i32 = 0,
|
||||
|
||||
/// column_stop
|
||||
column_stop: i32 = 0,
|
||||
|
||||
/// expression_start
|
||||
expression_start: i32 = 0,
|
||||
|
||||
/// expression_stop
|
||||
expression_stop: i32 = 0,
|
||||
|
||||
pub fn decode(reader: anytype) anyerror!StackFramePosition {
|
||||
var this = std.mem.zeroes(StackFramePosition);
|
||||
|
||||
this.source_offset = try reader.readValue(i32);
|
||||
this.line = try reader.readValue(i32);
|
||||
this.line_start = try reader.readValue(i32);
|
||||
this.line_stop = try reader.readValue(i32);
|
||||
this.column_start = try reader.readValue(i32);
|
||||
this.column_stop = try reader.readValue(i32);
|
||||
this.expression_start = try reader.readValue(i32);
|
||||
this.expression_stop = try reader.readValue(i32);
|
||||
return this;
|
||||
}
|
||||
|
||||
pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
|
||||
try writer.writeInt(this.source_offset);
|
||||
try writer.writeInt(this.line);
|
||||
try writer.writeInt(this.line_start);
|
||||
try writer.writeInt(this.line_stop);
|
||||
try writer.writeInt(this.column_start);
|
||||
try writer.writeInt(this.column_stop);
|
||||
try writer.writeInt(this.expression_start);
|
||||
try writer.writeInt(this.expression_stop);
|
||||
}
|
||||
};
|
||||
pub const StackFramePosition = bun.JSC.ZigStackFramePosition;
|
||||
|
||||
pub const SourceLine = struct {
|
||||
/// line
|
||||
|
||||
Reference in New Issue
Block a user