当前位置: 首页>>代码示例>>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;未经允许,请勿转载。