[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: using valgrind on a loadable builtin
From: |
Eduardo Bustamante |
Subject: |
Re: using valgrind on a loadable builtin |
Date: |
Wed, 25 May 2022 15:19:08 -0700 |
On Wed, May 25, 2022 at 10:44 AM Robert E. Griffith <bobg@junga.com> wrote:
> I am trying to to use valgrind memcheck on my loadable builtin which is
> getting a "corrupted size vs. prev_size" error but its output is
> suspiciously clean and when I use the -v (verbose) switch I do not see
> any msg about my builtin's .so being loaded even though I do see
> confirmation that the builtin gets loaded and ran in the output. So I
> suspect that it is not monitoring my .so.
>
> I am running it like...
>
> valgrind -v ../../bashParse/bash -c 'bg-dev tests run bg_objects.sh:'
>
> The script enables my builtin.
>
> bash and my builtin are being built with -g and no -O<n>
>
> Anyone have any tips on getting meaningful output from valgrind for a
> loadable builtin?
>
Bash provides its own (lib/malloc/) malloc implementation. When building
bash, you can provide --without-bash-malloc to the configure script to
instead link against the libc malloc. You can search for see
opt_bash_malloc in "configure", or the USING_BASH_MALLOC macro.
You can review these files to see how it's all hooked
up: builtins.h, general.h, xmalloc.h
Valgrind is not capable of tracing the malloc that Bash provides.