Reading malloc output

383 views Asked by At

I have a register allocator implemented with liveness analysis, and I am getting a seg fault:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7560d9d in _int_malloc () from /lib64/libc.so.6

So I ran it on valgrind, trying to see what the error is iwth this command:

valgrind -v --leak-check=yes

I have never used this program before, and I really don't know why the seg fault is happening. I am suspecting memory leakage somewhere. Could somebody help me understand what the output of valgrind is saying?

--58831-- Reading syms from /lib64/ld-2.11.3.so (0x4000000)
--58831-- Reading syms from /usr/lib64/valgrind/amd64-linux/memcheck (0x38000000)
--58831--    object doesn't have a symbol table
--58831--    object doesn't have a dynamic symbol table
--58831-- Reading suppressions file: /usr/lib64/valgrind/default.supp
==58831== Conditional jump or move depends on uninitialised value(s)
==58831==    at 0x401677D: strlen (in /lib64/ld-2.11.3.so)
==58831==    by 0x4005072: fillin_rpath (in /lib64/ld-2.11.3.so)
==58831==    by 0x40086D8: _dl_init_paths (in /lib64/ld-2.11.3.so)
==58831==    by 0x400311F: dl_main (in /lib64/ld-2.11.3.so)
==58831==    by 0x4014AD2: _dl_sysdep_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x40013CB: _dl_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x4000B07: (within /lib64/ld-2.11.3.so)
==58831==    by 0x2: ???
==58831==    by 0x7FF00057E: ???
==58831==    by 0x7FF000584: ???
==58831==    by 0x7FF000587: ???
--58831-- Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_core.so (0x4A21000)
--58831--    object doesn't have a symbol table
==58831==
==58831== Conditional jump or move depends on uninitialised value(s) 
==58831==    at 0x4016616: index (in /lib64/ld-2.11.3.so)
==58831==    by 0x4007682: expand_dynamic_string_token (in /lib64/ld-2.11.3.so)
==58831==    by 0x4007C75: _dl_map_object (in /lib64/ld-2.11.3.so)
==58831==    by 0x400184D: map_doit (in /lib64/ld-2.11.3.so)
==58831==    by 0x400DE45: _dl_catch_error (in /lib64/ld-2.11.3.so)
==58831==    by 0x4001766: do_preload (in /lib64/ld-2.11.3.so)
==58831==    by 0x4003D3F: dl_main (in /lib64/ld-2.11.3.so)
==58831==    by 0x4014AD2: _dl_sysdep_start (in /lib64/ld-2.11.3.so) 
==58831==    by 0x40013CB: _dl_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x4000B07: (within /lib64/ld-2.11.3.so)   
==58831==    by 0x2: ???
==58831==    by 0x7FF00057E: ???
==58831==
==58831== Conditional jump or move depends on uninitialised value(s)
==58831==    at 0x401661B: index (in /lib64/ld-2.11.3.so)
==58831==    by 0x4007682: expand_dynamic_string_token (in /lib64/ld-2.11.3.so)
==58831==    by 0x4007C75: _dl_map_object (in /lib64/ld-2.11.3.so)
==58831==    by 0x400184D: map_doit (in /lib64/ld-2.11.3.so)
==58831==    by 0x400DE45: _dl_catch_error (in /lib64/ld-2.11.3.so)  
==58831==    by 0x4001766: do_preload (in /lib64/ld-2.11.3.so)
==58831==    by 0x4003D3F: dl_main (in /lib64/ld-2.11.3.so)
==58831==    by 0x4014AD2: _dl_sysdep_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x40013CB: _dl_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x4000B07: (within /lib64/ld-2.11.3.so)
==58831==    by 0x2: ???
==58831==    by 0x7FF00057E: ???
--58831-- Reading syms from /usr/lib64/valgrind/amd64-linux/vgpreload_memcheck.so     (0x4C23000)
--58831--    object doesn't have a symbol table
--58831-- REDIR: 0x40165b0 (index) redirected to 0x4c27ba0 (index)
--58831-- REDIR: 0x4016630 (strcmp) redirected to 0x4c28160 (strcmp)
--58831-- REDIR: 0x4016740 (strlen) redirected to 0x4c27e60 (strlen)
--58831-- Reading syms from /usr/lib64/libstdc++.so.6.0.17 (0x4E2C000)
--58831-- Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x2a

valgrind: m_debuginfo/readdwarf.c:2152 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0     && srcix < VG_(sizeXA)(srcxa)' failed.
==58831==    at 0x3801C15C: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x3801C46A: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x380560A1: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x3805635D: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38056BAB: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x380586BA: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38053BFD: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x380356C0: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x3806BFC3: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x3806FE93: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38039886: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38036CB2: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38037CD7: (within /usr/lib64/valgrind/amd64-linux/memcheck)
==58831==    by 0x38049A70: (within /usr/lib64/valgrind/amd64-linux/memcheck)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable
==58831==    at 0x40161AA: mmap (in /lib64/ld-2.11.3.so)
==58831==    by 0x40065DA: _dl_map_object_from_fd (in /lib64/ld-2.11.3.so)
==58831==    by 0x4007D1C: _dl_map_object (in /lib64/ld-2.11.3.so)
==58831==    by 0x400D401: openaux (in /lib64/ld-2.11.3.so)
==58831==    by 0x400DE45: _dl_catch_error (in /lib64/ld-2.11.3.so)
==58831==    by 0x400C48F: _dl_map_object_deps (in /lib64/ld-2.11.3.so)
==58831==    by 0x40032DF: dl_main (in /lib64/ld-2.11.3.so)
==58831==    by 0x4014AD2: _dl_sysdep_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x40013CB: _dl_start (in /lib64/ld-2.11.3.so)
==58831==    by 0x4000B07: (within /lib64/ld-2.11.3.so)
==58831==    by 0x2: ???
==58831==    by 0x7FF00057E: ???
==58831==    by 0x7FF000584: ???
==58831==    by 0x7FF000587: ???
1

There are 1 answers

0
K-J On

It seems to me that you have not added debug symbols when you compiled your program. If you are using GCC, append "-ggdb" to your compilation command. E.g if you have written:

gcc -o program main.c

Change it to:

gcc -o program main.c -ggdb

Then Valgrind will be able to relate potential errors to the code. Also, I do not think you will need the '-v' flag in your Valgrind command.

Good Luck!