在 Visual Studio 中调试 - 我能否看到英特尔编译器库代码

Debugging in Visual Studio- can I see the Intel Compiler library code?

本文关键字:英特尔 编译器 代码 Studio Visual 调试      更新时间:2023-10-16

我正在使用Visual Studio 2012与Intel C/C++编译器,并且当单步执行如下行时:

x = new X();

然后我看到代码,如下所示:

#ifdef _SYSCRT
#include <cruntime.h>
#include <crtdbg.h>
#include <malloc.h>
#include <new.h>
#include <stdlib.h>
#include <winheap.h>
#include <rtcsup.h>
#include <internal.h>
void * operator new( size_t cb )
{
    void *res;
    for (;;) {
        //  allocate memory block
        res = _heap_alloc(cb);
        //  if successful allocation, return pointer to memory
        if (res)
            break;
        //  call installed new handler
        if (!_callnewh(cb))
            break;
        //  new handler was successful -- try to allocate again
    }
    RTCCALLBACK(_RTC_Allocate_hook, (res, cb, 0));
    return res;
}
#else  /* _SYSCRT */
#include <cstdlib>
#include <new>
_C_LIB_DECL
int __cdecl _callnewh(size_t size) _THROW1(_STD bad_alloc);
_END_C_LIB_DECL
void *__CRTDECL operator new(size_t size) _THROW1(_STD bad_alloc)
        {       // try to allocate size bytes
        void *p;
        while ((p = malloc(size)) == 0)
                if (_callnewh(size) == 0)
                {       // report no memory
                        _THROW_NCEE(_XSTD bad_alloc, );
                }
        return (p);
        }
#endif  /* _SYSCRT */

这是英特尔编译器对 new(( 的定义吗?就像我可以看到英特尔如何在通过我的应用程序进行调试时实施 C++ 标准一样?

我怎样才能看到 malloc.c 中的内容(而不是 malloc.h(?

编辑:我认为这是Microsoft新的((,因为Microsoft出现在评论中。为什么我在使用英特尔编译器时看到 new(( Microsoft实现?

  • 我怎样才能看到 malloc.c 中的内容(而不是 malloc.h(?
  • 您看不到 malloc.c 的一个原因是,您正在调用的函数是否在 malloc.h 中定义和声明。当你谈到malloc.c和malloc.h时,我猜你的意思是你想看到内存分配函数,即new((或malloc(sizeof(5(/sizeof(int((等函数。
  • 您也可能看不到此文件,因为内存分配函数或任何其他间接使用内存分配器函数的函数没有错误。如果错误不存在,那么编译器不会指出您收到的错误来自 malloc.c 或 malloc.h。
  • 编译器将指向生成错误的类或文件。除非有违反 malloc.c 或 malloc.h 函数的函数,否则可能看不到这些文件。