On 12/09/2015 12:35 PM, Philippe Waroquiers wrote:
> On Wed, 2015-12-09 at 10:32 -0800, Nikolaus Rath wrote:
>> On 12/09/2015 10:00 AM, Nikolaus Rath wrote:
> 
>> Interestingly enough, but stacktraces are incorrect: gdb is
>> missing the call to taehdf5_mp_h5append_data_double_0d_,
>> and valgrind is missing the call to h5dump_attr_int.
>
> The missing valgrind entry has the same "look" as an inlining "not
> understood": we see a a function, but with a source that is another
> function. 
> Maybe you could try by recompiling with an option that fully disable
> inlining ?
> 
>> This is with valgrind 3.10.0 and gdb 7.7.1 (as above).
>
> At least for valgrind, it would be better to upgrade to the last
> released version (3.11).

Ok, I tried again with version 3.11.0. The problem is still there.

However, I can confirm that it's caused by inlining: if I explicitly disable 
inlining I can still compile with -O3 and get correct stacktraces.

>> Short of only using -O1 and -O0, is there a way to fix this?
> Without more info on the origin of the wrong stack trace, difficult to
> to say. You might try by using -O1, and then add individual optimisation
> flags one by one, till you see which optimisation flag causes the
> wrong stacktrace (assuming your compiler is like gcc, i.e. has very
> fine grained optimisation control).
> 
> Alternatively, you could investigate by using the valgrind monitor
> command   (gdb) monitor v.info unwind <addr> <len>
> to investigate the unwind info around the missing stacktrace entry
> and/or by activating the debug trace of valgrind e.g.
>      --trace-symtab=no|yes     show symbol table details? [no]
>      --trace-symtab-patt=<patt> limit debuginfo tracing to obj name <patt>
>      --trace-cfi=no|yes        show call-frame-info details? [no]


Hmm. Unfortunately the output doesn't tell me anything. Here's what I get:

Correct stacktrace:

Thread 1: status = VgTs_Runnable (lwpid 1654)
==1654==    at 0xF1F5D0: H5FL_reg_calloc (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==1654==    by 0xEB5369: H5A_create (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==1654==    by 0xEAF490: H5Acreate2 (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==1654==    by 0xE9E23D: h5acreate_c_ (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==1654==    by 0xE98636: h5a_mp_h5acreate_f_ (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==1654==    by 0xAE9C68: taehdf5_mp_h5dump_attr_int_ (taehdf5.f90:1936)
==1654==    by 0xAE58A3: taehdf5_mp_h5append_data_double_0d_ (taehdf5.f90:4193)
==1654==    by 0xA8A063: plot_m_mp_plots_ (plot_hdf5.f:144)
==1654==    by 0xAA0578: lr_mod_m_mp_check_dt_ (LR_model.F:487)
==1654==    by 0xA8D059: lr_mod_m_mp_lr_step_ (LR_model.F:252)
==1654==    by 0xA8BF33: MAIN__ (LR_model.F:544)
==1654==    by 0x406E3D: main (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
client stack range: [0xFFEBFE000 0xFFF000FFF] client SP: 0xFFEC2CF88
valgrind stack top usage: 12312 of 1048576

(gdb) monitor v.info unwind 0x0000000000ae9c69
[0xae9c69 .. 0xae9c69]: let cfa=oldBP+16 in RA=*(cfa+-8) SP=cfa+0 BP=*(cfa+-16)
(gdb) monitor v.info unwind 0x0000000000ae58a4
[0xae58a4 .. 0xae58a4]: let cfa=oldBP+16 in RA=*(cfa+-8) SP=cfa+0 BP=*(cfa+-16)


Incorrect stacktrace:

Thread 1: status = VgTs_Runnable (lwpid 2047)
==2047==    at 0xFE9640: H5FL_reg_calloc (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==2047==    by 0xF7F3D9: H5A_create (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==2047==    by 0xF79500: H5Acreate2 (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==2047==    by 0xF682AD: h5acreate_c_ (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==2047==    by 0xF626A6: h5a_mp_h5acreate_f_ (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
==2047==    by 0xB99FC6: taehdf5_mp_h5append_data_double_0d_ (taehdf5.f90:1936)
==2047==    by 0xB248E6: plot_m_mp_plots_ (plot_hdf5.f:144)
==2047==    by 0xB3B722: lr_mod_m_mp_check_dt_ (LR_model.F:487)
==2047==    by 0xB272E3: lr_mod_m_mp_lr_step_ (LR_model.F:252)
==2047==    by 0xB261DD: MAIN__ (LR_model.F:544)
==2047==    by 0x406E3D: main (in 
/mnt/nfs-home/nrath/Q2D/LamyRidge/src/model/build/LR_model)
client stack range: [0xFFEBFE000 0xFFF000FFF] client SP: 0xFFEC2CFC8
valgrind stack top usage: 12312 of 1048576

(gdb) monitor v.info unwind 0xF626A6
[0xf626a6 .. 0xf626a6]: let cfa=oldSP+48 in RA=*(cfa+-8) SP=cfa+0 BP=Same
(gdb) monitor v.info unwind 0xB99FC6
[0xb99fc6 .. 0xb99fc6]: let cfa=oldBP+16 in RA=*(cfa+-8) SP=cfa+0 BP=*(cfa+-16)


> and/or by using objdump to look at the dwarf info.

I believe this is the relevant objdump output - but again I don't understand 
it. Does it tell you anything?

 <1><a8f8c>: Abbrev Number: 42 (DW_TAG_subprogram)
    <a8f8d>   DW_AT_decl_line   : 1916
    <a8f8f>   DW_AT_decl_file   : 1
    <a8f90>   DW_AT_declaration : 1
    <a8f91>   DW_AT_name        : (indirect string, offset: 0xa5fc): 
h5dump_attr_int
    <a8f95>   DW_AT_external    : 1
    <a8f96>   DW_AT_inline      : 1     (inlined)



Best,
-Nikolaus

------------------------------------------------------------------------------
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to