.file "forkDemo.cpp" .local _ZStL8__ioinit .comm _ZStL8__ioinit,1,1 .section .rodata .align 8 .LC0: .string "I am the child process, fork returned: " .align 8 .LC1: .string "I am the parent. Fork returned " .LC2: .string " the child exited with " .text .globl main .type main, @function main: .LFB981: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 movq %rsp, %rbp .cfi_offset 6, -16 .cfi_def_cfa_register 6 pushq %rbx subq $24, %rsp .cfi_offset 3, -24 call fork movl %eax, -20(%rbp) cmpl $0, -20(%rbp) jne .L2 movl $.LC0, %esi movl $_ZSt4cout, %edi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movl -20(%rbp), %edx movl %edx, %esi movq %rax, %rdi call _ZNSolsEi movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi movq %rax, %rdi call _ZNSolsEPFRSoS_E movl $3, %eax jmp .L3 .L2: leaq -24(%rbp), %rax movq %rax, %rdi call wait movl -24(%rbp), %eax shrl $8, %eax andl $255, %eax movl %eax, -24(%rbp) movl -24(%rbp), %ebx movl $.LC1, %esi movl $_ZSt4cout, %edi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movl -20(%rbp), %edx movl %edx, %esi movq %rax, %rdi call _ZNSolsEi movl $.LC2, %esi movq %rax, %rdi call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc movl %ebx, %esi movq %rax, %rdi call _ZNSolsEi movl $_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_, %esi movq %rax, %rdi call _ZNSolsEPFRSoS_E movl $0, %eax .L3: addq $24, %rsp popq %rbx popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE981: .size main, .-main .type _Z41__static_initialization_and_destruction_0ii, @function _Z41__static_initialization_and_destruction_0ii: .LFB990: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 movq %rsp, %rbp .cfi_offset 6, -16 .cfi_def_cfa_register 6 subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) cmpl $1, -4(%rbp) jne .L4 cmpl $65535, -8(%rbp) jne .L4 movl $_ZStL8__ioinit, %edi call _ZNSt8ios_base4InitC1Ev movl $_ZNSt8ios_base4InitD1Ev, %eax movl $__dso_handle, %edx movl $_ZStL8__ioinit, %esi movq %rax, %rdi call __cxa_atexit .L4: leave .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE990: .size _Z41__static_initialization_and_destruction_0ii, .-_Z41__static_initialization_and_destruction_0ii .type _GLOBAL__I_main, @function _GLOBAL__I_main: .LFB991: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 movq %rsp, %rbp .cfi_offset 6, -16 .cfi_def_cfa_register 6 movl $65535, %esi movl $1, %edi call _Z41__static_initialization_and_destruction_0ii popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc .LFE991: .size _GLOBAL__I_main, .-_GLOBAL__I_main .section .ctors,"aw",@progbits .align 8 .quad _GLOBAL__I_main .weakref _ZL20__gthrw_pthread_onceP17__pthread_once_stPFvvE,__libc_thr_once .weakref _ZL27__gthrw_pthread_getspecifici,__libc_thr_getspecific .weakref _ZL27__gthrw_pthread_setspecificiPKv,__libc_thr_setspecific .weakref _ZL22__gthrw_pthread_createPP12__pthread_stPK17__pthread_attr_stPFPvS5_ES5_,pthread_create .weakref _ZL20__gthrw_pthread_joinP12__pthread_stPPv,pthread_join .weakref _ZL21__gthrw_pthread_equalP12__pthread_stS0_,__libc_thr_equal .weakref _ZL20__gthrw_pthread_selfv,__libc_thr_self .weakref _ZL22__gthrw_pthread_detachP12__pthread_st,pthread_detach .weakref _ZL22__gthrw_pthread_cancelP12__pthread_st,pthread_cancel .weakref _ZL19__gthrw_sched_yieldv,__libc_thr_yield .weakref _ZL26__gthrw_pthread_mutex_lockP18__pthread_mutex_st,__libc_mutex_lock .weakref _ZL29__gthrw_pthread_mutex_trylockP18__pthread_mutex_st,__libc_mutex_trylock .weakref _ZL28__gthrw_pthread_mutex_unlockP18__pthread_mutex_st,__libc_mutex_unlock .weakref _ZL26__gthrw_pthread_mutex_initP18__pthread_mutex_stPK22__pthread_mutexattr_st,__libc_mutex_init .weakref _ZL29__gthrw_pthread_mutex_destroyP18__pthread_mutex_st,__libc_mutex_destroy .weakref _ZL30__gthrw_pthread_cond_broadcastP17__pthread_cond_st,__libc_cond_broadcast .weakref _ZL27__gthrw_pthread_cond_signalP17__pthread_cond_st,__libc_cond_signal .weakref _ZL25__gthrw_pthread_cond_waitP17__pthread_cond_stP18__pthread_mutex_st,__libc_cond_wait .weakref _ZL30__gthrw_pthread_cond_timedwaitP17__pthread_cond_stP18__pthread_mutex_stPK8timespec,__libc_cond_timedwait .weakref _ZL28__gthrw_pthread_cond_destroyP17__pthread_cond_st,__libc_cond_destroy .weakref _ZL26__gthrw_pthread_key_createPiPFvPvE,__libc_thr_keycreate .weakref _ZL26__gthrw_pthread_key_deletei,__libc_thr_keydelete .weakref _ZL30__gthrw_pthread_mutexattr_initP22__pthread_mutexattr_st,__libc_mutexattr_init .weakref _ZL33__gthrw_pthread_mutexattr_settypeP22__pthread_mutexattr_sti,__libc_mutexattr_settype .weakref _ZL33__gthrw_pthread_mutexattr_destroyP22__pthread_mutexattr_st,__libc_mutexattr_destroy .ident "GCC: (NetBSD nb2 20110806) 4.5.3"