[Q-e-developers] Using Valgrind and GDB with QE

Hsin-Yu Ko hsinyu at princeton.edu
Thu May 5 16:15:38 CEST 2016


Hi Thomas,

Did you put -g in CFLAGS and LDFLAGS? Valgrind seems to recognize some
lines inside MAIN__ while failing to find the linked ones.

Best,
Hsin-Yu

On 05/05/2016 09:48 AM, Thomas Markovich wrote:
> Hi,
> 
> I'm preparing to push my module that implements the Many Body Dispersion
> van der Waals correction, and all associated forces. As a last thing, I
> ran my code through valgrind, and it seems to have popped up a couple of
> remaining things that I would like to fix before release[1].
> Unfortunately, the valgrind output below is less than clear on where
> exactly the error is, and it doesn't give any important line numbers.
> Beyond this, addr2line gives thoroughly unhelpful output:
> ▶ gaddr2line -e pw.x 0x100520518
> ??:0.
> 
> I have compiled QE given the following flags with gfortran 4.9:
> FFLAGS         = -Og -g -pg -fopenmp -fbacktrace -fcheck=all
> -finit-real=nan -ffpe-trap=zero,invalid,zero,overflow
> 
> Is there any way to compile QE such that it generates all the debugging
> symbols, so that I can get more readable and informative output from
> valgrind? I thought all I needed was the -g flag, but it appears that I
> might need more?
> 
> Best,
> Thomas Markovich
> 
> [1]
> ==10233== Invalid write of size 8
> ==10233==    at 0x100520518: __mbdvdw_module_MOD_mbdvdw_tgg_complex (in
> /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x100555A88:
> __mbdvdw_module_MOD_mbdvdw_check_quantity_dh (in /Users/tmarkovich/bin/pw.x)
> ==10233==  Address 0x103131248 is 8 bytes after a block of size 1,728
> alloc'd
> ==10233==    at 0x1011814AB: malloc (in
> /usr/local/Cellar/valgrind/HEAD/lib/valgrind/vgpreload_memcheck-amd64-darwin.so)
> ==10233==    by 0x1005547B0:
> __mbdvdw_module_MOD_mbdvdw_check_quantity_dh (in /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x1003D56E4: v_of_rho_ (in /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x1000F540B: electrons_scf_ (in /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x1000F6E18: electrons_ (in /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x10032AA28: run_pwscf_ (in /Users/tmarkovich/bin/pw.x)
> ==10233==    by 0x1000010BB: MAIN__ (pwscf.f90:30)
> ==10233==    by 0x100B67C1F: main (pwscf.f90:14)



More information about the developers mailing list