std.debug.Info: extract to separate file

This commit is contained in:
Andrew Kelley 2024-08-01 14:18:16 -07:00
parent 2e26cf83cf
commit 1ba6b56c81
4 changed files with 1390 additions and 1376 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1353,7 +1353,7 @@ pub fn getLineNumberInfo(
allocator: Allocator,
compile_unit: CompileUnit,
target_address: u64,
) !std.debug.LineInfo {
) !std.debug.Info.SourceLocation {
const compile_unit_cwd = try compile_unit.die.getAttrString(di, AT.comp_dir, di.section(.debug_line_str), compile_unit);
const line_info_offset = try compile_unit.die.getAttrSecOffset(AT.stmt_list);
@ -2084,7 +2084,7 @@ const LineNumberProgram = struct {
self: *LineNumberProgram,
allocator: Allocator,
file_entries: []const FileEntry,
) !?std.debug.LineInfo {
) !?std.debug.Info.SourceLocation {
if (self.prev_valid and
self.target_address >= self.prev_address and
self.target_address < self.address)
@ -2104,7 +2104,7 @@ const LineNumberProgram = struct {
dir_name, file_entry.path,
});
return std.debug.LineInfo{
return std.debug.Info.SourceLocation{
.line = if (self.prev_line >= 0) @as(u64, @intCast(self.prev_line)) else 0,
.column = self.prev_column,
.file_name = file_name,

1377
lib/std/debug/Info.zig Normal file

File diff suppressed because it is too large Load Diff

View File

@ -706,7 +706,7 @@ pub const Pdb = struct {
return null;
}
pub fn getLineNumberInfo(self: *Pdb, module: *Module, address: u64) !debug.LineInfo {
pub fn getLineNumberInfo(self: *Pdb, module: *Module, address: u64) !debug.Info.SourceLocation {
std.debug.assert(module.populated);
const subsect_info = module.subsect_info;
@ -731,7 +731,7 @@ pub const Pdb = struct {
if (address >= frag_vaddr_start and address < frag_vaddr_end) {
// There is an unknown number of LineBlockFragmentHeaders (and their accompanying line and column records)
// from now on. We will iterate through them, and eventually find a LineInfo that we're interested in,
// from now on. We will iterate through them, and eventually find a SourceLocation that we're interested in,
// breaking out to :subsections. If not, we will make sure to not read anything outside of this subsection.
const subsection_end_index = sect_offset + subsect_hdr.Length;
@ -778,7 +778,7 @@ pub const Pdb = struct {
const line_num_entry: *align(1) LineNumberEntry = @ptrCast(&subsect_info[found_line_index]);
const flags: *align(1) LineNumberEntry.Flags = @ptrCast(&line_num_entry.Flags);
return debug.LineInfo{
return debug.Info.SourceLocation{
.file_name = source_file_name,
.line = flags.Start,
.column = column,