From ef11bc9899002620d67cfce9c79b6c0dc0f5ea61 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Tue, 6 Aug 2024 11:22:37 -0400 Subject: Dwarf: rework self-hosted debug info from scratch This is in preparation for incremental and actually being able to debug executables built by the x86_64 backend. --- src/link.zig | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/link.zig') diff --git a/src/link.zig b/src/link.zig index 3463a77147..b3e0aaa4a8 100644 --- a/src/link.zig +++ b/src/link.zig @@ -329,6 +329,9 @@ pub const File = struct { } } + pub const UpdateDebugInfoError = Dwarf.UpdateError; + pub const FlushDebugInfoError = Dwarf.FlushError; + pub const UpdateNavError = error{ OutOfMemory, Overflow, @@ -365,7 +368,7 @@ pub const File = struct { DeviceBusy, InvalidArgument, HotSwapUnavailableOnHostOperatingSystem, - }; + } || UpdateDebugInfoError; /// Called from within CodeGen to retrieve the symbol index of a global symbol. /// If no symbol exists yet with this name, a new undefined global symbol will @@ -398,6 +401,16 @@ pub const File = struct { } } + pub fn updateContainerType(base: *File, pt: Zcu.PerThread, ty: InternPool.Index) UpdateNavError!void { + switch (base.tag) { + else => {}, + inline .elf => |tag| { + dev.check(tag.devFeature()); + return @as(*tag.Type(), @fieldParentPtr("base", base)).updateContainerType(pt, ty); + }, + } + } + /// May be called before or after updateExports for any given Decl. pub fn updateFunc( base: *File, @@ -570,6 +583,7 @@ pub const File = struct { Unseekable, UnsupportedCpuArchitecture, UnsupportedVersion, + UnexpectedEndOfFile, } || fs.File.WriteFileError || fs.File.OpenError || -- cgit v1.2.3