Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › debug › Dwarf › LineNumberProgram Private Struct LineNumberProgram Doc Source Private Struct std.debug.Dwarf.LineNumberProgram
const LineNumberProgram = struct Fields address : u64 file : usize line : i64 column : u64 version : u16 is_stmt : bool basic_block : bool default_is_stmt : bool Functions File debug/Dwarf.zig: 1432
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478 const LineNumberProgram = struct {
address : u64 ,
file : usize ,
line : i64 ,
column : u64 ,
version : u16 ,
is_stmt : bool ,
basic_block : bool ,
default_is_stmt : bool ,
// Reset the state machine following the DWARF specification
pub fn reset (self : *LineNumberProgram ) void {
self .address = 0 ;
self .file = 1 ;
self .line = 1 ;
self .column = 0 ;
self .is_stmt = self .default_is_stmt ;
self .basic_block = false ;
}
pub fn init (is_stmt : bool , version : u16 ) LineNumberProgram {
return .{
.address = 0 ,
.file = 1 ,
.line = 1 ,
.column = 0 ,
.version = version ,
.is_stmt = is_stmt ,
.basic_block = false ,
.default_is_stmt = is_stmt ,
};
}
pub fn addRow (prog : *LineNumberProgram , gpa : Allocator , table : *CompileUnit .SrcLocCache .LineTable ) !void {
if (prog .line == 0 ) {
//if (debug_debug_mode) @panic("garbage line data");
return ;
}
if (debug_debug_mode ) assert (!table .contains (prog .address ));
try table .put (gpa , prog .address , .{
.line = cast (u32 , prog .line ) orelse maxInt (u32 ),
.column = cast (u32 , prog .column ) orelse maxInt (u32 ),
.file = cast (u32 , prog .file ) orelse return bad (),
});
}
}