Created
September 5, 2016 05:58
-
-
Save afeinberg/da6043c6a3f4adc18647f1f3593eb02d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctime> | |
#include <unistd.h> | |
namespace { | |
const double kTimePeriod = 0.1; | |
bool Crash() { | |
std::time_t start = std::time(nullptr); | |
usleep(50); | |
std::time_t now = std::time(nullptr); | |
if (std::difftime(start, now) >= kTimePeriod) { | |
return false; | |
} | |
} | |
} // anonymous namespace | |
int main(int /* unused: argc */, char** /* unused: argv */) { | |
Crash(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_ZN12_GLOBAL__N_15CrashEv: # @_ZN12_GLOBAL__N_15CrashEv | |
.cfi_startproc | |
# BB#0: | |
pushq %rbp | |
.Ltmp4: | |
.cfi_def_cfa_offset 16 | |
.Ltmp5: | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp | |
.Ltmp6: | |
.cfi_def_cfa_register %rbp | |
subq $32, %rsp | |
xorl %eax, %eax | |
movl %eax, %edi | |
callq time | |
movl $50, %edi | |
movq %rax, -8(%rbp) | |
callq usleep | |
xorl %edi, %edi | |
# kill: RDI<def> EDI<kill> | |
movl %eax, -20(%rbp) # 4-byte Spill | |
callq time | |
movq %rax, -16(%rbp) | |
movq -8(%rbp), %rdi | |
movq -16(%rbp), %rsi | |
callq difftime | |
movsd .LCPI1_0, %xmm1 | |
ucomisd %xmm1, %xmm0 | |
jb .LBB1_2 | |
# BB#1: | |
xorl %eax, %eax | |
movb %al, %cl | |
andb $1, %cl | |
movzbl %cl, %eax | |
addq $32, %rsp | |
popq %rbp | |
retq | |
.LBB1_2: | |
ud2 | |
.Ltmp7: | |
.size _ZN12_GLOBAL__N_15CrashEv, .Ltmp7-_ZN12_GLOBAL__N_15CrashEv | |
.cfi_endproc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment