From cc15c8ae7e0b8d994e818f8275bf73617edefe68 Mon Sep 17 00:00:00 2001 From: Mason Remaley Date: Tue, 7 Apr 2026 16:35:10 -0700 Subject: [PATCH] Cleans up binary annotation opcodes that we don't handle --- lib/std/debug/Pdb.zig | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/std/debug/Pdb.zig b/lib/std/debug/Pdb.zig index e7016d50180ed5793480874aebd9dd45cb3872a7..198e81534628967a923f3e9ef558be8a6f0e6178 100644 --- a/lib/std/debug/Pdb.zig +++ b/lib/std/debug/Pdb.zig @@ -357,8 +357,8 @@ pub const BinaryAnnotation = union(enum) { .change_file => |file_id| { self.curr.file_id = file_id; }, - // LLVM never emits this opcode, but it's clear enough how to interpret it so we may as - // well in case they use it in the future + // LLVM never emits this opcode, but it's clear enough how to interpret it so we + // may as well in case they use it in the future .change_code_length_and_code_offset => |info| { self.curr.code_length = info.length; self.curr.code_offset += info.delta; @@ -371,21 +371,24 @@ pub const BinaryAnnotation = union(enum) { self.curr.line_offset += info.line_delta; }, - // Not emitted by LLVM at the time of writing, but if we get it from elsewhere it should - // be safe to ignore since we don't use this info. Theoretically we could use column - // info if it was present, but it's not easy to test since LLVM doesn't output it. + // Not emitted by LLVM at the time of writing, and we don't want to add support + // without a test csae. Safe to ignore since we don't use this info right now. .change_line_end_delta, .change_column_start, .change_column_end_delta, .change_column_end, => {}, - // Not emitted by LLVM at the time of writing. Various sources conflict on how these - // instructions should be interpreted, so we make no attempt to handle them. + // Not emitted by LLVM at the time of writing. Various sources conflict on how + // these opcodes should be interpreted, so we make no attempt to handle them. .code_offset, .change_code_offset_base, .change_range_kind, - => @panic("unimplemented"), + => { + self.annotations = .empty; + self.prev = null; + return null; + }, } switch (annotation) { @@ -433,6 +436,8 @@ pub const BinaryAnnotation = union(enum) { pub const Iterator = struct { reader: Io.Reader, + pub const empty: Iterator = .{ .reader = .ending_instance }; + pub fn next(self: *Iterator) error{InvalidDebugInfo}!?BinaryAnnotation { return take(&self.reader) catch |err| switch (err) { error.ReadFailed => return error.InvalidDebugInfo, -- 2.54.0