diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-25 04:50:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-25 04:50:51 -0400 |
| commit | 4003cd4747019d79ff50aaa22415d2d3dfc15cf4 (patch) | |
| tree | 1f77690a5fb7ccbef75bcab9c8c1e008ef3c5068 /std/c | |
| parent | bf1f91595d4d3b5911632c671ef16e44d70dc9a6 (diff) | |
| parent | 815950996dcc92ac6ac285f2005dbac51b9cb6f8 (diff) | |
| download | zig-4003cd4747019d79ff50aaa22415d2d3dfc15cf4.tar.gz zig-4003cd4747019d79ff50aaa22415d2d3dfc15cf4.zip | |
Merge pull request #1406 from ziglang/macos-stack-traces
MacOS stack traces
closes #1365
Diffstat (limited to 'std/c')
| -rw-r--r-- | std/c/darwin.zig | 12 | ||||
| -rw-r--r-- | std/c/linux.zig | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/std/c/darwin.zig b/std/c/darwin.zig index 437b081cac..2e238e40eb 100644 --- a/std/c/darwin.zig +++ b/std/c/darwin.zig @@ -1,5 +1,8 @@ +const macho = @import("../macho.zig"); + extern "c" fn __error() *c_int; pub extern "c" fn _NSGetExecutablePath(buf: [*]u8, bufsize: *u32) c_int; +pub extern "c" fn _dyld_get_image_header(image_index: u32) ?*mach_header; pub extern "c" fn __getdirentries64(fd: c_int, buf_ptr: [*]u8, buf_len: usize, basep: *i64) usize; @@ -33,6 +36,15 @@ pub extern "c" fn sysctlnametomib(name: [*]const u8, mibp: ?*c_int, sizep: ?*usi pub extern "c" fn bind(socket: c_int, address: ?*const sockaddr, address_len: socklen_t) c_int; pub extern "c" fn socket(domain: c_int, type: c_int, protocol: c_int) c_int; +/// The value of the link editor defined symbol _MH_EXECUTE_SYM is the address +/// of the mach header in a Mach-O executable file type. It does not appear in +/// any file type other than a MH_EXECUTE file type. The type of the symbol is +/// absolute as the header is not part of any section. +pub extern "c" var _mh_execute_header: if (@sizeOf(usize) == 8) mach_header_64 else mach_header; + +pub const mach_header_64 = macho.mach_header_64; +pub const mach_header = macho.mach_header; + pub use @import("../os/darwin/errno.zig"); pub const _errno = __error; diff --git a/std/c/linux.zig b/std/c/linux.zig index 2699e9bd09..b0dadf071d 100644 --- a/std/c/linux.zig +++ b/std/c/linux.zig @@ -8,3 +8,6 @@ pub const pthread_attr_t = extern struct { __size: [56]u8, __align: c_long, }; + +/// See std.elf for constants for this +pub extern fn getauxval(__type: c_ulong) c_ulong; |
