Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 8 Jul 2014 21:39:47 -0700
From: Isaac Dunham <>
Subject: Attempting to debug C++ library and command via valgrind

I've been trying to get Sword 1.7.3 ( running on Alpine.
Sword is a library for free bible software that comes with a few utilities.
It builds fine and runs with few issues, but I'm having a bit of trouble figuring out one of the bugs:
valgrind was recommended, but I can't get valgrind to run the command properly.
I was asked to provide the output of roughly this command (adjusting for
Windows/*nix differences):
valgrind --leak-check=full --track-origins=yes \
  --keep-stacktraces=alloc-and-free \
  utilities/diatheke/.libs/diatheke  -b KJV -k Ps117

But when I do this, diatheke errors out:
$ valgrind --leak-check=full --track-origins=yes --keep-stacktraces=all
oc-and-free diatheke  -b KJV -k Ps117
==5743== Memcheck, a memory error detector
==5743== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==5743== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==5743== Command: diatheke -b KJV -k Ps117
diatheke: cannot load -b: No such file or directory
==5743== HEAP SUMMARY:
==5743==     in use at exit: 0 bytes in 0 blocks
==5743==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==5743== All heap blocks were freed -- no leaks are possible
==5743== For counts of detected and suppressed errors, rerun with: -v
==5743== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Comparing this to the default output below, my guess is that the command line parsing is not happening when run from valgind.

The bug I'm trying to track down (background):
diatheke is a utility that comes with Sword that shows all verses or passages in a bible or book that match a key (such as a reference);
the basic command line looks like this:
diatheke -b book -k reference

The bug is that the last passage/verse gets repeated:
$ diatheke  -b KJV -k Ps117
Psalms 117:1: O praise the LORD, all ye nations: praise him, all ye people.
Psalms 117:2: For his merciful kindness is great toward us: and the truth of the LORD endureth for ever. Praise ye the LORD. 
: For his merciful kindness is great toward us: and the truth of the LORD endureth for ever. Praise ye the LORD. 

Currently running Alpine edge with linux-vanilla as kernel.
All binaries are built using abuild; the system CFLAGS were "-Os -pipe -fomit-frame-pointer", but the package adds "-O3".
I got the same results after changing CFLAGS in abuild.comf to "-g -pipe".

If the build scripts are desired, I can supply them.

Isaac Dunham

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.