當前位置: 首頁>>代碼示例>>C++>>正文


C++ DebugBreak函數代碼示例

本文整理匯總了C++中DebugBreak函數的典型用法代碼示例。如果您正苦於以下問題:C++ DebugBreak函數的具體用法?C++ DebugBreak怎麽用?C++ DebugBreak使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了DebugBreak函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CompilePixelShader

bool CompilePixelShader(const char * code, LPDIRECT3DPIXELSHADER9 * pShader, LPD3DXCONSTANTTABLE * pShaderTable) {
	LPD3DXCONSTANTTABLE shaderTable = *pShaderTable;

	ID3DXBuffer* pShaderCode = NULL;
	ID3DXBuffer* pErrorMsg = NULL;

	HRESULT hr = -1;

#ifdef _XBOX
	// Compile pixel shader.
	hr = D3DXCompileShader( code, 
		(UINT)strlen( code ),
		NULL, 
		NULL, 
		"main", 
		"ps_3_0", 
		0, 
		&pShaderCode, 
		&pErrorMsg,
		pShaderTable );
#endif
	if( FAILED(hr) )
	{
		OutputDebugStringA((CHAR*)pErrorMsg->GetBufferPointer());
		DebugBreak();
		return false;
	}

	// Create pixel shader.
	pD3Ddevice->CreatePixelShader( (DWORD*)pShaderCode->GetBufferPointer(), 
		pShader );

	pShaderCode->Release();

	return true;
}
開發者ID:18859966862,項目名稱:ppsspp,代碼行數:36,代碼來源:global.cpp

示例2: DbgFree

/****************************************************************************
 *                                                                          *
 *  FUNCTION   : DbgFree()                                                  *
 *                                                                          *
 *  PURPOSE    : To free an object allocated with DbgAlloc().  Checks the   *
 *               object array to make sure an object isn't freed twice.     *
 *                                                                          *
 *  RETURNS    :                                                            *
 *                                                                          *
 ****************************************************************************/
PSTR DbgFree(
register PSTR p)
{
    register WORD i;

    if (p == NULL) 
        return p;
        
    for (i = 0; i < cptrs; i++) {
        if (aptrs[i] == p) {
            aptrs[i] = aptrs[cptrs - 1];
            break;
        }
    }
    if (i == cptrs) {
        OutputDebugString("Free on non-allocated object");
        DebugBreak();
    } else {
        LocalUnlock((HANDLE)p);
        p = (PSTR)LocalFree((HANDLE)p);
    }
    cptrs--;
    return p;
}
開發者ID:chunhualiu,項目名稱:OpenNT,代碼行數:34,代碼來源:mem.c

示例3: AssertFail

/***********************************************************************
 *              AssertFail  ([email protected])
 *
 * Shows an assert fail error messagebox
 *
 * PARAMS
 *   lpFile [I]         file where assert failed
 *   uLine [I]          line number in file
 *   lpMessage [I]      assert message
 *
 */
VOID WINAPI AssertFail(LPSTR lpFile, UINT uLine, LPSTR lpMessage)
{
    CHAR szModule[MAX_PATH];
    CHAR szBuffer[2048];
    LPSTR lpName;
//    LPSTR lpBuffer;

    TRACE("%s %u %s\n", lpFile, uLine, lpMessage);

    GetModuleFileNameA(hInstance, szModule, MAX_PATH);
    lpName = strrchr(szModule, '\\');
    if (lpName != NULL)
        lpName++;
    else
        lpName = szModule;

    wsprintfA(szBuffer,
              "Assertion failure at line %u in file %s: %s\n\nCall DebugBreak()?",
              uLine, lpFile, lpMessage);

    if (MessageBoxA(NULL, szBuffer, lpName, MB_SETFOREGROUND |
                    MB_TASKMODAL | MB_ICONERROR | MB_YESNO) == IDYES)
        DebugBreak();
}
開發者ID:RareHare,項目名稱:reactos,代碼行數:35,代碼來源:misc.c

示例4: if

Bitmap * ImageItem::LoadImageFromFile(ATL::CString& strFilename, int nWidth, int nHeight)
{
	if ( !m_strFilename.CompareNoCase(strFilename) && nHeight==m_nHeight )
	{
		m_nRef++;
		return m_pBitmap;
	}
	else if ( m_pBitmap==NULL && m_nRef==0)
	{
		Size ImageSize(nWidth, nHeight);
		if (GetBitmapFromFile(m_pBitmap, strFilename, m_nFrameCount, m_FrameSize, ImageSize, m_pFrameDelays ))
		{
			m_nHeight = nHeight;
			m_nRef++;
			m_strFilename=strFilename;
			return m_pBitmap;
		}
		return NULL;

	}
	//NOT REACHABLE
	DebugBreak();
	return NULL;
}
開發者ID:hgl888,項目名稱:TeamTalk,代碼行數:24,代碼來源:GifSmileyCtrl.cpp

示例5: AddItemToGroup

static int AddItemToGroup(struct ClcGroup *group,int iAboveItem)
{
	if (group==NULL) return 0;

	if(++group->contactCount>group->allocedCount) {
		group->allocedCount+=GROUP_ALLOCATE_STEP;
      //  if (group->contact) mir_free(group->contact);
		if(group->contact)	
		group->contact=(struct ClcContact*)mir_realloc(group->contact,sizeof(struct ClcContact)*group->allocedCount);
			else 
			group->contact=(struct ClcContact*)mir_alloc(sizeof(struct ClcContact)*group->allocedCount);
			
		if (group->contact==NULL||IsBadCodePtr((FARPROC)group->contact))
		{
			TRACE("!!!Bad Realloc AddItemToGroup");
			DebugBreak();
		}
	}
	memmove(group->contact+iAboveItem+1,group->contact+iAboveItem,sizeof(struct ClcContact)*(group->contactCount-iAboveItem-1));
    memset(&(group->contact[iAboveItem]),0,sizeof((group->contact[iAboveItem])));
	group->contact[iAboveItem].type=CLCIT_DIVIDER;
	//group->contact[iAboveItem].flags=0;
	memset(group->contact[iAboveItem].iExtraImage,0xFF,sizeof(group->contact[iAboveItem].iExtraImage));
  group->contact[iAboveItem].szText=NULL;
  group->contact[iAboveItem].szSecondLineText=NULL;
  group->contact[iAboveItem].szThirdLineText=NULL;
	//group->contact[iAboveItem].szText[0]='\0';
	//group->contact[iAboveItem].szSecondLineText[0]='\0';
	//group->contact[iAboveItem].szThirdLineText[0]='\0';
	//group->contact[iAboveItem].SubAllocated=0;
	//group->contact[iAboveItem].subcontacts=NULL;
	//group->contact[iAboveItem].SubExpanded=0;
	
	ClearRowByIndexCache();
	return iAboveItem;
}
開發者ID:BackupTheBerlios,項目名稱:modernb-svn,代碼行數:36,代碼來源:clcitems.c

示例6: DebugBreak

void CDBStepNC::ExecuteSql(CString tszSQL)
{
    HRESULT hr;
    try {

        CCommand<CDynamicAccessor, CRowset> commandInsert;
        //TCHAR tszSQL[] = _bstr_t(SQLCommandString);
        //hr = m_session.StartTransaction();
        if(FAILED(hr = commandInsert.Open(m_session,
                                          (LPCTSTR) tszSQL,
                                          NULL ,
                                          NULL,
                                          DBGUID_DBSQL,
                                          false)))
            DebugBreak();
        //if(FAILED(hr = m_session.Commit()))
        //	DebugBreak();


        //DatabaseConnection->BeginTrans();
//		SQLCommand->ActiveConnection = DatabaseConnection;
//		SQLCommand->CommandText = _bstr_t(SQLCommandString);
// 		SQLCommand->Execute(NULL, NULL, adCmdText);
    }
    catch(_com_error& e)
    {
        ATLTRACE("com error: %d - %s\n", e.Error(), (const char*)e.Description());
        Close();
        //DatabaseConnection->RollbackTrans();

    }
    //	DatabaseConnection->Commit();

    OutputDebugString("ExecuteSql Succeeded\n");

}
開發者ID:usnistgov,項目名稱:QIF,代碼行數:36,代碼來源:DBStepNC.cpp

示例7: DebugBreak

void CIocpServer::OnCompletionTrue( DWORD transfersize, ULONG_PTR key, CIocpIoData* iodata )
{
	CIocpSocket* client = m_Clients[key];
	if( client == 0 ) 
	{
		DebugBreak( );
		return;
	}
	if( transfersize > 0 )
	{
		iodata->bufferlen += transfersize;
		if( iodata->mode == IOMODE_RECV )
		{
			if( iodata->bufferlen == iodata->buffersize )
				client->RecvComplete( iodata );
			else
				client->RecvContinue( iodata );
		} else {
			if( iodata->bufferlen == iodata->buffersize )
				client->SendComplete( iodata );
			else
				client->SendContinue( iodata );
		}
	} else {
		client->CloseSocket( );
		g_IoDataPool.Release( iodata );

		client->m_Lock.Enter( );
		if( iodata->mode == IOMODE_RECV )
			client->m_RRefCount--;
		else
			client->m_SRefCount--;
		client->m_RefCount--;
		client->m_Lock.Leave( );
	}
};
開發者ID:brett19,項目名稱:cROSE,代碼行數:36,代碼來源:CIocpServer.cpp

示例8: library_fatal_error

/*
 * library_fatal_error - Handle fatal errors from our libraries.
 */
static void
library_fatal_error(
	const char *file,
	int line,
	const char *format,
	va_list args
	)
{
	char errbuf[256];

	isc_error_setfatal(NULL);  /* Avoid recursion */

	msyslog(LOG_ERR, "%s:%d: fatal error:", file, line);
	vsnprintf(errbuf, sizeof(errbuf), format, args);
	msyslog(LOG_ERR, "%s", errbuf);
	msyslog(LOG_ERR, "exiting (due to fatal error in library)");

#if defined(DEBUG) && defined(SYS_WINNT)
	if (debug)
		DebugBreak();
#endif

	abort();
}
開發者ID:kernel9709,項目名稱:gsoc-ntp-2013,代碼行數:27,代碼來源:ntpd.c

示例9: DbgAssert

void WINAPI DbgAssert(LPCTSTR pCondition,LPCTSTR pFileName,INT iLine)
{
    if(g_fUseKASSERT)
    {
        DbgKernelAssert(pCondition, pFileName, iLine);
    }
    else
    {

        TCHAR szInfo[iDEBUGINFO];

        (void)StringCchPrintf(szInfo, NUMELMS(szInfo),TEXT("%s \nAt line %d of %s\nContinue? (Cancel to debug)"),
                 pCondition, iLine, pFileName);

        INT MsgId = MessageBoxOtherThread(NULL,szInfo,TEXT("ASSERT Failed"),
                                          MB_SYSTEMMODAL |
                                          MB_ICONHAND |
                                          MB_YESNOCANCEL |
                                          MB_SETFOREGROUND);
        switch (MsgId)
        {
          case IDNO:              /* Kill the application */

              FatalAppExit(FALSE, TEXT("Application terminated"));
              break;

          case IDCANCEL:          /* Break into the debugger */

              DebugBreak();
              break;

          case IDYES:             /* Ignore assertion continue execution */
              break;
        }
    }
}
開發者ID:DieBagger,項目名稱:MediaPortal-1,代碼行數:36,代碼來源:wxdebug.cpp

示例10: InitLog

NS_IMETHODIMP 
nsDebugImpl::Abort(const char *aFile, PRInt32 aLine)
{
  InitLog();

   PR_LOG(gDebugLog, PR_LOG_ERROR, 
         ("###!!! Abort: at file %s, line %d", aFile, aLine));
   PR_LogFlush();
   fprintf(stderr, "\07 Abort\n");  fflush(stderr);
   fflush(stderr);

#if defined(_WIN32)
#ifdef _M_IX86
  long* __p = (long*) 0x7;
  *__p = 0x7;
#else /* _M_ALPHA */
  PR_Abort();
#endif
#elif defined(XP_MAC)
  ExitToShell();
#elif defined(XP_UNIX)
  PR_Abort();
#elif defined(XP_OS2)
  DebugBreak();
  return NS_OK;
#elif defined(XP_BEOS)
  {
#ifndef DEBUG_cls
	char buf[2000];
	sprintf(buf, "Abort: at file %s, line %d", aFile, aLine);
	DEBUGGER(buf);
#endif
  } 
#endif
  return NS_OK;
}
開發者ID:bringhurst,項目名稱:vbox,代碼行數:36,代碼來源:nsDebugImpl.cpp

示例11: NT

/* Startup code for running on NT.  When we are running as the dumped
   version, we need to bootstrap our heap and .bss section into our
   address space before we can actually hand off control to the startup
   code supplied by NT (primarily because that code relies upon malloc ()).  */
void
_start (void)
{
  extern void mainCRTStartup (void);

#if 1
  /* Give us a way to debug problems with crashes on startup when
     running under the MSVC profiler. */
  if (GetEnvironmentVariable ("EMACS_DEBUG", NULL, 0) > 0)
    DebugBreak ();
#endif

  /* Cache system info, e.g., the NT page size.  */
  cache_system_info ();

  /* Grab our malloc arena space now, before CRT starts up. */
  init_heap ();

  /* This prevents ctrl-c's in shells running while we're suspended from
     having us exit.  */
  SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE);

  /* Prevent Emacs from being locked up (eg. in batch mode) when
     accessing devices that aren't mounted (eg. removable media drives).  */
  SetErrorMode (SEM_FAILCRITICALERRORS);

  /* Invoke the NT CRT startup routine now that our housecleaning
     is finished.  */
#ifdef HAVE_NTGUI
  /* determine WinMain args like crt0.c does */
  hinst = GetModuleHandle(NULL);
  lpCmdLine = GetCommandLine();
  nCmdShow = SW_SHOWDEFAULT;
#endif
  mainCRTStartup ();
}
開發者ID:aosm,項目名稱:emacs,代碼行數:40,代碼來源:unexw32.c

示例12: DacGetTargetAddrForHostInteriorAddr


//.........這裏部分代碼省略.........
            // DAC_INSTANCE_ALIGN aligned addresses.
            DAC_INSTANCE * inst = (DAC_INSTANCE*)(((ULONG_PTR)ptr - sizeof(DAC_INSTANCE)) & ~(DAC_INSTANCE_ALIGN - 1));

            // When code is DAC'ized correctly then our search algorithm is guaranteed to terminate safely
            // before reading memory that doesn't belong to the containing DAC instance. Since people do make
            // mistakes we want to limit how long and far we search however. The counter below will let us
            // assert if we've likely tried to locate an interior host pointer in a non-marshalled structure.
            DWORD cIterations = 0;

            bool tryAgain = false;

            // Scan backwards in memory looking for a DAC_INSTANCE header.
            while (true)
            {
                // Step back DAC_INSTANCE_ALIGN bytes at a time (the initialization of inst above guarantees
                // we start with an aligned pointer value. Stop every time our potential DAC_INSTANCE header
                // has a correct signature value.
                while (tryAgain || inst->sig != DAC_INSTANCE_SIG)
                {
                    tryAgain = false;
                    inst = (DAC_INSTANCE*)((BYTE*)inst - DAC_INSTANCE_ALIGN);

                    // If we've searched a lot of memory (currently 100 * 16 == 1600 bytes) without success,
                    // then assume this is due to an issue DAC-izing code (if you really do have a field within a
                    // DAC marshalled structure whose offset is >1600 bytes then feel free to update the
                    // constant at the start of this method).
                    if (++cIterations > kMaxSearchIterations)
                    {
                        status = E_INVALIDARG;
                        break;
                    }
                }

                // Fall through to a DAC error if we searched too long without finding a header candidate.
                if (status == E_INVALIDARG)
                    break;

                // Validate our candidate header by looking up the target address it claims to map in the
                // instance hash. The entry should both exist and correspond exactly to our candidate instance
                // pointer.
                // TODO: but what if the same memory was marshalled more than once (eg. once as a DPTR, once as a VPTR)?
                if (inst == g_dacImpl->m_instances.Find(inst->addr))
                {
                    // We've found a valid DAC instance. Now validate that the marshalled structure it
                    // represents really does enclose the pointer we're asking about. If not, someone hasn't
                    // marshalled a containing structure before trying to map a pointer within that structure
                    // (we've just gone and found the previous, unrelated marshalled structure in host memory).
                    BYTE * parent = (BYTE*)(inst + 1);
                    if (((BYTE*)ptr + sizeof(LPCVOID)) <= (parent + inst->size))
                    {
                        // Everything checks out: we've found a DAC instance header and its address range
                        // encompasses the pointer we're interested in. Compute the corresponding target
                        // address by taking into account the offset of the interior pointer into its
                        // enclosing structure.
                        addr = inst->addr + ((BYTE*)ptr - parent);
                        status = S_OK;
                    }
                    else
                    {
                        // We found a valid DAC instance but it doesn't cover the address range containing our
                        // input pointer. Fall though to report an erroring DAC-izing code.
                        status = E_INVALIDARG;
                    }
                    break;
                }
                else
                {
                    // This must not really be a match, perhaps a coincidence?
                    // Keep searching
                    tryAgain = true;
                }
            }
        }
        EX_CATCH
        {
            status = E_INVALIDARG;
        }
        EX_END_CATCH(SwallowAllExceptions)

        if (status != S_OK)
        {
            if (g_dacImpl && g_dacImpl->m_debugMode)
            {
                DebugBreak();
            }

            if (throwEx)
            {
                // This means a pointer was supplied which doesn't actually point to somewhere in a marshalled
                // DAC instance.
                _ASSERTE_MSG(false, "DAC coding error: Attempt to get target address from a host interior "
                                    "pointer which is not an instance marshalled by DAC!");
                DacError(status);
            }
        }

        return addr;
    }
#endif // !_PREFIX_
}
開發者ID:krk,項目名稱:coreclr,代碼行數:101,代碼來源:dacfn.cpp

示例13: DacGetTargetAddrForHostAddr

TADDR
DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx)
{
#ifdef _PREFIX_

    // Dac accesses are not interesting for PREfix and cause alot of PREfix noise
    // so we just return the unmodified pointer for our PREFIX builds
    return (TADDR) ptr;

#else // !_PREFIX_

    // Preserve special pointer values.
    if (ptr == NULL || ((TADDR) ptr == (TADDR)-1))
    {
        return 0;
    }
    else
    {
        TADDR addr = 0;
        HRESULT status = E_FAIL;

        EX_TRY
        {
            DAC_INSTANCE* inst = (DAC_INSTANCE*)ptr - 1;
            if (inst->sig == DAC_INSTANCE_SIG)
            {
                addr = inst->addr;
                status = S_OK;
            }
            else
            {
                status = E_INVALIDARG;
            }
        }
        EX_CATCH
        {
            status = E_INVALIDARG;
        }
        EX_END_CATCH(SwallowAllExceptions)

        if (status != S_OK)
        {
            if (g_dacImpl && g_dacImpl->m_debugMode)
            {
                DebugBreak();
            }

            if (throwEx)
            {
                // This means a pointer was supplied which doesn't actually point to the beginning of 
                // a marshalled DAC instance.
                _ASSERTE_MSG(false, "DAC coding error: Attempt to get target address from a host pointer "
                                    "which is not an instance marshalled by DAC!");
                DacError(status);
            }
        }

        return addr;
    }

#endif // !_PREFIX_
}
開發者ID:krk,項目名稱:coreclr,代碼行數:62,代碼來源:dacfn.cpp

示例14: Break

		static void Break()
		{
			DebugBreak();
		}
開發者ID:mattgreen,項目名稱:openim,代碼行數:4,代碼來源:Debug.hpp

示例15: osdepBreak

/*
    system halt on psError when built HALT_ON_PS_ERROR 
*/
void osdepBreak(void)
{
     DebugBreak();
}
開發者ID:changloong,項目名稱:gool,代碼行數:7,代碼來源:osdep.c


注:本文中的DebugBreak函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。