c - how to read this valgrind informations -
i'm running multi-threading program , every time errors
malloc(): memory corruption
or segmentation fault.
i decided use valgrind investigate kind of problems program shows. first of got below output. can me understand how read output messages?
==17413== conditional jump or move depends on uninitialised value(s) ==17413== @ 0x47a2349: ns_name_ntop (ns_name.c:147) ==17413== 0x47a3271: ns_name_uncompress (ns_name.c:585) ==17413== 0x479b3ef: dn_expand (res_comp.c:93) ==17413== 0x479fd2b: __res_queriesmatch (res_send.c:327) ==17413== 0x47a0d19: __libc_res_nsend (res_send.c:1327) ==17413== 0x479ddc7: __libc_res_nquery (res_query.c:226) ==17413== 0x479e417: __libc_res_nquerydomain (res_query.c:582) ==17413== 0x479e8fb: __libc_res_nsearch (res_query.c:416) ==17413== 0x404b1d9: _nss_dns_gethostbyname3_r (dns-host.c:192) ==17413== 0x404b540: _nss_dns_gethostbyname_r (dns-host.c:273) ==17413== 0x42c53fa: gethostbyname_r@@glibc_2.1.2 (getxxbyyy_r.c:266) ==17413== 0x42c4b7b: gethostbyname (getxxbyyy.c:116) ==17413== uninitialised value created stack allocation ==17413== @ 0x804ada3: udp_server_open(int&, unsigned short) (udp_server.cpp:16) ==17413== ==17413== use of uninitialised value of size 4 ==17413== @ 0x47a2382: ns_name_ntop (ns_name.c:153) ==17413== 0x47a3271: ns_name_uncompress (ns_name.c:585) ==17413== 0x479b3ef: dn_expand (res_comp.c:93) ==17413== 0x479fd2b: __res_queriesmatch (res_send.c:327) ==17413== 0x47a0d19: __libc_res_nsend (res_send.c:1327) ==17413== 0x479ddc7: __libc_res_nquery (res_query.c:226) ==17413== 0x479e417: __libc_res_nquerydomain (res_query.c:582) ==17413== 0x479e8fb: __libc_res_nsearch (res_query.c:416) ==17413== 0x404b1d9: _nss_dns_gethostbyname3_r (dns-host.c:192) ==17413== 0x404b540: _nss_dns_gethostbyname_r (dns-host.c:273) ==17413== 0x42c53fa: gethostbyname_r@@glibc_2.1.2 (getxxbyyy_r.c:266) ==17413== 0x42c4b7b: gethostbyname (getxxbyyy.c:116) ==17413== uninitialised value created stack allocation ==17413== @ 0x804ada3: udp_server_open(int&, unsigned short) (udp_server.cpp:16)
for simplest approach, getting information regarding error(s) read output like
==17413== @ 0x47a2349: ns_name_ntop (ns_name.c:147) look @
- file name (
ns_name.c) - line number (
147) - function name (
ns_name_ntop)
and error message
conditional jump or move depends on uninitialised value(s)
it says, you're using conditional statement, if, else if expression contains variable can have uninitialized value. sources of uninitialised data tend be:
- local variables in procedures have not been initialised.
- the contents of heap blocks (allocated
malloc()or similar function) before write there.
this way, can start checking reported messages.
for more related information, can check on-line manual memcheck tool in valgrind.
Comments
Post a Comment