Valgrind不显示行号

我试图找出我在哪里使用Valgrind无效写入一块内存。 它告诉有这样一个问题,也是在什么function上,而不是在什么方面。 虽然这个函数很小,但我想要在Valgrind中显示行号。 我在Valgrind的一些输出中看到了这个,但是现在他们没有被显示,我想知道为什么。

输出如下:

niklas@emerald:~/Arbeitsfläche/spyr/bin/Debug$ valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./spyr [...] ==4404== Invalid write of size 4 ==4404== at 0x8048849: sp_ParticleBuffer_init (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048BFC: sp_ParticleSystem_createParticle (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048691: main (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== Address 0x422a0a0 is 4 bytes after a block of size 4 alloc'd ==4404== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4404== by 0x8048BC1: sp_ParticleSystem_createParticle (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048691: main (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== ==4404== Invalid write of size 4 ==4404== at 0x8048865: sp_ParticleBuffer_init (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048BFC: sp_ParticleSystem_createParticle (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048691: main (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== Address 0x422a09c is 0 bytes after a block of size 4 alloc'd ==4404== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==4404== by 0x8048BC1: sp_ParticleSystem_createParticle (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) ==4404== by 0x8048691: main (in /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr) [...] 

我看到在文件名后面的双冒号后显示行号的输出。 ie /home/niklas/Arbeitsfläche/spyr/bin/Debug/spyr:23或类似的。

我怎样才能启用这个?

仅供参考,这是sp_ParticleBuffer_init函数。

 int sp_ParticleBuffer_init(sp_ParticleBuffer* buffer, sp_Uint32 buffer_size, int init_zero) { size_t size = sizeof(sp_Particle) * buffer_size; buffer->next = null; buffer->array = (sp_Particle*) malloc(size); buffer->alive_count = 0; if (!buffer->array) return SPYR_ALLOCFAILED; if (init_zero) memset((void*) buffer->array, 0, size); return SPYR_NOERR; } 

Solutions Collecting From Web of "Valgrind不显示行号"