help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using valgrind on a loadable builtin


From: Robert E. Griffith
Subject: Re: using valgrind on a loadable builtin
Date: Wed, 25 May 2022 21:52:04 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1

Oh! That makes sense now. Thanks. I was inspecting the memory and was confused that it did not seem to use the same chunk structure of the glibc malloc.

--BobG

On 5/25/22 18:19, Eduardo Bustamante wrote:
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]