| ... | ... | @@ -27,8 +27,7 @@ const maxInt = std.math.maxInt; |
| 27 | 27 | const MemoryAccessor = std.debug.MemoryAccessor; |
| 28 | 28 | const Path = std.Build.Cache.Path; |
| 29 | 29 | |
| 30 | | /// Did I mention this is deprecated? |
| 31 | | const DeprecatedFixedBufferReader = std.debug.DeprecatedFixedBufferReader; |
| 30 | const FixedBufferReader = std.debug.FixedBufferReader; |
| 32 | 31 | |
| 33 | 32 | const Dwarf = @This(); |
| 34 | 33 | |
| ... | ... | @@ -328,7 +327,7 @@ pub const ExceptionFrameHeader = struct { |
| 328 | 327 | var left: usize = 0; |
| 329 | 328 | var len: usize = self.fde_count; |
| 330 | 329 | |
| 331 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = self.entries, .endian = native_endian }; |
| 330 | var fbr: FixedBufferReader = .{ .buf = self.entries, .endian = native_endian }; |
| 332 | 331 | |
| 333 | 332 | while (len > 1) { |
| 334 | 333 | const mid = left + len / 2; |
| ... | ... | @@ -371,7 +370,7 @@ pub const ExceptionFrameHeader = struct { |
| 371 | 370 | const eh_frame = @as([*]const u8, @ptrFromInt(self.eh_frame_ptr))[0 .. eh_frame_len orelse maxInt(u32)]; |
| 372 | 371 | |
| 373 | 372 | const fde_offset = fde_ptr - self.eh_frame_ptr; |
| 374 | | var eh_frame_fbr: DeprecatedFixedBufferReader = .{ |
| 373 | var eh_frame_fbr: FixedBufferReader = .{ |
| 375 | 374 | .buf = eh_frame, |
| 376 | 375 | .pos = fde_offset, |
| 377 | 376 | .endian = native_endian, |
| ... | ... | @@ -429,9 +428,9 @@ pub const EntryHeader = struct { |
| 429 | 428 | } |
| 430 | 429 | |
| 431 | 430 | /// Reads a header for either an FDE or a CIE, then advances the fbr to the position after the trailing structure. |
| 432 | | /// `fbr` must be a DeprecatedFixedBufferReader backed by either the .eh_frame or .debug_frame sections. |
| 431 | /// `fbr` must be a FixedBufferReader backed by either the .eh_frame or .debug_frame sections. |
| 433 | 432 | pub fn read( |
| 434 | | fbr: *DeprecatedFixedBufferReader, |
| 433 | fbr: *FixedBufferReader, |
| 435 | 434 | opt_ma: ?*MemoryAccessor, |
| 436 | 435 | dwarf_section: Section.Id, |
| 437 | 436 | ) !EntryHeader { |
| ... | ... | @@ -544,7 +543,7 @@ pub const CommonInformationEntry = struct { |
| 544 | 543 | ) !CommonInformationEntry { |
| 545 | 544 | if (addr_size_bytes > 8) return error.UnsupportedAddrSize; |
| 546 | 545 | |
| 547 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = cie_bytes, .endian = endian }; |
| 546 | var fbr: FixedBufferReader = .{ .buf = cie_bytes, .endian = endian }; |
| 548 | 547 | |
| 549 | 548 | const version = try fbr.readByte(); |
| 550 | 549 | switch (dwarf_section) { |
| ... | ... | @@ -678,7 +677,7 @@ pub const FrameDescriptionEntry = struct { |
| 678 | 677 | ) !FrameDescriptionEntry { |
| 679 | 678 | if (addr_size_bytes > 8) return error.InvalidAddrSize; |
| 680 | 679 | |
| 681 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = fde_bytes, .endian = endian }; |
| 680 | var fbr: FixedBufferReader = .{ .buf = fde_bytes, .endian = endian }; |
| 682 | 681 | |
| 683 | 682 | const pc_begin = try readEhPointer(&fbr, cie.fde_pointer_enc, addr_size_bytes, .{ |
| 684 | 683 | .pc_rel_base = try pcRelBase(@intFromPtr(&fde_bytes[fbr.pos]), pc_rel_offset), |
| ... | ... | @@ -785,10 +784,10 @@ pub fn getSymbolName(di: *Dwarf, address: u64) ?[]const u8 { |
| 785 | 784 | const ScanError = error{ |
| 786 | 785 | InvalidDebugInfo, |
| 787 | 786 | MissingDebugInfo, |
| 788 | | } || Allocator.Error || std.debug.DeprecatedFixedBufferReader.Error; |
| 787 | } || Allocator.Error || std.debug.FixedBufferReader.Error; |
| 789 | 788 | |
| 790 | 789 | fn scanAllFunctions(di: *Dwarf, allocator: Allocator) ScanError!void { |
| 791 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; |
| 790 | var fbr: FixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; |
| 792 | 791 | var this_unit_offset: u64 = 0; |
| 793 | 792 | |
| 794 | 793 | while (this_unit_offset < fbr.buf.len) { |
| ... | ... | @@ -975,7 +974,7 @@ fn scanAllFunctions(di: *Dwarf, allocator: Allocator) ScanError!void { |
| 975 | 974 | } |
| 976 | 975 | |
| 977 | 976 | fn scanAllCompileUnits(di: *Dwarf, allocator: Allocator) ScanError!void { |
| 978 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; |
| 977 | var fbr: FixedBufferReader = .{ .buf = di.section(.debug_info).?, .endian = di.endian }; |
| 979 | 978 | var this_unit_offset: u64 = 0; |
| 980 | 979 | |
| 981 | 980 | var attrs_buf = std.ArrayList(Die.Attr).init(allocator); |
| ... | ... | @@ -1100,7 +1099,7 @@ const DebugRangeIterator = struct { |
| 1100 | 1099 | section_type: Section.Id, |
| 1101 | 1100 | di: *const Dwarf, |
| 1102 | 1101 | compile_unit: *const CompileUnit, |
| 1103 | | fbr: DeprecatedFixedBufferReader, |
| 1102 | fbr: FixedBufferReader, |
| 1104 | 1103 | |
| 1105 | 1104 | pub fn init(ranges_value: *const FormValue, di: *const Dwarf, compile_unit: *const CompileUnit) !@This() { |
| 1106 | 1105 | const section_type = if (compile_unit.version >= 5) Section.Id.debug_rnglists else Section.Id.debug_ranges; |
| ... | ... | @@ -1275,7 +1274,7 @@ fn getAbbrevTable(di: *Dwarf, allocator: Allocator, abbrev_offset: u64) !*const |
| 1275 | 1274 | } |
| 1276 | 1275 | |
| 1277 | 1276 | fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table { |
| 1278 | | var fbr: DeprecatedFixedBufferReader = .{ |
| 1277 | var fbr: FixedBufferReader = .{ |
| 1279 | 1278 | .buf = di.section(.debug_abbrev).?, |
| 1280 | 1279 | .pos = cast(usize, offset) orelse return bad(), |
| 1281 | 1280 | .endian = di.endian, |
| ... | ... | @@ -1327,7 +1326,7 @@ fn parseAbbrevTable(di: *Dwarf, allocator: Allocator, offset: u64) !Abbrev.Table |
| 1327 | 1326 | } |
| 1328 | 1327 | |
| 1329 | 1328 | fn parseDie( |
| 1330 | | fbr: *DeprecatedFixedBufferReader, |
| 1329 | fbr: *FixedBufferReader, |
| 1331 | 1330 | attrs_buf: []Die.Attr, |
| 1332 | 1331 | abbrev_table: *const Abbrev.Table, |
| 1333 | 1332 | format: Format, |
| ... | ... | @@ -1362,7 +1361,7 @@ pub fn getLineNumberInfo( |
| 1362 | 1361 | const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT.comp_dir, di.section(.debug_line_str), compile_unit); |
| 1363 | 1362 | const line_info_offset = try compile_unit.die.getAttrSecOffset(AT.stmt_list); |
| 1364 | 1363 | |
| 1365 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = di.section(.debug_line).?, .endian = di.endian }; |
| 1364 | var fbr: FixedBufferReader = .{ .buf = di.section(.debug_line).?, .endian = di.endian }; |
| 1366 | 1365 | try fbr.seekTo(line_info_offset); |
| 1367 | 1366 | |
| 1368 | 1367 | const unit_header = try readUnitHeader(&fbr, null); |
| ... | ... | @@ -1655,7 +1654,7 @@ fn readDebugAddr(di: Dwarf, compile_unit: CompileUnit, index: u64) !u64 { |
| 1655 | 1654 | /// of FDEs is built for binary searching during unwinding. |
| 1656 | 1655 | pub fn scanAllUnwindInfo(di: *Dwarf, allocator: Allocator, base_address: usize) !void { |
| 1657 | 1656 | if (di.section(.eh_frame_hdr)) |eh_frame_hdr| blk: { |
| 1658 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = eh_frame_hdr, .endian = native_endian }; |
| 1657 | var fbr: FixedBufferReader = .{ .buf = eh_frame_hdr, .endian = native_endian }; |
| 1659 | 1658 | |
| 1660 | 1659 | const version = try fbr.readByte(); |
| 1661 | 1660 | if (version != 1) break :blk; |
| ... | ... | @@ -1695,7 +1694,7 @@ pub fn scanAllUnwindInfo(di: *Dwarf, allocator: Allocator, base_address: usize) |
| 1695 | 1694 | const frame_sections = [2]Section.Id{ .eh_frame, .debug_frame }; |
| 1696 | 1695 | for (frame_sections) |frame_section| { |
| 1697 | 1696 | if (di.section(frame_section)) |section_data| { |
| 1698 | | var fbr: DeprecatedFixedBufferReader = .{ .buf = section_data, .endian = di.endian }; |
| 1697 | var fbr: FixedBufferReader = .{ .buf = section_data, .endian = di.endian }; |
| 1699 | 1698 | while (fbr.pos < fbr.buf.len) { |
| 1700 | 1699 | const entry_header = try EntryHeader.read(&fbr, null, frame_section); |
| 1701 | 1700 | switch (entry_header.type) { |
| ... | ... | @@ -1739,7 +1738,7 @@ pub fn scanAllUnwindInfo(di: *Dwarf, allocator: Allocator, base_address: usize) |
| 1739 | 1738 | } |
| 1740 | 1739 | |
| 1741 | 1740 | fn parseFormValue( |
| 1742 | | fbr: *DeprecatedFixedBufferReader, |
| 1741 | fbr: *FixedBufferReader, |
| 1743 | 1742 | form_id: u64, |
| 1744 | 1743 | format: Format, |
| 1745 | 1744 | implicit_const: ?i64, |
| ... | ... | @@ -1937,7 +1936,7 @@ const UnitHeader = struct { |
| 1937 | 1936 | unit_length: u64, |
| 1938 | 1937 | }; |
| 1939 | 1938 | |
| 1940 | | fn readUnitHeader(fbr: *DeprecatedFixedBufferReader, opt_ma: ?*MemoryAccessor) ScanError!UnitHeader { |
| 1939 | fn readUnitHeader(fbr: *FixedBufferReader, opt_ma: ?*MemoryAccessor) ScanError!UnitHeader { |
| 1941 | 1940 | return switch (try if (opt_ma) |ma| fbr.readIntChecked(u32, ma) else fbr.readInt(u32)) { |
| 1942 | 1941 | 0...0xfffffff0 - 1 => |unit_length| .{ |
| 1943 | 1942 | .format = .@"32", |
| ... | ... | @@ -2002,7 +2001,7 @@ const EhPointerContext = struct { |
| 2002 | 2001 | text_rel_base: ?u64 = null, |
| 2003 | 2002 | function_rel_base: ?u64 = null, |
| 2004 | 2003 | }; |
| 2005 | | fn readEhPointer(fbr: *DeprecatedFixedBufferReader, enc: u8, addr_size_bytes: u8, ctx: EhPointerContext) !?u64 { |
| 2004 | fn readEhPointer(fbr: *FixedBufferReader, enc: u8, addr_size_bytes: u8, ctx: EhPointerContext) !?u64 { |
| 2006 | 2005 | if (enc == EH.PE.omit) return null; |
| 2007 | 2006 | |
| 2008 | 2007 | const value: union(enum) { |
| ... | ... | @@ -2362,7 +2361,7 @@ pub const ElfModule = struct { |
| 2362 | 2361 | } |
| 2363 | 2362 | }; |
| 2364 | 2363 | |
| 2365 | | pub const ResolveSourceLocationsError = Allocator.Error || DeprecatedFixedBufferReader.Error; |
| 2364 | pub const ResolveSourceLocationsError = Allocator.Error || FixedBufferReader.Error; |
| 2366 | 2365 | |
| 2367 | 2366 | /// Given an array of virtual memory addresses, sorted ascending, outputs a |
| 2368 | 2367 | /// corresponding array of source locations, by appending to the provided |