From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 D8B8F80387 for ; Wed, 22 Mar 2017 06:07:47 -0700 (PDT) Received: by mail-wm0-x22a.google.com with SMTP id 196so8633466wmm.1 for ; Wed, 22 Mar 2017 06:07:47 -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=35Vjv4HcnJOIB0A6JzdEG71oh8PpgIo0Y10WHeHlIQU=; b=kTHkDL2Y7GKXXYnY8lNHE1R9a6WxPLJ2FZ7WfOAXy4k7e56OvKzquzbS5ShJll6ISV CGqpEFjiRIxMPEOPPdau1pTmRHh7Eo7ZmhapVTtGhsltW2TT21PMurpSyikybM6sSUrq unUXKGCZOlyXwpQQyd4ZWdB7jEXeOhkMJq+KU= 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=35Vjv4HcnJOIB0A6JzdEG71oh8PpgIo0Y10WHeHlIQU=; b=tu1E7OpvoJPfcZfUlt60SjwAdF+Rwj+o+kjIDPxsWG7+aua3wTARO6Iv3TEvhU4Pz+ pfmy93OJ9QbhZkVkkDKih1zFPIcuGmOhz0rui+eMUsADPYP44zJKEn8vHLITPfrFwvr2 fTOvfqunhbJOE5ueINLbpQ30aoYcrLXTaOO0+FhLzAHiqTCRQwlFgKOxNDTf4W5y9YZa JYa6TNb2vwIqfcUDa8D85L9LpQM9VmXJVilDrIQhYAPpP82PAVLmHO1zY8wvwugPCkJi SC5NhexggOLjxOgfuaB7qo69zV0WFOQan05ZAQwV3ejoMumDfxuGNsDc1n+YCsKeNhk5 gFhA== X-Gm-Message-State: AFeK/H25g0wAqOKKYSgyU0Q6jmkCH1TjSccm09Dqlb3kiW6kjNy0bgZy6uCyFLnncRalf99x X-Received: by 10.28.113.24 with SMTP id m24mr7716857wmc.0.1490188066426; Wed, 22 Mar 2017 06:07:46 -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 s26sm1774780wra.66.2017.03.22.06.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 06:07:45 -0700 (PDT) Date: Wed, 22 Mar 2017 13:07:43 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, ryan.harkin@linaro.org, eugene@hp.com Message-ID: <20170322130743.GX16034@bivouac.eciton.net> References: <1490043181-20031-1-git-send-email-ard.biesheuvel@linaro.org> <1490043181-20031-3-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1490043181-20031-3-git-send-email-ard.biesheuvel@linaro.org> 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:07:48 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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? > + } 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 / Leif