From patchwork Wed May 5 20:08:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1474558 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=jJLAM/6R; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Fb78b6d8yz9sRf for ; Thu, 6 May 2021 06:09:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0AB0482CA6; Wed, 5 May 2021 22:08:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="jJLAM/6R"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CB19282CB2; Wed, 5 May 2021 22:08:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 58CA582CA5 for ; Wed, 5 May 2021 22:08:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qk1-x734.google.com with SMTP id q127so2860060qkb.1 for ; Wed, 05 May 2021 13:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IQNpLipMURYWGTc2S+XvSIQZbB0Wpra/ep/jQc+gBIg=; b=jJLAM/6RzLMcHaft0kl28Dj8XUmQ9ZSenQFWShPxYWifcBb6xsyVof9+fWZMfjsA4h i03aPFVUVjmFiovNDZjh1fL2OX23kJwfValUA9fFL/6Gu2BIbzmoky6nz06IIsGiRB2L x7XjqxlRALkJk3qBlAwQZkzNP+L0r6EvgDEGzAjBKcbl3TbPdPUHEUElD0PrRLJXGhtp Hyk4RYgDnklHzB3oQbnjUgMkRd6UOiy1L+PwYBLupWfhY7zmhYRQv2Nw9FNQIbwGpHyF MwJM0qgrRpFPTuBkmdrzEKwu2P5Sv+mJXf3eu5x0kX/j5WV//2D3F8lkm5xbq2nCIMM/ jFKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IQNpLipMURYWGTc2S+XvSIQZbB0Wpra/ep/jQc+gBIg=; b=JnEuhoUFTPrvxN6Qio3VD+ZlyP4rtKuQiypjYcWBxuA1Qb/w76L5RfIX/4QYthI3PI eND7QO6e/i0Hbn4OwMwbU21d5Z4VWmyh120ddi6nsAt5fMAEKNc/6e/iUps4E2l6JSBS tZSanWDPU9snxH8BeCbMRwUShRXkHZzbjOXltej8c/CUx1Ekb5VX9mXSf/KGi9KEIrlI EgbhvPxqZsvSZZI3gBtjnwEpQWRdFIX2JePHCWmNxK+4Pj/iMEfxaMgtMgIwgiGKWbXm A/X8T/8HNzaRoPbCmYQvFSIMtEHLnRMf1a+u/SkyXbCn+H8BCAkje2pMoDL7m4gI7IQU q/hQ== X-Gm-Message-State: AOAM530D7LTD+hInCZxXL/VpuSnfowa9sxYs7Lg8kRp2Wtu+kF/Uukio cKpLI1IxuGkTR4qpf77P/7U= X-Google-Smtp-Source: ABdhPJxiT7hIF6dmeLKHviQ7TX4+mRw4FwLSbmKwVTwskHOYbnK+8fI2neEAjV66FQ9xm+FU+SL75g== X-Received: by 2002:a37:9c50:: with SMTP id f77mr485555qke.107.1620245329328; Wed, 05 May 2021 13:08:49 -0700 (PDT) Received: from godwin.fios-router.home (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.gmail.com with ESMTPSA id c23sm256437qtm.46.2021.05.05.13.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 13:08:49 -0700 (PDT) From: Sean Anderson To: Tom Rini , u-boot@lists.denx.de Cc: Simon Glass , Heinrich Schuchardt , Sean Anderson Subject: [PATCH v2 3/3] doc: sandbox: Document how to run sandbox with valgrind Date: Wed, 5 May 2021 16:08:20 -0400 Message-Id: <20210505200821.2104070-4-seanga2@gmail.com> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210505200821.2104070-1-seanga2@gmail.com> References: <20210505200821.2104070-1-seanga2@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This documents how to get more detailed results from valgrind made possible by the last two commits. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- (no changes since v1) 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 -------