authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-07 16:35:10-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-12 04:01:29-07:00
logcc15c8ae7e0b8d994e818f8275bf73617edefe68
tree3fe340d8a4c396c9c57e1b4362a0f77895933944
parentfa26ab6fa36a5f8d2a6cf11063d42519854d008c

Cleans up binary annotation opcodes that we don't handle


1 files changed, 13 insertions(+), 8 deletions(-)

lib/std/debug/Pdb.zig+13-8
...@@ -357,8 +357,8 @@ pub const BinaryAnnotation = union(enum) {...@@ -357,8 +357,8 @@ pub const BinaryAnnotation = union(enum) {
357 .change_file => |file_id| {357 .change_file => |file_id| {
358 self.curr.file_id = file_id;358 self.curr.file_id = file_id;
359 },359 },
360 // LLVM never emits this opcode, but it's clear enough how to interpret it so we may as360 // LLVM never emits this opcode, but it's clear enough how to interpret it so we
361 // well in case they use it in the future361 // may as well in case they use it in the future
362 .change_code_length_and_code_offset => |info| {362 .change_code_length_and_code_offset => |info| {
363 self.curr.code_length = info.length;363 self.curr.code_length = info.length;
364 self.curr.code_offset += info.delta;364 self.curr.code_offset += info.delta;
...@@ -371,21 +371,24 @@ pub const BinaryAnnotation = union(enum) {...@@ -371,21 +371,24 @@ pub const BinaryAnnotation = union(enum) {
371 self.curr.line_offset += info.line_delta;371 self.curr.line_offset += info.line_delta;
372 },372 },
373373
374 // Not emitted by LLVM at the time of writing, but if we get it from elsewhere it should374 // Not emitted by LLVM at the time of writing, and we don't want to add support
375 // be safe to ignore since we don't use this info. Theoretically we could use column375 // without a test csae. Safe to ignore since we don't use this info right now.
376 // info if it was present, but it's not easy to test since LLVM doesn't output it.
377 .change_line_end_delta,376 .change_line_end_delta,
378 .change_column_start,377 .change_column_start,
379 .change_column_end_delta,378 .change_column_end_delta,
380 .change_column_end,379 .change_column_end,
381 => {},380 => {},
382381
383 // Not emitted by LLVM at the time of writing. Various sources conflict on how these382 // Not emitted by LLVM at the time of writing. Various sources conflict on how
384 // instructions should be interpreted, so we make no attempt to handle them.383 // these opcodes should be interpreted, so we make no attempt to handle them.
385 .code_offset,384 .code_offset,
386 .change_code_offset_base,385 .change_code_offset_base,
387 .change_range_kind,386 .change_range_kind,
388 => @panic("unimplemented"),387 => {
388 self.annotations = .empty;
389 self.prev = null;
390 return null;
391 },
389 }392 }
390393
391 switch (annotation) {394 switch (annotation) {
...@@ -433,6 +436,8 @@ pub const BinaryAnnotation = union(enum) {...@@ -433,6 +436,8 @@ pub const BinaryAnnotation = union(enum) {
433 pub const Iterator = struct {436 pub const Iterator = struct {
434 reader: Io.Reader,437 reader: Io.Reader,
435438
439 pub const empty: Iterator = .{ .reader = .ending_instance };
440
436 pub fn next(self: *Iterator) error{InvalidDebugInfo}!?BinaryAnnotation {441 pub fn next(self: *Iterator) error{InvalidDebugInfo}!?BinaryAnnotation {
437 return take(&self.reader) catch |err| switch (err) {442 return take(&self.reader) catch |err| switch (err) {
438 error.ReadFailed => return error.InvalidDebugInfo,443 error.ReadFailed => return error.InvalidDebugInfo,