为什么 Valgrind 不喜欢我对 glutCreateWindow 的使用? [英] Why does Valgrind not like my usage of glutCreateWindow?

查看:19
本文介绍了为什么 Valgrind 不喜欢我对 glutCreateWindow 的使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码...

I'm using the following code...

169: const char *title = Title.c_str();
170: glutCreateWindow(title);

... Valgrind 给了我以下内容...

... Valgrind gives me the following ...

==28841== Conditional jump or move depends on uninitialised value(s)
==28841==    at 0x6FF7A4C: (within /usr/lib64/libGLcore.so.180.44)
==28841==    by 0x6FF81F7: (within /usr/lib64/libGLcore.so.180.44)
==28841==    by 0x7289B36: (within /usr/lib64/libGLcore.so.180.44)
==28841==    by 0x728A757: _nv000133gl (in /usr/lib64/libGLcore.so.180.44)
==28841==    by 0x4EAB9E9: (within /usr/lib64/libGL.so.180.44)
==28841==    by 0x4EAEA81: (within /usr/lib64/libGL.so.180.44)
==28841==    by 0x4EB1D81: (within /usr/lib64/libGL.so.180.44)
==28841==    by 0x4EA782B: glXCreateNewContext (in /usr/lib64/libGL.so.180.44)
==28841==    by 0x54DF9AA: fgOpenWindow (in /usr/lib64/libglut.so.3.8.0)
==28841==    by 0x54DE062: fgCreateWindow (in /usr/lib64/libglut.so.3.8.0)
==28841==    by 0x54DF300: glutCreateWindow (in /usr/lib64/libglut.so.3.8.0)
==28841==    by 0x4146CE: vimrid::glut::GlutApplication::Init() (GlutApplication.cpp:170)

但是什么是未初始化的?title 变量用 Title.c_str() 的值初始化,Title 是一个类成员,在构造函数成员初始化列表中初始化...

But what is uninitialized? The title variable is initialized with the value of Title.c_str() and Title is a class member which is initialized in the constructor member initialization list...

class VimridApplication
{
    // ...

public:
    std::string Title;

    // ...
}

VimridApplication::VimridApplication() :
    Title("Untitled VimridApplication")
{
    // ...
}

class GlutApplication : public VimridApplication
{
    // ...
}

推荐答案

Valgrind 带有一些默认的错误抑制,但这可能不包括 libCLcore.

Valgrind comes with some default error suppression, but that probably does not cover libCLcore.

错误检查工具可检测基础库中的许多问题,例如 GNU C 库和 X11 客户端库,这些库预装在您的 GNU/Linux 系统上.您无法轻松修复这些错误,但您不想看到这些错误(是的,有很多!)因此 Valgrind 在启动时读取要抑制的错误列表../configure 脚本在系统构建时会创建一个默认的抑制文件.

The error-checking tools detect numerous problems in the base libraries, such as the GNU C library, and the X11 client libraries, which come pre-installed on your GNU/Linux system. You can't easily fix these, but you don't want to see these errors (and yes, there are many!) So Valgrind reads a list of errors to suppress at startup. A default suppression file is created by the ./configure script when the system is built.

您可以创建自己的错误抑制您知道与您的代码无关.

You can create your own error suppressions that you know are irrelevant to your code.

这篇关于为什么 Valgrind 不喜欢我对 glutCreateWindow 的使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆