new user - symbol info missing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

new user - symbol info missing

Jesper Olsen
Hi,

I just installed valgrind 2.4.0 under linux and am trying to use it on the example from the
quick start guide:

#include <stdlib.h>

void f(void) {
int* x = malloc(10 * sizeof(int));
x[10] = 0; // problem 1: heap block overrun
} // problem 2: memory leak -- x not freed

int main(void) {
f();
return 0;
}

I use gcc 3.2.2 to compile:

% gcc -g test.c

When I invoke valgrind, the output (a lot of it) seems to be correct,
but the line numbers are missing. How come?

% valgrind a.out
<quote>
==7772== Invalid write of size 4
==7772==    at 0x8048489: ???
==7772==    by 0x80484AA: ???
==7772==    by 0x1B91F62C: __libc_start_main (in /lib/libc-2.3.2.so)
==7772==    by 0x8048398: ???
==7772==  Address 0x1BA384F0 is 0 bytes after a block of size 40 alloc'd
==7772==    at 0x1B900534: malloc (vg_replace_malloc.c:130)
==7772==    by 0x804847C: ???
==7772==    by 0x80484AA: ???
==7772==    by 0x1B91F62C: __libc_start_main (in /lib/libc-2.3.2.so)
==7772==    by 0x8048398: ???
</quote>

Cheers
Jesper



Reply | Threaded
Open this post in threaded view
|

Re: new user - symbol info missing

njn (Bugzilla)-2
On Sun, 5 Jun 2005, Jesper Olsen wrote:

> When I invoke valgrind, the output (a lot of it) seems to be correct,
> but the line numbers are missing. How come?
>
> % valgrind a.out
> <quote>
> ==7772== Invalid write of size 4
> ==7772== at 0x8048489: ???
> ==7772== by 0x80484AA: ???
> ==7772== by 0x1B91F62C: __libc_start_main (in
> /lib/libc-2.3.2.so<http://2.3.2.so>
> )
> ==7772== by 0x8048398: ???
> ==7772== Address 0x1BA384F0 is 0 bytes after a block of size 40 alloc'd
> ==7772== at 0x1B900534: malloc (vg_replace_malloc.c:130)
> ==7772== by 0x804847C: ???
> ==7772== by 0x80484AA: ???
> ==7772== by 0x1B91F62C: __libc_start_main (in
> /lib/libc-2.3.2.so<http://2.3.2.so>
> )
> ==7772== by 0x8048398: ???
> </quote>

Valgrind is unable to find any debug/symbol information here, not even
module names.  That sometimes happens when a shared object is unloaded,
but that shouldn't happen in this case.  What does the output of "nm
a.out" look like?

N


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|

Re: new user - symbol info missing

Jesper Olsen


On 6/10/05, Nicholas Nethercote <[hidden email]> wrote:
On Sun, 5 Jun 2005, Jesper Olsen wrote:

> When I invoke valgrind, the output (a lot of it) seems to be correct,
> but the line numbers are missing. How come?
>


Thanks for taking a look at this Nicholas.

In my first post I only quoted part of the output from valgrind - below is the whole thing, which on my
system seems to be more verbose than it should be...

-Jesper


% uname -a
Linux jesperolsen.co.uk 2.4.20-021stab028.3.777-enterprise #1 SMP Wed Feb 2 21:08:59 MSK 2005 i686 i686 i386 GNU/Linux

% nm a.out
08049424 D _DYNAMIC
08049500 D _GLOBAL_OFFSET_TABLE_
08048410 R _IO_stdin_used
         w _Jv_RegisterClasses
080494f0 d __CTOR_END__
080494ec d __CTOR_LIST__
080494f8 d __DTOR_END__
080494f4 d __DTOR_LIST__
08048414 r __EH_FRAME_BEGIN__
08048414 r __FRAME_END__
080494fc d __JCR_END__
080494fc d __JCR_LIST__
08049518 A __bss_start
08049418 D __data_start
080483cc t __do_global_ctors_aux
080482c0 t __do_global_dtors_aux
0804941c D __dso_handle
08049418 A __fini_array_end
08049418 A __fini_array_start
         w __gmon_start__
08049418 A __init_array_end
08049418 A __init_array_start
08048398 T __libc_csu_fini
08048368 T __libc_csu_init
         U __libc_start_main@@GLIBC_2.0
08049518 A _edata
0804951c A _end
080483f0 T _fini
0804840c R _fp_hw
08048230 T _init
08048278 T _start
0804829c t call_gmon_start
08049518 b completed.1
08049418 W data_start
08048328 T f
080482fc t frame_dummy
0804834c T main
         U malloc@@GLIBC_2.0
08049420 d p.0



% valgrind a.out
==10076== Memcheck, a memory error detector for x86-linux.
==10076== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==10076== Using valgrind-2.4.0, a program supervision framework for x86-linux.
==10076== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==10076== For more details, rerun with: -v
==10076==
==10076== Conditional jump or move depends on uninitialised value(s)
==10076==    at 0x1B8ECD05: ???
==10076==    by 0x1B8E542F: ???
==10076==    by 0x1B8F0BEF: ???
==10076==    by 0x1B8E4CF4: ???
==10076==    by 0x1B8E4A86: ???
==10076==
==10076== Conditional jump or move depends on uninitialised value(s)
==10076==    at 0x1B8ECD4F: ???
==10076==    by 0x1B8E542F: ???
==10076==    by 0x1B8F0BEF: ???
==10076==    by 0x1B8E4CF4: ???
==10076==    by 0x1B8E4A86: ???
==10076==
==10076== Conditional jump or move depends on uninitialised value(s)
==10076==    at 0x1B8EC54A: ???
==10076==    by 0x1B8ECBF1: ???
==10076==    by 0x1B8E546B: ???
==10076==    by 0x1B8F0BEF: ???
==10076==    by 0x1B8E4CF4: ???
==10076==    by 0x1B8E4A86: ???
==10076==
==10076== Conditional jump or move depends on uninitialised value(s)
==10076==    at 0x1B8EC54E: ???
==10076==    by 0x1B8ECBF1: ???
==10076==    by 0x1B8E546B: ???
==10076==    by 0x1B8F0BEF: ???
==10076==    by 0x1B8E4CF4: ???
==10076==    by 0x1B8E4A86: ???
==10076==
==10076== Conditional jump or move depends on uninitialised value(s)
==10076==    at 0x1B8ECD4F: ???
==10076==    by 0x1B8E546B: ???
==10076==    by 0x1B8F0BEF: ???
==10076==    by 0x1B8E4CF4: ???
==10076==    by 0x1B8E4A86: ???
==10076==
==10076== Invalid write of size 4
==10076==    at 0x8048344: ???
==10076==    by 0x8048360: ???
==10076==    by 0x1B91F62C: __libc_start_main (in /lib/libc-2.3.2.so)
==10076==    by 0x8048298: ???
==10076==  Address 0x1BA38050 is 0 bytes after a block of size 40 alloc'd
==10076==    at 0x1B900534: malloc (vg_replace_malloc.c:130)
==10076==    by 0x8048337: ???
==10076==    by 0x8048360: ???
==10076==    by 0x1B91F62C: __libc_start_main (in /lib/libc-2.3.2.so)
==10076==    by 0x8048298: ???
==10076==
==10076== ERROR SUMMARY: 14 errors from 6 contexts (suppressed: 0 from 0)
==10076== malloc/free: in use at exit: 40 bytes in 1 blocks.
==10076== malloc/free: 1 allocs, 0 frees, 40 bytes allocated.
==10076== For counts of detected errors, rerun with: -v
==10076== searching for pointers to 1 not-freed blocks.
==10076== checked 57344 bytes.
==10076==
==10076== LEAK SUMMARY:
==10076==    definitely lost: 40 bytes in 1 blocks.
==10076==      possibly lost: 0 bytes in 0 blocks.
==10076==    still reachable: 0 bytes in 0 blocks.
==10076==         suppressed: 0 bytes in 0 blocks.
==10076== Use --leak-check=full to see details of leaked memory.







Reply | Threaded
Open this post in threaded view
|

Re: new user - symbol info missing

James Begley
On Fri, 2005-06-10 at 16:50 +0300, Jesper Olsen wrote:
> On 6/10/05, Nicholas Nethercote <[hidden email]> wrote:
> On Sun, 5 Jun 2005, Jesper Olsen wrote:
> > When I invoke valgrind, the output (a lot of it) seems to be
> > correct, but the line numbers are missing. How come?

Do you have any spaces in the path to the executable?  I seem to
remember that this can confuse valgrind.  If the KDE Bugzilla was
working at the moment I could point you to the bug number for this ...

Cheers,
James.


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Valgrind-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
Reply | Threaded
Open this post in threaded view
|

Re: new user - symbol info missing

Jesper Olsen


On 6/10/05, James Begley <[hidden email]> wrote:
On Fri, 2005-06-10 at 16:50 +0300, Jesper Olsen wrote:
> On 6/10/05, Nicholas Nethercote <[hidden email]> wrote:
> On Sun, 5 Jun 2005, Jesper Olsen wrote:
> > When I invoke valgrind, the output (a lot of it) seems to be
> > correct, but the line numbers are missing. How come?

Do you have any spaces in the path to the executable?  I seem to
remember that this can confuse valgrind.  If the KDE Bugzilla was


No, not if I understand you correctly. The executable is in the current directory:
valgrind ./a.out

-Jesper