| author | |
| committer | |
| log | 541bd6c3693cc57850dc5d78257584dd82f00ec6 |
| tree | 05e39af24991da9fb7d1bf247c66c68060a107b3 |
| parent | 87fb7df25794d12b2316dd41a9111e2206c00152 |
3 files changed, 13 insertions(+), 5 deletions(-)
lib/std/debug.zig+1-1| ... | @@ -1704,7 +1704,7 @@ test "manage resources correctly" { | ... | @@ -1704,7 +1704,7 @@ test "manage resources correctly" { |
| 1704 | const t: Io.Terminal = .{ .writer = &discarding.writer, .mode = .no_color }; | 1704 | const t: Io.Terminal = .{ .writer = &discarding.writer, .mode = .no_color }; |
| 1705 | try printSourceAtAddress(io, &di, t, .{ | 1705 | try printSourceAtAddress(io, &di, t, .{ |
| 1706 | .address = S.showMyTrace(), | 1706 | .address = S.showMyTrace(), |
| 1707 | .inlines = true, | 1707 | .resolve_inline_callers = true, |
| 1708 | }); | 1708 | }); |
| 1709 | } | 1709 | } |
| 1710 | 1710 |
lib/std/testing/FailingAllocator.zig+2-2| ... | @@ -65,7 +65,7 @@ fn alloc( | ... | @@ -65,7 +65,7 @@ fn alloc( |
| 65 | if (self.alloc_index == self.fail_index) { | 65 | if (self.alloc_index == self.fail_index) { |
| 66 | if (!self.has_induced_failure) { | 66 | if (!self.has_induced_failure) { |
| 67 | const st = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &self.stack_addresses); | 67 | const st = std.debug.captureCurrentStackTrace(.{ .first_address = return_address }, &self.stack_addresses); |
| 68 | @memset(self.stack_addresses[@min(st.index, self.stack_addresses.len)..], 0); | 68 | @memset(self.stack_addresses[@min(st.return_addresses.len, self.stack_addresses.len)..], 0); |
| 69 | self.has_induced_failure = true; | 69 | self.has_induced_failure = true; |
| 70 | } | 70 | } |
| 71 | return null; | 71 | return null; |
| ... | @@ -138,7 +138,7 @@ pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace { | ... | @@ -138,7 +138,7 @@ pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace { |
| 138 | len += 1; | 138 | len += 1; |
| 139 | } | 139 | } |
| 140 | return .{ | 140 | return .{ |
| 141 | .instruction_addresses = &self.stack_addresses, | 141 | .return_addresses = &self.stack_addresses, |
| 142 | .index = len, | 142 | .index = len, |
| 143 | }; | 143 | }; |
| 144 | } | 144 | } |
test/standalone/coff_dwarf/main.zig+10-2| ... | @@ -12,8 +12,16 @@ pub fn main(init: std.process.Init) void { | ... | @@ -12,8 +12,16 @@ pub fn main(init: std.process.Init) void { |
| 12 | var add_addr: usize = undefined; | 12 | var add_addr: usize = undefined; |
| 13 | _ = add(1, 2, &add_addr); | 13 | _ = add(1, 2, &add_addr); |
| 14 | 14 | ||
| 15 | const symbol = di.getSymbol(io, add_addr) catch |err| fatal("failed to get symbol: {t}", .{err}); | 15 | const symbols = di.getSymbols(io, add_addr) catch |err| fatal("failed to get symbol: {t}", .{err}); |
| 16 | defer if (symbol.source_location) |sl| std.debug.getDebugInfoAllocator().free(sl.file_name); | 16 | const debug_gpa = std.debug.getDebugInfoAllocator(); |
| 17 | defer for (symbols) |symbol| { | ||
| 18 | if (symbol.source_location) |sl| { | ||
| 19 | debug_gpa.free(sl.file_name); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
| 23 | if (symbols.len != 1) fatal("expected 1 symbol, found {}", .{symbols.len}); | ||
| 24 | const symbol = symbols[0]; | ||
| 17 | 25 | ||
| 18 | if (symbol.name == null) fatal("failed to resolve symbol name", .{}); | 26 | if (symbol.name == null) fatal("failed to resolve symbol name", .{}); |
| 19 | if (symbol.compile_unit_name == null) fatal("failed to resolve compile unit", .{}); | 27 | if (symbol.compile_unit_name == null) fatal("failed to resolve compile unit", .{}); |