我在调试时,要在我的程序中内存分配的第20个模块时,设置断点,怎么设??

解决方案 »

  1.   

    也可用条件断点:
    声明并赋值条件表达式变量
    把光标定位在赋值后一行
    Ctrl+B调出断点对话框,在BreakAt编辑框后的按钮选择光标位置,然后“Condition”命令开始可用,单击命令,设置条件,如( true==dbg_bJustCallNew20Times ){
      pitemTemp = new CDataItem();
      if (NULL==pitemTemp  ||  NULL==m_listBuffer.AddTail(pitemTemp))
      {
        if (pitemTemp)
          delete pitemTemp;
        return false;
      }  #ifdef _DEBUG
       bool dbg_bJustCallNew20Times    = (20 == m_listBuffer.GetCount());
       ASSERT (dbg_bJustCallNew20Times); //Or use this to stop the routing.   bool dbg_bStopForCheckContext = true; // <= place focus here
      #endif  ...
      

  2.   

    if (...)
    {
        __asm
        {
            int 3;
        {
    }
      

  3.   

    insert code like this:
    if (...)
    {
        __asm
        {
            int 3;
        {
    }