当前位置: 首页>>代码示例>>C++>>正文


C++ CRASH函数代码示例

本文整理汇总了C++中CRASH函数的典型用法代码示例。如果您正苦于以下问题:C++ CRASH函数的具体用法?C++ CRASH怎么用?C++ CRASH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CRASH函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dataLog

void VM::throwException(ExecState* exec, Exception* exception)
{
    if (Options::breakOnThrow()) {
        dataLog("In call frame ", RawPointer(exec), " for code block ", *exec->codeBlock(), "\n");
        CRASH();
    }

    ASSERT(exec == topCallFrame || exec == exec->lexicalGlobalObject()->globalExec() || exec == exec->vmEntryGlobalObject()->globalExec());

    interpreter->notifyDebuggerOfExceptionToBeThrown(exec, exception);

    setException(exception);
}
开发者ID:EdgarHz,项目名称:webkit,代码行数:13,代码来源:VM.cpp

示例2: getPlatformThreadRegisters

static size_t getPlatformThreadRegisters(const PlatformThread& platformThread, PlatformThreadRegisters& regs)
{
#if OS(DARWIN)

#if CPU(X86)
    unsigned user_count = sizeof(regs)/sizeof(int);
    thread_state_flavor_t flavor = i386_THREAD_STATE;
#elif CPU(X86_64)
    unsigned user_count = x86_THREAD_STATE64_COUNT;
    thread_state_flavor_t flavor = x86_THREAD_STATE64;
#elif CPU(PPC) 
    unsigned user_count = PPC_THREAD_STATE_COUNT;
    thread_state_flavor_t flavor = PPC_THREAD_STATE;
#elif CPU(PPC64)
    unsigned user_count = PPC_THREAD_STATE64_COUNT;
    thread_state_flavor_t flavor = PPC_THREAD_STATE64;
#elif CPU(ARM)
    unsigned user_count = ARM_THREAD_STATE_COUNT;
    thread_state_flavor_t flavor = ARM_THREAD_STATE;
#else
#error Unknown Architecture
#endif

    kern_return_t result = thread_get_state(platformThread, flavor, (thread_state_t)&regs, &user_count);
    if (result != KERN_SUCCESS) {
        WTFReportFatalError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, 
                            "JavaScript garbage collection failed because thread_get_state returned an error (%d). This is probably the result of running inside Rosetta, which is not supported.", result);
        CRASH();
    }
    return user_count * sizeof(usword_t);
// end OS(DARWIN)

#elif OS(WINDOWS)
    regs.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL | CONTEXT_SEGMENTS;
    GetThreadContext(platformThread, &regs);
    return sizeof(CONTEXT);
#elif USE(PTHREADS)
    pthread_attr_init(&regs);
#if HAVE(PTHREAD_NP_H) || OS(NETBSD)
    // e.g. on FreeBSD 5.4, [email protected]
    pthread_attr_get_np(platformThread, &regs);
#else
    // FIXME: this function is non-portable; other POSIX systems may have different np alternatives
    pthread_getattr_np(platformThread, &regs);
#endif
    return 0;
#else
#error Need a way to get thread registers on this platform
#endif
}
开发者ID:BGmot,项目名称:Qt,代码行数:50,代码来源:MachineStackMarker.cpp

示例3: makeLargeMallocFailSilently

void makeLargeMallocFailSilently()
{
    malloc_zone_t* zone = malloc_default_zone();

#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    mach_vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1));
    vm_prot_t initialProtection = protectionOfRegion(pageStart);

    vm_size_t len = reinterpret_cast<vm_address_t>(zone) - pageStart + sizeof(malloc_zone_t);
    if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection | VM_PROT_WRITE))
        CRASH();
#endif

    savedMalloc = zone->malloc;
    savedRealloc = zone->realloc;
    zone->malloc = checkedMalloc;
    zone->realloc = checkedRealloc;

#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection))
        CRASH();
#endif
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:23,代码来源:CheckedMalloc.cpp

示例4: avr_core_watch_read

uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr)
{
	if (addr > avr->ramend) {
		AVR_LOG(avr, LOG_ERROR, FONT_RED "CORE: *** Invalid read address PC=%04x SP=%04x O=%04x Address %04x out of ram (%04x)\n" FONT_DEFAULT,
				avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, avr->ramend);
		CRASH();
	}

	if (avr->gdb) {
		avr_gdb_handle_watchpoints(avr, addr, AVR_GDB_WATCH_READ);
	}

	return avr->data[addr];
}
开发者ID:justinbrewer,项目名称:simavr,代码行数:14,代码来源:sim_core.c

示例5: peek_token

token_t * peek_token(lexer_state * state, int offset)
{
  if (offset > TOKEN_BUFFER_SIZE)
    CRASH("offset > TOKEN_BUFFER_SIZE");

  if (offset <= 0)
    CRASH("offset <= 0");

  int ahead = state->ahead;
  token_list * b = state->token_buffer;

  for (int i = 0; i < offset; i++)
  {
    b = b->next;
    if (i >= ahead)
    {
      b->token = read_token(state);
      state->ahead++;
    }
  }

  return b->token;
}
开发者ID:nsillik,项目名称:dcpu16-asm-c,代码行数:23,代码来源:lexer.c

示例6: VirtualFree

void OSAllocator::decommit(void* address, size_t bytes)
{
    // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
    // bytes (i.e. dwSize) being 0 when dwFreeType is MEM_DECOMMIT means that we'll
    // decommit the entire region allocated by VirtualAlloc() instead of decommitting
    // nothing as we would expect. Hence, we should check if bytes is 0 and handle it
    // appropriately before calling VirtualFree().
    // See: https://bugs.webkit.org/show_bug.cgi?id=121972.
    if (!bytes)
        return;
    bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
    if (!result)
        CRASH();
}
开发者ID:604339917,项目名称:JavaScriptCore-iOS-1,代码行数:14,代码来源:OSAllocatorWin.cpp

示例7: makeLargeMallocFailSilently

void makeLargeMallocFailSilently()
{
    malloc_zone_t* zone = malloc_default_zone();

#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    mach_vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1));
    vm_prot_t initialProtection = protectionOfRegion(pageStart);

    vm_size_t len = reinterpret_cast<vm_address_t>(zone) - pageStart + sizeof(malloc_zone_t);
    if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection | VM_PROT_WRITE))
        CRASH();
#endif

    savedMalloc = zone->malloc;
    savedRealloc = zone->realloc;
    zone->malloc = checkedMalloc;
    zone->realloc = checkedRealloc;

#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection))
        CRASH();
#endif
}
开发者ID:0x4d52,项目名称:JavaScriptCore-X,代码行数:23,代码来源:CheckedMalloc.cpp

示例8: tileAt

void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context)
{
    // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
    if (m_skipsDraw || m_updateRect.isEmpty() || !m_tiler->numTiles())
        return;

    int left, top, right, bottom;
    m_tiler->contentRectToTileIndices(m_updateRect, left, top, right, bottom);
    for (int j = top; j <= bottom; ++j) {
        for (int i = left; i <= right; ++i) {
            UpdatableTile* tile = tileAt(i, j);
            if (!tile)
                tile = createTile(i, j);
            else if (!tile->dirty())
                continue;

            // Calculate page-space rectangle to copy from.
            IntRect sourceRect = m_tiler->tileContentRect(tile);
            const IntPoint anchor = sourceRect.location();
            sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect));
            // Paint rect not guaranteed to line up on tile boundaries, so
            // make sure that sourceRect doesn't extend outside of it.
            sourceRect.intersect(m_paintRect);
            if (sourceRect.isEmpty())
                continue;

            ASSERT(tile->texture()->isReserved());

            // Calculate tile-space rectangle to upload into.
            IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
            if (destRect.x() < 0)
                CRASH();
            if (destRect.y() < 0)
                CRASH();

            // Offset from paint rectangle to this tile's dirty rectangle.
            IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
            if (paintOffset.x() < 0)
                CRASH();
            if (paintOffset.y() < 0)
                CRASH();
            if (paintOffset.x() + destRect.width() > m_paintRect.width())
                CRASH();
            if (paintOffset.y() + destRect.height() > m_paintRect.height())
                CRASH();

            tile->texture()->bindTexture(context);
            const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST;
            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter));
            GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter));
            GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));

            textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect);
            tile->clearDirty();
        }
    }
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:57,代码来源:TiledLayerChromium.cpp

示例9: genericUnwind

void genericUnwind(VM* vm, ExecState* callFrame, UnwindStart unwindStart)
{
    if (Options::breakOnThrow()) {
        CodeBlock* codeBlock = callFrame->codeBlock();
        if (codeBlock)
            dataLog("In call frame ", RawPointer(callFrame), " for code block ", *codeBlock, "\n");
        else
            dataLog("In call frame ", RawPointer(callFrame), " with null CodeBlock\n");
        CRASH();
    }
    
    ExecState* shadowChickenTopFrame = callFrame;
    if (unwindStart == UnwindFromCallerFrame) {
        VMEntryFrame* topVMEntryFrame = vm->topVMEntryFrame;
        shadowChickenTopFrame = callFrame->callerFrame(topVMEntryFrame);
    }
    vm->shadowChicken().log(*vm, shadowChickenTopFrame, ShadowChicken::Packet::throwPacket());
    
    Exception* exception = vm->exception();
    RELEASE_ASSERT(exception);
    HandlerInfo* handler = vm->interpreter->unwind(*vm, callFrame, exception, unwindStart); // This may update callFrame.

    void* catchRoutine;
    Instruction* catchPCForInterpreter = 0;
    if (handler) {
        // handler->target is meaningless for getting a code offset when catching
        // the exception in a DFG/FTL frame. This bytecode target offset could be
        // something that's in an inlined frame, which means an array access
        // with this bytecode offset in the machine frame is utterly meaningless
        // and can cause an overflow. OSR exit properly exits to handler->target
        // in the proper frame.
        if (!JITCode::isOptimizingJIT(callFrame->codeBlock()->jitType()))
            catchPCForInterpreter = &callFrame->codeBlock()->instructions()[handler->target];
#if ENABLE(JIT)
        catchRoutine = handler->nativeCode.executableAddress();
#else
        catchRoutine = catchPCForInterpreter->u.pointer;
#endif
    } else
        catchRoutine = LLInt::getCodePtr(handleUncaughtException);
    
    ASSERT(bitwise_cast<uintptr_t>(callFrame) < bitwise_cast<uintptr_t>(vm->topVMEntryFrame));

    vm->callFrameForCatch = callFrame;
    vm->targetMachinePCForThrow = catchRoutine;
    vm->targetInterpreterPCForThrow = catchPCForInterpreter;
    
    RELEASE_ASSERT(catchRoutine);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:49,代码来源:JITExceptions.cpp

示例10: cryptographicallyRandomValuesFromOS

void cryptographicallyRandomValuesFromOS(unsigned char* buffer, size_t length)
{
#if OS(UNIX)
    int fd = open("/dev/urandom", O_RDONLY, 0);
    if (fd < 0)
        CRASH(); // We need /dev/urandom for this API to work...

    if (read(fd, buffer, length) != static_cast<ssize_t>(length))
        CRASH();

    close(fd);
#elif OS(WINDOWS)
    HCRYPTPROV hCryptProv = 0;
    if (!CryptAcquireContext(&hCryptProv, 0, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
        CRASH();
    if (!CryptGenRandom(hCryptProv, length, buffer))
        CRASH();
    CryptReleaseContext(hCryptProv, 0);
#else
    #error "This configuration doesn't have a strong source of randomness."
    // WARNING: When adding new sources of OS randomness, the randomness must
    //          be of cryptographic quality!
#endif
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:24,代码来源:OSRandomSource.cpp

示例11: SIGSYSHandler

static void SIGSYSHandler(int signal, siginfo_t* info, void* data)
{
    if (signal != SIGSYS || info->si_code != SYS_SECCOMP)
        CRASH();

    ucontext_t* ucontext = static_cast<ucontext_t*>(data);
    if (!ucontext)
        CRASH();

    SeccompBrokerClient* client = &SeccompBrokerClient::shared();

    if (client->handleIfOpeningOnlineCPUCount(&ucontext->uc_mcontext))
        return;

    // createFromContext might return a nullptr if it is able to resolve the
    // syscall locally without sending it to the broker process. In this case,
    // we just return. Examples of locally resolved syscalls are the ones
    // with cached resources and invalid arguments.
    std::unique_ptr<Syscall> syscall = Syscall::createFromContext(ucontext);
    if (!syscall)
        return;

    client->dispatch(syscall.get());
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:24,代码来源:SeccompBroker.cpp

示例12: CRASH

void HandleHeap::writeBarrier(HandleSlot slot, const JSValue& value)
{
    // Forbid assignment to handles during the finalization phase, since it would violate many GC invariants.
    // File a bug with stack trace if you hit this.
    if (m_nextToFinalize)
        CRASH();

    if (!value == !*slot && slot->isCell() == value.isCell())
        return;

    Node* node = toNode(slot);
#if ENABLE(GC_VALIDATION)
    if (!isLiveNode(node))
        CRASH();
#endif
    SentinelLinkedList<Node>::remove(node);
    if (!value || !value.isCell()) {
        m_immediateList.push(node);
        return;
    }

    if (node->isWeak()) {
        m_weakList.push(node);
#if ENABLE(GC_VALIDATION)
        if (!isLiveNode(node))
            CRASH();
#endif
        return;
    }

    m_strongList.push(node);
#if ENABLE(GC_VALIDATION)
    if (!isLiveNode(node))
        CRASH();
#endif
}
开发者ID:1833183060,项目名称:wke,代码行数:36,代码来源:HandleHeap.cpp

示例13: cmp

int cmp(const GF2m& a, const GF2m& b)
{
	// return 0 - equal; 1 - non equal

	if (a.BitLength > b.BitLength) CRASH("fields sizes are not equal");

	uint32* pn1 = a.n;
	uint32* pn2 = b.n;

	for (int32 i=a.GetInt32Length(); i >= 0; i--)
    {
        if (pn1[i] != pn2[i]) return 1;
    }
	return 0;
}
开发者ID:reefactor,项目名称:undergrad_crypto,代码行数:15,代码来源:XGaloisLib.cpp

示例14: switch

PassRef<StyleRuleBase> StyleRuleBase::copy() const
{
    switch (type()) {
    case Style:
        return static_cast<const StyleRule*>(this)->copy();
    case Page:
        return static_cast<const StyleRulePage*>(this)->copy();
    case FontFace:
        return static_cast<const StyleRuleFontFace*>(this)->copy();
    case Media:
        return static_cast<const StyleRuleMedia*>(this)->copy();
#if ENABLE(CSS3_CONDITIONAL_RULES)
    case Supports:
        return static_cast<const StyleRuleSupports*>(this)->copy();
#endif
#if ENABLE(CSS_REGIONS)
    case Region:
        return static_cast<const StyleRuleRegion*>(this)->copy();
#endif
    case Keyframes:
        return static_cast<const StyleRuleKeyframes*>(this)->copy();
#if ENABLE(SHADOW_DOM)
    case HostInternal:
        return static_cast<const StyleRuleHost*>(this)->copy();
#endif
#if ENABLE(CSS_DEVICE_ADAPTATION)
    case Viewport:
        return static_cast<const StyleRuleViewport*>(this)->copy();
#endif
#if ENABLE(CSS_SHADERS)
    case Filter:
        return static_cast<const StyleRuleFilter*>(this)->copy();
#endif
    case Import:
        // FIXME: Copy import rules.
        break;
    case Unknown:
    case Charset:
    case Keyframe:
#if !ENABLE(CSS_REGIONS)
    case Region:
#endif
        break;
    }
    CRASH();
    // HACK: EFL won't build without this (old GCC with crappy -Werror=return-type)
    return PassRef<StyleRuleBase>(*static_cast<StyleRuleBase*>(nullptr));
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:48,代码来源:StyleRule.cpp

示例15: ASSERT

void Heap::getConservativeRegisterRoots(HashSet<JSCell*>& roots)
{
    ASSERT(isValidThreadState(m_globalData));
    if (m_operationInProgress != NoOperation)
        CRASH();
    m_operationInProgress = Collection;
    ConservativeRoots registerFileRoots(&m_objectSpace.blocks());
    registerFile().gatherConservativeRoots(registerFileRoots);
    size_t registerFileRootCount = registerFileRoots.size();
    JSCell** registerRoots = registerFileRoots.roots();
    for (size_t i = 0; i < registerFileRootCount; i++) {
        setMarked(registerRoots[i]);
        roots.add(registerRoots[i]);
    }
    m_operationInProgress = NoOperation;
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:16,代码来源:Heap.cpp


注:本文中的CRASH函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。