diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:46:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-15 14:51:08 -0700 |
| commit | f3ebfcae3882c03da84821abed40167ea07a8c78 (patch) | |
| tree | f1b759c94cba5b020a9ffb141fc62cb686fc5f04 /lib/std/debug.zig | |
| parent | 111a2dcf3ad53c0c8ad2c9e7c9bd042b81e90c82 (diff) | |
| parent | 0395b35cee8d4082cc40b0dcd0298f797f42309d (diff) | |
| download | zig-f3ebfcae3882c03da84821abed40167ea07a8c78.tar.gz zig-f3ebfcae3882c03da84821abed40167ea07a8c78.zip | |
Merge remote-tracking branch 'origin/master' into llvm13
Conflicts:
* cmake/Findclang.cmake
* cmake/Findlld.cmake
* cmake/Findllvm.cmake
In master branch, more search paths were added to these files with "12"
in the path. In this commit I updated them to "13".
* src/stage1/codegen.cpp
* src/zig_llvm.cpp
* src/zig_llvm.h
In master branch, ZigLLVMBuildCmpXchg is improved to add
`is_single_threaded`. However, the LLVM 13 C API has this already, and
in the llvm13 branch, ZigLLVMBuildCmpXchg is deleted in favor of the C
API. In this commit I updated stage2 to use the LLVM 13 C API rather
than depending on an improved ZigLLVMBuildCmpXchg.
Additionally, src/target.zig largestAtomicBits needed to be updated to
include the new m68k ISA.
Diffstat (limited to 'lib/std/debug.zig')
| -rw-r--r-- | lib/std/debug.zig | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 4b715f2b14..8517703566 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -948,8 +948,8 @@ fn mapWholeFile(file: File) ![]align(mem.page_size) const u8 { const mapped_mem = try os.mmap( null, file_len, - os.PROT_READ, - os.MAP_SHARED, + os.PROT.READ, + os.MAP.SHARED, file.handle, 0, ); @@ -1341,7 +1341,7 @@ pub const ModuleDebugInfo = switch (native_os) { if (o_file_di.findCompileUnit(relocated_address_o)) |compile_unit| { return SymbolInfo{ .symbol_name = o_file_di.getSymbolName(relocated_address_o) orelse "???", - .compile_unit_name = compile_unit.die.getAttrString(&o_file_di, DW.AT_name) catch |err| switch (err) { + .compile_unit_name = compile_unit.die.getAttrString(&o_file_di, DW.AT.name) catch |err| switch (err) { error.MissingDebugInfo, error.InvalidDebugInfo => "???", else => return err, }, @@ -1438,7 +1438,7 @@ fn getSymbolFromDwarf(address: u64, di: *DW.DwarfInfo) !SymbolInfo { if (nosuspend di.findCompileUnit(address)) |compile_unit| { return SymbolInfo{ .symbol_name = nosuspend di.getSymbolName(address) orelse "???", - .compile_unit_name = compile_unit.die.getAttrString(di, DW.AT_name) catch |err| switch (err) { + .compile_unit_name = compile_unit.die.getAttrString(di, DW.AT.name) catch |err| switch (err) { error.MissingDebugInfo, error.InvalidDebugInfo => "???", else => return err, }, @@ -1470,7 +1470,7 @@ fn getDebugInfoAllocator() *mem.Allocator { pub const have_segfault_handling_support = switch (native_os) { .linux, .netbsd => true, .windows => true, - .freebsd, .openbsd => @hasDecl(os, "ucontext_t"), + .freebsd, .openbsd => @hasDecl(os.system, "ucontext_t"), else => false, }; pub const enable_segfault_handler: bool = if (@hasDecl(root, "enable_segfault_handler")) @@ -1498,12 +1498,12 @@ pub fn attachSegfaultHandler() void { var act = os.Sigaction{ .handler = .{ .sigaction = handleSegfaultLinux }, .mask = os.empty_sigset, - .flags = (os.SA_SIGINFO | os.SA_RESTART | os.SA_RESETHAND), + .flags = (os.SA.SIGINFO | os.SA.RESTART | os.SA.RESETHAND), }; - os.sigaction(os.SIGSEGV, &act, null); - os.sigaction(os.SIGILL, &act, null); - os.sigaction(os.SIGBUS, &act, null); + os.sigaction(os.SIG.SEGV, &act, null); + os.sigaction(os.SIG.ILL, &act, null); + os.sigaction(os.SIG.BUS, &act, null); } fn resetSegfaultHandler() void { @@ -1515,13 +1515,13 @@ fn resetSegfaultHandler() void { return; } var act = os.Sigaction{ - .handler = .{ .sigaction = os.SIG_DFL }, + .handler = .{ .sigaction = os.SIG.DFL }, .mask = os.empty_sigset, .flags = 0, }; - os.sigaction(os.SIGSEGV, &act, null); - os.sigaction(os.SIGILL, &act, null); - os.sigaction(os.SIGBUS, &act, null); + os.sigaction(os.SIG.SEGV, &act, null); + os.sigaction(os.SIG.ILL, &act, null); + os.sigaction(os.SIG.BUS, &act, null); } fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_void) callconv(.C) noreturn { @@ -1542,9 +1542,9 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v nosuspend { const stderr = io.getStdErr().writer(); _ = switch (sig) { - os.SIGSEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}), - os.SIGILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}), - os.SIGBUS => stderr.print("Bus error at address 0x{x}\n", .{addr}), + os.SIG.SEGV => stderr.print("Segmentation fault at address 0x{x}\n", .{addr}), + os.SIG.ILL => stderr.print("Illegal instruction at address 0x{x}\n", .{addr}), + os.SIG.BUS => stderr.print("Bus error at address 0x{x}\n", .{addr}), else => unreachable, } catch os.abort(); } @@ -1552,20 +1552,20 @@ fn handleSegfaultLinux(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const c_v switch (native_arch) { .i386 => { const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); - const ip = @intCast(usize, ctx.mcontext.gregs[os.REG_EIP]); - const bp = @intCast(usize, ctx.mcontext.gregs[os.REG_EBP]); + const ip = @intCast(usize, ctx.mcontext.gregs[os.REG.EIP]); + const bp = @intCast(usize, ctx.mcontext.gregs[os.REG.EBP]); dumpStackTraceFromBase(bp, ip); }, .x86_64 => { const ctx = @ptrCast(*const os.ucontext_t, @alignCast(@alignOf(os.ucontext_t), ctx_ptr)); const ip = switch (native_os) { - .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RIP]), + .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.RIP]), .freebsd => @intCast(usize, ctx.mcontext.rip), .openbsd => @intCast(usize, ctx.sc_rip), else => unreachable, }; const bp = switch (native_os) { - .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG_RBP]), + .linux, .netbsd => @intCast(usize, ctx.mcontext.gregs[os.REG.RBP]), .openbsd => @intCast(usize, ctx.sc_rbp), .freebsd => @intCast(usize, ctx.mcontext.rbp), else => unreachable, |
