|
From: Igmar P. <mai...@pa...> - 2012-11-06 11:12:38
|
> If not yet done, upgrade to the last version of Valgrind (3.8.1). > Then use gdb+vgdb to connect to your application. For this, give > --vgdb-error=0 and follow the on-screen instructions. I'm using SVN only releases. The docs don't build OK, so my manual didn't have this info. I need to figure out why the docs won't build properly. > Then place breakpoints at the relevant place(s) to do a leak search > (e.g. just before the exit of main). > When breakpoint reached, do a leak search from gdb, using : > (gdb) monitor leak_search > Note: there are some optional args to leak_search. > use > (gdb) monitor help > and/or read manual for more info > http://www.valgrind.org/docs/manual/mc-manual.html#mc-manual.monitor-commands > > Then use the following monitor command to find the list of leaked blocks > (gdb) monitor block_list <a_loss_record_nr_output_by_leak_search> > This was it : (gdb) mo l f r a <snip> ==30693== 67 (60 direct, 7 indirect) bytes in 3 blocks are definitely lost in loss record 7 of 7 ==30693== at 0x4007EFC: malloc (vg_replace_malloc.c:270) ==30693== by 0x8064DED: scanner_token_construct (parser_native.c:55) ==30693== by 0x80656FE: is_parser_native_parse_input (parser_native.c:355) ==30693== by 0x8065518: is_parser_native_parse_file (parser_native.c:278) ==30693== by 0x8049749: test1 (test-native-parser.c:26) ==30693== by 0x4022739: run_single_test (TestRun.c:818) ==30693== by 0x402250A: run_single_suite (TestRun.c:759) ==30693== by 0x4021C44: CU_run_all_tests (TestRun.c:379) ==30693== by 0x4023FD4: basic_run_all_tests (Basic.c:228) ==30693== by 0x4023D32: CU_basic_run_tests (Basic.c:90) ==30693== by 0x804A09E: main (test-native-parser.c:199) <snip> (gdb) monitor block_list 7 ==30693== 0x402D7F8[20] ==30693== 0x402D840[7] indirect loss record 2 ==30693== 0x402D8F8[20] ==30693== 0x402DD10[20] (gdb) p (_scanner_token) *0x402D7F8 $5 = {destruct = 0x8064e35 <scanner_token_destruct>, opcode = 12, orig = 0x4010000 <Address 0x4010000 out of bounds>, data = {n = 0, s = 0x402d840 "global"}} Jackpot :-) Thanks for the assistance and the final hints Philippe !! Regards, Igmar |