Mac OS crash, details inside...
Gary Willoughby
dev at kalekold.net
Thu Jun 13 10:42:07 PDT 2013
I get a program crash each time running the following code on
MacOS 10.8 (Lion). It seems to run ok on Ubuntu 12.04:
import core.sys.posix.sys.stat;
import core.sys.posix.unistd;
import std.c.stdio;
import std.c.stdlib;
import std.process;
import std.stdio;
import std.string;
import std.file;
int main(string[] args)
{
pid_t pid, sid;
pid = fork();
if (pid < 0)
{
exit(EXIT_FAILURE);
}
if (pid > 0)
{
exit(EXIT_SUCCESS);
}
umask(0);
sid = setsid();
if (sid < 0)
{
exit(EXIT_FAILURE);
}
if ((core.sys.posix.unistd.chdir("/")) < 0)
{
exit(EXIT_FAILURE);
}
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
auto logFile = File("/home/gary/Desktop/test.log", "a");
logFile.writeln("Reading file");
string command = format("logger -t %s %s", "hello", "This is
a test");
executeShell(command);
logFile.writeln("Done");
return 0;
}
Crash log:
Process: main [1091]
Path: /private/tmp/*/main
Identifier: main
Version: 0
Code Type: X86-64 (Native)
Parent Process: ??? [1]
User ID: 501
Date/Time: 2013-06-13 18:34:59.413 +0100
OS Version: Mac OS X 10.8.4 (12E55)
Report Version: 10
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x000000010f70cb08
VM Regions Near 0x10f70cb08:
--> __TEXT 000000010f6ea000-000000010f7a9000 [
764K] r-x/rwx SM=COW /tmp/*
__DATA 000000010f7a9000-000000010f813000 [
424K] rw-/rwx SM=COW /tmp/*
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 main 0x000000010f795e94
D3std5stdio4File6detachMFZv + 32
1 main 0x000000010f795b91
D3std5stdio4File6__dtorMFZv + 13
2 main 0x000000010f796999
D3std5stdio4File7ByChunk11__fieldDtorMFZv + 13
3 main 0x000000010f6ec172
D3std7process133__T11executeImplS108_D3std7process9pipeShellFNfAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAyaZ11executeImplFAyaxHAyaAyaE3std7process6ConfigmZS3std7process133__T11executeImplS108_D3std7process9pipeShellFNfAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAyaZ11executeImplFAyaxHAyaAyaE3std7process6ConfigmZ13ProcessOutput
+ 466
4 main 0x000000010f78fd39
D3std7process12executeShellFNeAyaxHAyaAyaE3std7process6ConfigmZS3std7process133__T11executeImplS108_D3std7process9pipeShellFNfAyaE3std7process8RedirectxHAyaAyaE3std7process6ConfigZS3std7process12ProcessPipesTAyaZ11executeImplFAyaxHAyaAyaE3std7process6ConfigmZ13ProcessOutput
+ 49
5 main 0x000000010f6eb279 _Dmain +
317
6 main 0x000000010f76b759
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZi7runMainMFZv + 33
7 main 0x000000010f76b2a5
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZi7tryExecMFMDFZvZv + 45
8 main 0x000000010f76b7a5
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZi6runAllMFZv + 61
9 main 0x000000010f76b2a5
D2rt6dmain211_d_run_mainUiPPaPUAAaZiZi7tryExecMFMDFZvZv + 45
10 main 0x000000010f76b259
_d_run_main + 457
11 main 0x000000010f76b088 main + 20
12 libdyld.dylib 0x00007fff8d8147e1 start + 1
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x000000010f70cb00 rbx: 0x000000010f6ec166 rcx:
0x000000010f70cb08 rdx: 0x00007fa32b403bd0
rdi: 0x00007fff50515680 rsi: 0x0000000000000030 rbp:
0x00007fff50514d20 rsp: 0x00007fff50514d10
r8: 0x000000010f8110f0 r9: 0x000000010f8123e0 r10:
0x00000000000003b0 r11: 0x0000000000000206
r12: 0x00007fa32b4039a0 r13: 0x00007fa32b4039c0 r14:
0x0000000000000002 r15: 0x0000000000000001
rip: 0x000000010f795e94 rfl: 0x0000000000010206 cr2:
0x000000010f70cb08
Logical CPU: 1
Binary Images:
0x10f6ea000 - 0x10f7a8ff7 +main (0)
<E2E209E1-8709-3E23-9D99-C6001D1DB254> /tmp/*/main
0x7fff6f2ea000 - 0x7fff6f31e93f dyld (210.2.3)
<6900F2BA-DB48-3B78-B668-58FC0CF6BCB8> /usr/lib/dyld
0x7fff8c796000 - 0x7fff8c7bbff7 libc++abi.dylib (26)
<D86169F3-9F31-377A-9AF3-DB17142052E4> /usr/lib/libc++abi.dylib
0x7fff8c9a2000 - 0x7fff8c9a8ff7 libunwind.dylib (35.1)
<21703D36-2DAB-3D8B-8442-EAAB23C060D3>
/usr/lib/system/libunwind.dylib
0x7fff8cb46000 - 0x7fff8cb7cfff libsystem_info.dylib
(406.17) <4FFCA242-7F04-365F-87A6-D4EFB89503C1>
/usr/lib/system/libsystem_info.dylib
0x7fff8d812000 - 0x7fff8d815ff7 libdyld.dylib (210.2.3)
<F59367C9-C110-382B-A695-9035A6DD387E>
/usr/lib/system/libdyld.dylib
0x7fff8db35000 - 0x7fff8db3bfff libmacho.dylib (829)
<BF332AD9-E89F-387E-92A4-6E1AB74BD4D9>
/usr/lib/system/libmacho.dylib
0x7fff8dc48000 - 0x7fff8dc4dfff libcache.dylib (57)
<65187C6E-3FBF-3EB8-A1AA-389445E2984D>
/usr/lib/system/libcache.dylib
0x7fff8e2cd000 - 0x7fff8e2cfff7 libunc.dylib (25)
<92805328-CD36-34FF-9436-571AB0485072>
/usr/lib/system/libunc.dylib
0x7fff8ea69000 - 0x7fff8ea6afff libsystem_blocks.dylib
(59) <D92DCBC3-541C-37BD-AADE-ACC75A0C59C8>
/usr/lib/system/libsystem_blocks.dylib
0x7fff8ea6b000 - 0x7fff8ea6cff7 libdnsinfo.dylib
(453.19) <14202FFB-C3CA-3FCC-94B0-14611BF8692D>
/usr/lib/system/libdnsinfo.dylib
0x7fff8f414000 - 0x7fff8f41cff7 libsystem_dnssd.dylib
(379.38.1) <BDCB8566-0189-34C0-9634-35ABD3EFE25B>
/usr/lib/system/libsystem_dnssd.dylib
0x7fff906bb000 - 0x7fff906c3fff liblaunch.dylib
(442.26.2) <2F71CAF8-6524-329E-AC56-C506658B4C0C>
/usr/lib/system/liblaunch.dylib
0x7fff91088000 - 0x7fff91089fff
libDiagnosticMessagesClient.dylib (8)
<8548E0DC-0D2F-30B6-B045-FE8A038E76D8>
/usr/lib/libDiagnosticMessagesClient.dylib
0x7fff927a3000 - 0x7fff927efff7 libauto.dylib (185.4)
<AD5A4CE7-CB53-313C-9FAE-673303CC2D35> /usr/lib/libauto.dylib
0x7fff92a95000 - 0x7fff92a9afff libcompiler_rt.dylib
(30) <08F8731D-5961-39F1-AD00-4590321D24A9>
/usr/lib/system/libcompiler_rt.dylib
0x7fff93016000 - 0x7fff93024ff7 libsystem_network.dylib
(77.10) <0D99F24E-56FE-380F-B81B-4A4C630EE587>
/usr/lib/system/libsystem_network.dylib
0x7fff93588000 - 0x7fff9358afff libquarantine.dylib
(52.1) <143B726E-DF47-37A8-90AA-F059CFD1A2E4>
/usr/lib/system/libquarantine.dylib
0x7fff9362c000 - 0x7fff9364eff7 libxpc.dylib (140.43)
<70BC645B-6952-3264-930C-C835010CCEF9>
/usr/lib/system/libxpc.dylib
0x7fff939a0000 - 0x7fff939a1ff7 libSystem.B.dylib
(169.3) <FF25248A-574C-32DB-952F-B948C389B2A4>
/usr/lib/libSystem.B.dylib
0x7fff94e00000 - 0x7fff94f1892f libobjc.A.dylib (532.2)
<90D31928-F48D-3E37-874F-220A51FD9E37> /usr/lib/libobjc.A.dylib
0x7fff9523b000 - 0x7fff9523bfff libkeymgr.dylib (25)
<CC9E3394-BE16-397F-926B-E579B60EE429>
/usr/lib/system/libkeymgr.dylib
0x7fff957b5000 - 0x7fff957c3fff libcommonCrypto.dylib
(60027) <BAAFE0C9-BB86-3CA7-88C0-E3CBA98DA06F>
/usr/lib/system/libcommonCrypto.dylib
0x7fff957d2000 - 0x7fff957edff7 libsystem_kernel.dylib
(2050.24.15) <A9F97289-7985-31D6-AF89-151830684461>
/usr/lib/system/libsystem_kernel.dylib
0x7fff9595a000 - 0x7fff95a26ff7 libsystem_c.dylib
(825.26) <4C9EB006-FE1F-3F8F-8074-DFD94CF2CE7B>
/usr/lib/system/libsystem_c.dylib
0x7fff960e1000 - 0x7fff960e2ff7 libremovefile.dylib
(23.2) <6763BC8E-18B8-3AD9-8FFA-B43713A7264F>
/usr/lib/system/libremovefile.dylib
0x7fff969c7000 - 0x7fff969c8ff7 libsystem_sandbox.dylib
(220.3) <B739DA63-B675-387A-AD84-412A651143C0>
/usr/lib/system/libsystem_sandbox.dylib
0x7fff969c9000 - 0x7fff969f7ff7 libsystem_m.dylib
(3022.6) <B434BE5C-25AB-3EBD-BAA7-5304B34E3441>
/usr/lib/system/libsystem_m.dylib
0x7fff96f04000 - 0x7fff96f19ff7 libdispatch.dylib
(228.23) <D26996BF-FC57-39EB-8829-F63585561E09>
/usr/lib/system/libdispatch.dylib
0x7fff96f47000 - 0x7fff96f96ff7 libcorecrypto.dylib
(106.2) <CE0C29A3-C420-339B-ADAA-52F4683233CC>
/usr/lib/system/libcorecrypto.dylib
0x7fff9720a000 - 0x7fff97272ff7 libc++.1.dylib (65.1)
<20E31B90-19B9-3C2A-A9EB-474E08F9FE05> /usr/lib/libc++.1.dylib
0x7fff975e9000 - 0x7fff975f0fff libcopyfile.dylib (89)
<876573D0-E907-3566-A108-577EAD1B6182>
/usr/lib/system/libcopyfile.dylib
0x7fff975fd000 - 0x7fff97608fff libsystem_notify.dylib
(98.5) <C49275CC-835A-3207-AFBA-8C01374927B6>
/usr/lib/system/libsystem_notify.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 196
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=58.9M resident=90.5M(154%)
swapped_out_or_unallocated=16777216.0T(29874624397312%)
Writable regions: Total=18.4M written=44K(0%) resident=212K(1%)
swapped_out=0K(0%) unallocated=18.2M(99%)
REGION TYPE VIRTUAL
=========== =======
MALLOC 9396K
MALLOC guard page 16K
STACK GUARD 56.0M
Stack 8192K
VM_ALLOCATE 1024K
__DATA 1020K
__LINKEDIT 53.6M
__TEXT 5416K
shared memory 12K
=========== =======
TOTAL 134.1M
More information about the Digitalmars-d-learn
mailing list