I am currently reading and fallowing along the "Learn C The Hard Way"-book. On exercise 4 I have to install Valgrind. I first did this locally on my Macbook running Maverick, but I received a warning that Valgrind might not work 100%.
So now I tried it with Vagrant (using VirtualBox) with an Ubuntu 12.04 box. You can check out the exact Vagrantfile (setup) and the exercise files here on my github repo.
The problem:
I don't see the line numbers and instead I get something like 0x40052B
.
I compiled the files by doing the fallowing:
$ make clean # Just to be sure
$ make
$ valgrind --track-origins=yes ./ex4
I pasted the result to pastebin here.
I found the fallowing 3 questions on SO that (partly) describes the same problem, but the answer's and there solutions didn't work for me:
- Valgrind not showing line numbers in spite of -g flag (on Ubuntu 11.10/VirtualBox)
- How do you get Valgrind to show line errors?
- Valgrind does not show line-numbers
What I have tried sofar:
- Added
libc6-dbg
- installed
gcc
and tried compiling with that instead ofcc
. - added
--track-origins=yes
to thevalgrind
-command - Added (and later removed) compiling with
-static
and-oO
flags
So I am not sure where to go from here? I could try and install the latest (instead of v3.7) off gcc
manually although that looked rather difficult.
edit:
@abligh answer seems to be right. I made this with kaleidoscope:
On the left side you see the result of:
valgrind --track-origins=yes ./ex4
and on the right side the result of valgrind ./ex4
.
I guess I still need to learn allot about c
and it's tools.