diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-03-26 14:33:31 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-03-27 20:53:06 +0200 |
| commit | 4ca9b4c44a4fbe2b64b11d2c8a951c2c3e961619 (patch) | |
| tree | 210ed90046909bef6a650a0f74fc94935212f513 /src/link/Dwarf.zig | |
| parent | 1a80315836f77e38eee3e4c0a646b82febbc3604 (diff) | |
| download | zig-4ca9b4c44a4fbe2b64b11d2c8a951c2c3e961619.tar.gz zig-4ca9b4c44a4fbe2b64b11d2c8a951c2c3e961619.zip | |
dwarf: move DbgInfoTypeRelocsTable into Dwarf module
Diffstat (limited to 'src/link/Dwarf.zig')
| -rw-r--r-- | src/link/Dwarf.zig | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig index b2848c8e1e..199bf9df61 100644 --- a/src/link/Dwarf.zig +++ b/src/link/Dwarf.zig @@ -82,6 +82,22 @@ pub const SrcFn = struct { pub const PtrWidth = enum { p32, p64 }; +pub const DbgInfoTypeRelocsTable = std.ArrayHashMapUnmanaged( + Type, + DbgInfoTypeReloc, + Type.HashContext32, + true, +); + +pub const DbgInfoTypeReloc = struct { + /// Offset from `TextBlock.dbg_info_off` (the buffer that is local to a Decl). + /// This is where the .debug_info tag for the type is. + off: u32, + /// Offset from `TextBlock.dbg_info_off` (the buffer that is local to a Decl). + /// List of DW.AT.type / DW.FORM.ref4 that points to the type. + relocs: std.ArrayListUnmanaged(u32), +}; + pub const abbrev_compile_unit = 1; pub const abbrev_subprogram = 2; pub const abbrev_subprogram_retvoid = 3; @@ -138,7 +154,7 @@ pub fn deinit(self: *Dwarf) void { pub const DeclDebugBuffers = struct { dbg_line_buffer: std.ArrayList(u8), dbg_info_buffer: std.ArrayList(u8), - dbg_info_type_relocs: File.DbgInfoTypeRelocsTable, + dbg_info_type_relocs: DbgInfoTypeRelocsTable, }; pub fn initDeclDebugInfo(self: *Dwarf, decl: *Module.Decl) !DeclDebugBuffers { @@ -153,7 +169,7 @@ pub fn initDeclDebugInfo(self: *Dwarf, decl: *Module.Decl) !DeclDebugBuffers { const gpa = self.allocator; var dbg_line_buffer = std.ArrayList(u8).init(gpa); var dbg_info_buffer = std.ArrayList(u8).init(gpa); - var dbg_info_type_relocs: File.DbgInfoTypeRelocsTable = .{}; + var dbg_info_type_relocs: DbgInfoTypeRelocsTable = .{}; assert(decl.has_tv); @@ -890,7 +906,7 @@ fn addDbgInfoType( module: *Module, ty: Type, dbg_info_buffer: *std.ArrayList(u8), - dbg_info_type_relocs: *File.DbgInfoTypeRelocsTable, + dbg_info_type_relocs: *DbgInfoTypeRelocsTable, nested_ref4_relocs: *std.ArrayList(u32), ) error{OutOfMemory}!void { const target = self.target; |
