|
From: Vikas <cat...@gm...> - 2007-01-24 08:35:58
|
Hi , I get an output like this. ==26775== Invalid write of size 2 POINT 1 . ==26775== at 0x1B9879DA: memcpy (in /lib/tls/i686/cmov/libc-2.3.6.so) ==26775== by 0x1B970FEE: _IO_getline (in /lib/tls/i686/cmov/libc-2.3.6.so ) ==26775== by 0x1B96FF18: _IO_fgets (in /lib/tls/i686/cmov/libc-2.3.6.so) ==26775== by 0x80484CD: main (gan.c:22) ==26775== Address 0x1BA4E029 is 1 bytes inside a block of size 2 free'd ==26775== at 0x1B9070B9: free (vg_replace_malloc.c:153) ==26775== by 0x804848F: main (gan.c:13) Is there any way to know what function was called before memcpy which is below POINT1 ??? Waiting for reply. vikas |
|
From: <and...@us...> - 2007-01-24 14:50:51
|
The stack trace explicitly tells you: the main() called libc fgets() which called libc getline() which called memcpy which had the invalid write. Your error is likely that you passed an invalid argument to fgets() from main(). Check the arguments you use to fgets on line 22 of gan.c and you'll probably find your error. Andrew val...@li... wrote on 01/24/2007 03:35:24 AM: > [image removed] > > [Valgrind-developers] backtrace option in valgrind . > > Vikas <cat...@gm...> > > to: > > valgrind-developers > > 01/24/07 04:13 AM > > Bcc: > > Andrew Lamb > > Hi , > > I get an output like this. > > ==26775== Invalid write of size 2 > POINT 1 . > ==26775== at 0x1B9879DA: memcpy (in /lib/tls/i686/cmov/libc-2.3.6.so) > ==26775== by 0x1B970FEE: _IO_getline (in /lib/tls/i686/cmov/libc- 2.3.6.so) > ==26775== by 0x1B96FF18: _IO_fgets (in /lib/tls/i686/cmov/libc-2.3.6.so) > ==26775== by 0x80484CD: main (gan.c:22) > ==26775== Address 0x1BA4E029 is 1 bytes inside a block of size 2 free'd > ==26775== at 0x1B9070B9: free (vg_replace_malloc.c:153) > ==26775== by 0x804848F: main (gan.c:13) > > > Is there any way to know what function was called before memcpy > which is below POINT1 ??? > > Waiting for reply. > vikas > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Valgrind-developers mailing list > Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-developers |
|
From: Vikas <cat...@gm...> - 2007-01-25 07:02:22
|
Hi , yes , i have purposefully done that........in the file gan.c . My purpose is to put my code in the valgrind-function which is doing this job of finding the invalid address . In other words , I want the function which prints all these . I tried to trace it in gdb but its crashing . ==26775== Invalid write of size 2 > POINT 1 . > ==26775== at 0x1B9879DA: memcpy (in /lib/tls/i686/cmov/libc-2.3.6.so) > ==26775== by 0x1B970FEE: _IO_getline (in /lib/tls/i686/cmov/libc- 2.3.6.so) > ==26775== by 0x1B96FF18: _IO_fgets (in /lib/tls/i686/cmov/libc-2.3.6.so ) > ==26775== by 0x80484CD: main (gan.c:22) > ==26775== Address 0x1BA4E029 is 1 bytes inside a block of size 2 free'd > ==26775== at 0x1B9070B9: free (vg_replace_malloc.c:153) > ==26775== by 0x804848F: main (gan.c:13) > waiting for reply, Vikas On 1/24/07, and...@us... <and...@us...> wrote: > > > The stack trace explicitly tells you: the main() called libc fgets() which > called libc getline() which called memcpy which had the invalid write. > > Your error is likely that you passed an invalid argument to fgets() from > main(). Check the arguments you use to fgets on line 22 of gan.c and > you'll probably find your error. > > Andrew > > > val...@li... wrote on 01/24/2007 > 03:35:24 AM: > > > [image removed] > > > > [Valgrind-developers] backtrace option in valgrind . > > > > Vikas <cat...@gm...> > > > > to: > > > > valgrind-developers > > > > 01/24/07 04:13 AM > > > > Bcc: > > > > Andrew Lamb > > > > Hi , > > > > I get an output like this. > > > > ==26775== Invalid write of size 2 > > POINT 1 . > > ==26775== at 0x1B9879DA: memcpy (in /lib/tls/i686/cmov/libc-2.3.6.so) > > ==26775== by 0x1B970FEE: _IO_getline (in /lib/tls/i686/cmov/libc- > 2.3.6.so) > > ==26775== by 0x1B96FF18: _IO_fgets (in /lib/tls/i686/cmov/libc- > 2.3.6.so) > > ==26775== by 0x80484CD: main (gan.c:22) > > ==26775== Address 0x1BA4E029 is 1 bytes inside a block of size 2 free'd > > > ==26775== at 0x1B9070B9: free (vg_replace_malloc.c:153) > > ==26775== by 0x804848F: main (gan.c:13) > > > > > > Is there any way to know what function was called before memcpy > > which is below POINT1 ??? > > > > Waiting for reply. > > vikas > > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys - and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Valgrind-developers mailing list > > Val...@li... > > https://lists.sourceforge.net/lists/listinfo/valgrind-developers > |