|
From: Roberto S. <ro...@mu...> - 2003-10-04 17:13:31
|
I have a problem when running a program under valgrind
The program runs just fine without valgrind.
Under valgrind, it complains about two places in the code.
This two sections are similar, so I show only the first one:
#define F_CONNECTING 2
...
for(i=0; i < 200; i++) {
...
if(connection[i].flags == F_CONNECTING)
{
printf("connection[%i].flags=%i\n", i, connection[i].flags);
=> if(pollfds[connection[i].pollidx].revents & POLLERR ||
pollfds[connection[i].pollidx].revents & POLLHUP ||
pollfds[connection[i].pollidx].revents & POLLNVAL) { do something .. }
the line with => is line number 1243
when running under valgrind:
connection[0].flags=2
==8200==
==8200== Conditional jump or move depends on uninitialised value(s)
==8200== at 0x804C031: main (lookt2.c:1243)
==8200== by 0x40267DBD: __libc_start_main (in /lib/libc-2.3.2.so)
==8200== by 0x8048D60: (within /pub/dev/lookthrough/new/lookt2)
==8200==
==8200== ---- Attach to GDB ? --- [Return/N/n/Y/y/C/c] ---- y
==8200== starting GDB with cmd: /usr/bin/gdb -nw /proc/8200/exe 8200
GNU gdb 5.3.90_2003-08-24-cvs-debian
...
vg_do_syscall3 (syscallno=4294966784, arg1=8228, arg2=0, arg3=0)
at vg_mylibc.c:92
92 vg_mylibc.c: No such file or directory.
in vg_mylibc.c
(gdb) bt
#0 vg_do_syscall3 (syscallno=4294966784, arg1=8228, arg2=0, arg3=0)
at vg_mylibc.c:92
#1 0x40191b7d in vgPlain_system (
cmd=0xbffff830 "/usr/bin/gdb -nw /proc/8200/exe 8200") at
vg_mylibc.c:1277
#2 0x4018d727 in vgPlain_start_GDB_whilst_on_client_stack () at
vg_main.c:1821
#3 0x40194e48 in vgPlain_swizzle_esp_then_start_GDB ()
from /usr/lib/valgrind/valgrind.so
#4 0xbffff938 in ?? ()
#5 0x0804c031 in main (argc=134534236, argv=0x0) at lookt2.c:1243
(gdb) frame 5
#5 0x0804c031 in main (argc=134534236, argv=0x0) at lookt2.c:1243
1243 if(pollfds[connection[i].pollidx].revents & POLLERR ||
pollfds[connection[i].pollidx].revents & POLLHUP ||
pollfds[connection[i].pollidx].revents & POLLNVAL)
(gdb) print i
$1 = 202
As you see, here the counter "i" is 202, while just one line before
stopping, the program printed connection[0].flags=2 (where "i" is 0,
which is the correct value)
The above error repeats with a different but similar region of code.
Any idea ?
If that matters, I'm running debian unstable
Thanks,
--
Roberto Sebastiano <ro...@mu...>
|
|
From: Dan K. <da...@ke...> - 2003-10-04 17:23:49
|
Roberto Sebastiano wrote: > #5 0x0804c031 in main (argc=134534236, argv=0x0) at lookt2.c:1243 Yikes, why is it confused about argc? - Dan -- Dan Kegel http://www.kegel.com http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045 |
|
From: Roberto S. <ro...@mu...> - 2003-10-04 17:41:24
|
Il sab, 2003-10-04 alle 19:58, Dan Kegel ha scritto: > Roberto Sebastiano wrote: > > #5 0x0804c031 in main (argc=134534236, argv=0x0) at lookt2.c:1243 > > Yikes, why is it confused about argc? > I don't know, printing it the line before it stops shows "5", that is the correct value I argue stack corruption Cheers, -- Roberto Sebastiano <ro...@mu...> |
|
From: Dirk M. <dm...@gm...> - 2003-10-05 12:33:32
|
On Saturday 04 October 2003 19:12, Roberto Sebastiano wrote: > I have a problem when running a program under valgrind under which version of valgrind? > The program runs just fine without valgrind. Great. do you have a compileable testcase that reproduces the problem for you? then its pretty trivial to figure it out. |
|
From: Roberto S. <ro...@mu...> - 2003-10-05 15:44:58
|
Il sab, 2003-10-04 alle 21:25, Dirk Mueller ha scritto: > On Saturday 04 October 2003 19:12, Roberto Sebastiano wrote: > > > I have a problem when running a program under valgrind > > under which version of valgrind? dpkg -l valgrind ii valgrind 20030725-5 > > The program runs just fine without valgrind. > > Great. do you have a compileable testcase that reproduces the problem for you? > then its pretty trivial to figure it out. No, I only have the entire program in source form I'll try to build a testcase that triggers the problem ASAP Cheers, -- Roberto Sebastiano <ro...@mu...> |