From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 865B7803B1 for ; Wed, 22 Mar 2017 06:20:23 -0700 (PDT) Received: by mail-wr0-x22d.google.com with SMTP id l37so129702138wrc.1 for ; Wed, 22 Mar 2017 06:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=LAM9h47nO+iLRIRHG7MiMELGtG2aLAcTk76sQbVNGUE=; b=VoCfTpFa6sXIz43BsuKqEnwAtlD0hCfnro1LvCyBqUaqtVWFf/sBAtyKQhhVMkxvkR QNL7Z3QgSnvR//Eb+4tWEyWc3OqypYgoCU0dfx3MxZezYXqEHIf9novOW1dZbM/9FHMk u8J/zPXUxlRfczEwze7LZWb5G1anEpPDQOJYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=LAM9h47nO+iLRIRHG7MiMELGtG2aLAcTk76sQbVNGUE=; b=CQRdkH7Ps95KBbS7ht5SrJ4CkLS8azCmz0ugmxjc5yQLcWvra0+QLdREpuhQcKjtqX uayNFEjfOMTKGZ33pfndNAA6etQFiOKxvf5dlVsRTri9pIXf00BDIN9W45fvZuxoHW+P BU7LdqAg8UK2QYXDJ4YcVf7A/WjMht/uUVVxLq8zN5Xp3wmQeYxzzsG9bCXR9CJNw0HC RS6L8617UQgYiYJJ+79yvDuRip275C1CuQ2kVrsSHONdtAkPyd3GLeu7OqWCQG9Zs3QE VVf+mDRoqciyYU1sSZkN0uXQbVsfpW3AxdxDiet4WhNATO9nyJMUttfG6LpR0xB5GWnY i/tw== X-Gm-Message-State: AFeK/H0AKPwZ8h8X2nIBBiDNmvHARV+YRNafUOEk61b0UARVYIvwfAs+a6L7XwWdfEDOHu31 X-Received: by 10.223.179.90 with SMTP id k26mr13465320wrd.139.1490188822083; Wed, 22 Mar 2017 06:20:22 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id h16sm1841974wrc.5.2017.03.22.06.20.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 06:20:21 -0700 (PDT) Date: Wed, 22 Mar 2017 13:20:19 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , Ryan Harkin , "Cohen, Eugene" Message-ID: <20170322132019.GZ16034@bivouac.eciton.net> References: <1490043181-20031-1-git-send-email-ard.biesheuvel@linaro.org> <1490043181-20031-3-git-send-email-ard.biesheuvel@linaro.org> <20170322130743.GX16034@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH 2/3] ArmPkg/DefaultExceptionHandlerLib: walk call stack unconditionally X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2017 13:20:24 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Mar 22, 2017 at 01:12:59PM +0000, Ard Biesheuvel wrote: > On 22 March 2017 at 13:07, Leif Lindholm wrote: > > On Mon, Mar 20, 2017 at 08:53:00PM +0000, Ard Biesheuvel wrote: > >> Currently, we only attempt to walk the call stack and print a backtrace > >> if the program counter refers to a location covered by a PE/COFF image. > >> However, regardless of the value of PC, the frame pointer may still have > >> a meaningful value, and so we can still produce the remainder of the > >> backtrace. > >> > >> Contributed-under: TianoCore Contribution Agreement 1.0 > >> Signed-off-by: Ard Biesheuvel > >> --- > >> ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c | 56 +++++++++++--------- > >> 1 file changed, 31 insertions(+), 25 deletions(-) > >> > >> diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c > >> index 2f9c2ede37c1..1024bf48c63d 100644 > >> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c > >> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c > >> @@ -181,37 +181,43 @@ DefaultExceptionHandler ( > >> DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [ 0] %a\n", > >> SystemContext.SystemContextAArch64->ELR, ImageBase, > >> SystemContext.SystemContextAArch64->ELR - ImageBase, BaseName (Pdb))); > >> + } else { > >> + DEBUG ((EFI_D_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR)); > >> + } > >> > > > > come_from: > > > >> - if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) { > >> - Idx = 0; > >> + if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) { > >> + Idx = 0; > >> > >> - RootFp[0] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0]; > >> - RootFp[1] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1]; > >> - if (RootFp[1] != SystemContext.SystemContextAArch64->LR) { > >> - RootFp[0] = SystemContext.SystemContextAArch64->FP; > >> - RootFp[1] = SystemContext.SystemContextAArch64->LR; > >> - } > >> - for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) { > >> - Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); > >> - if (Pdb != NULL) { > >> - if (Pdb != PrevPdb) { > >> - Idx++; > >> - PrevPdb = Pdb; > >> - } > >> - DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n", > >> - Fp[1], ImageBase, Fp[1] - ImageBase, Idx, BaseName (Pdb))); > >> + RootFp[0] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0]; > >> + RootFp[1] = ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1]; > >> + if (RootFp[1] != SystemContext.SystemContextAArch64->LR) { > >> + RootFp[0] = SystemContext.SystemContextAArch64->FP; > >> + RootFp[1] = SystemContext.SystemContextAArch64->LR; > >> + } > >> + for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) { > >> + Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); > >> + if (Pdb != NULL) { > >> + if (Pdb != PrevPdb) { > >> + Idx++; > >> + PrevPdb = Pdb; > >> } > >> + DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n", > >> + Fp[1], ImageBase, Fp[1] - ImageBase, Idx, BaseName (Pdb))); > > > > Diff's a bit iffy, but can you confirm there is no functional change > > between come_from and here? Just the indentation shuffle? > > > > Yes. diff -w output is here http://pastebin.com/gRmeeipp Thanks - that's a tad more readable :) > >> + } else { > >> + DEBUG ((EFI_D_ERROR, "PC 0x%012lx\n", Fp[1])); > >> } > >> - PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader); > >> + } > >> + PrevPdb = Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader); > >> + if (Pdb != NULL) { > >> DEBUG ((EFI_D_ERROR, "\n[ 0] %a\n", Pdb)); > >> + } > >> > >> - Idx = 0; > >> - for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) { > >> - Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); > >> - if (Pdb != NULL && Pdb != PrevPdb) { > >> - DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb)); > >> - PrevPdb = Pdb; > >> - } > >> + Idx = 0; > >> + for (Fp = RootFp; Fp[0] != 0; Fp = (UINT64 *)Fp[0]) { > >> + Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); > >> + if (Pdb != NULL && Pdb != PrevPdb) { > >> + DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb)); > >> + PrevPdb = Pdb; > >> } > >> } > >> } > >> -- > >> 2.7.4 > >> > > > > If so: > > Reviewed-by: Leif Lindholm > > > > Thanks