From: Sean Anderson Date: Sun, 2 May 2021 22:55:15 -0400 Subject: [PATCH 3/4] doc: sandbox: Document how to run sandbox with valgrind In-Reply-To: <20210503025516.1931890-1-seanga2@gmail.com> References: <20210503025516.1931890-1-seanga2@gmail.com> Message-ID: <20210503025516.1931890-4-seanga2@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This documents how to get more detailed results from valgrind made possible by the last two commits. Signed-off-by: Sean Anderson --- doc/arch/sandbox.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst index e052b6bdb0..9bc4fec5fe 100644 --- a/doc/arch/sandbox.rst +++ b/doc/arch/sandbox.rst @@ -481,14 +481,20 @@ Using valgrind / memcheck It is possible to run U-Boot under valgrind to check memory allocations:: - valgrind u-boot + valgrind ./u-boot + +For more detailed results, enable `CONFIG_VALGRIND`. There are many false +positives due to `malloc` itself. Suppress these with:: + + valgrind --suppressions=scripts/u-boot.supp ./u-boot If you are running sandbox SPL or TPL, then valgrind will not by default notice when U-Boot jumps from TPL to SPL, or from SPL to U-Boot proper. To -fix this, use:: - - valgrind --trace-children=yes u-boot +fix this, use `--trace-children=yes`. To show who alloc'd some troublesome +memory, use `--track-origins=yes`. To uncover possible errors, try running all +unit tests with:: + valgrind --track-origins=yes --suppressions=scripts/u-boot.supp ./u-boot -Tc 'ut all' Testing ------- -- 2.31.0