From nobody Sat Nov 2 14:25:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490043200015707.6760654796909; Mon, 20 Mar 2017 13:53:20 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9E82780470; Mon, 20 Mar 2017 13:53:18 -0700 (PDT) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::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 A89788046A for ; Mon, 20 Mar 2017 13:53:17 -0700 (PDT) Received: by mail-wm0-x22d.google.com with SMTP id n11so73175448wma.1 for ; Mon, 20 Mar 2017 13:53:17 -0700 (PDT) Received: from localhost.localdomain (189.17.90.92.rev.sfr.net. [92.90.17.189]) by smtp.gmail.com with ESMTPSA id q1sm12184651wra.65.2017.03.20.13.53.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 13:53:15 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w3g/teTrWkA+/88ey9WiqKKZKrTmsEvZpb8mYLDCyis=; b=W3O5nAn/2yQHnoDoRDD8wv1xxgkbyQaBz/wlOacQ4loB09Q/BXATVKEDgGHAH1HhiW a8ECBKgNZVJ82vc3VnF+uoQvZTf86KqWcABf1znzfjqOHS5QfAvSYzQvnFS25g8gqv7S Vdvmm1gqGXR1+la4zihM3D3VYF8qIKXgWfGLE= 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; bh=w3g/teTrWkA+/88ey9WiqKKZKrTmsEvZpb8mYLDCyis=; b=VXSpuHTlaldF2ytZEqVSNhS1+euR23k7M3VFP7a1V/W7YjZzWy718nXpx2D9JVcIxn 5YuiyN672Ol437Ag5k6wVku0SuBrlNqpFc/EhguKdhPqh9fCkbtJ+V/aIl3OvcI9cvVQ 5inaVZxz+grfZM2yZhmVAHwLwyoHYiT/tIoDBhDL3EamNbB7H2xKbPj+3KqE8PTWLKDy liqTbpxPJ2JU1YlSr8G8eMvfFLmU/WybAUTIz0dvlZI5g6FtMtl3QqtZswWhQkjUQysH 5103pnL3x5jeS8LV/EHM0fBbFf4L6ke95XUp/DTs4WnXrCXhFeqshh3SueI0l6lNKh8P R2mw== X-Gm-Message-State: AFeK/H2CAlDutk+vDV16TrloZYLo20R6VyY0rs0Ws7vkO/IA+27u6cf725SjIF/UvBDpLZjW X-Received: by 10.28.7.13 with SMTP id 13mr11900176wmh.16.1490043196251; Mon, 20 Mar 2017 13:53:16 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Mon, 20 Mar 2017 20:53:00 +0000 Message-Id: <1490043181-20031-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490043181-20031-1-git-send-email-ard.biesheuvel@linaro.org> References: <1490043181-20031-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [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: , Cc: ryan.harkin@linaro.org, Ard Biesheuvel , eugene@hp.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Leif Lindholm --- ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.= c | 56 +++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExcep= tionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultEx= ceptionHandler.c index 2f9c2ede37c1..1024bf48c63d 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHan= dler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHan= dler.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.SystemContextAAr= ch64->ELR)); + } =20 - if ((UINT64 *)SystemContext.SystemContextAArch64->FP !=3D 0) { - Idx =3D 0; + if ((UINT64 *)SystemContext.SystemContextAArch64->FP !=3D 0) { + Idx =3D 0; =20 - RootFp[0] =3D ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0= ]; - RootFp[1] =3D ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1= ]; - if (RootFp[1] !=3D SystemContext.SystemContextAArch64->LR) { - RootFp[0] =3D SystemContext.SystemContextAArch64->FP; - RootFp[1] =3D SystemContext.SystemContextAArch64->LR; - } - for (Fp =3D RootFp; Fp[0] !=3D 0; Fp =3D (UINT64 *)Fp[0]) { - Pdb =3D GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); - if (Pdb !=3D NULL) { - if (Pdb !=3D PrevPdb) { - Idx++; - PrevPdb =3D 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] =3D ((UINT64 *)SystemContext.SystemContextAArch64->FP)[0]; + RootFp[1] =3D ((UINT64 *)SystemContext.SystemContextAArch64->FP)[1]; + if (RootFp[1] !=3D SystemContext.SystemContextAArch64->LR) { + RootFp[0] =3D SystemContext.SystemContextAArch64->FP; + RootFp[1] =3D SystemContext.SystemContextAArch64->LR; + } + for (Fp =3D RootFp; Fp[0] !=3D 0; Fp =3D (UINT64 *)Fp[0]) { + Pdb =3D GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); + if (Pdb !=3D NULL) { + if (Pdb !=3D PrevPdb) { + Idx++; + PrevPdb =3D Pdb; } + DEBUG ((EFI_D_ERROR, "PC 0x%012lx (0x%012lx+0x%08x) [% 2d] %a\n", + Fp[1], ImageBase, Fp[1] - ImageBase, Idx, BaseName (Pdb))); + } else { + DEBUG ((EFI_D_ERROR, "PC 0x%012lx\n", Fp[1])); } - PrevPdb =3D Pdb =3D GetImageName (SystemContext.SystemContextAArch= 64->ELR, &ImageBase, &PeCoffSizeOfHeader); + } + PrevPdb =3D Pdb =3D GetImageName (SystemContext.SystemContextAArch64= ->ELR, &ImageBase, &PeCoffSizeOfHeader); + if (Pdb !=3D NULL) { DEBUG ((EFI_D_ERROR, "\n[ 0] %a\n", Pdb)); + } =20 - Idx =3D 0; - for (Fp =3D RootFp; Fp[0] !=3D 0; Fp =3D (UINT64 *)Fp[0]) { - Pdb =3D GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); - if (Pdb !=3D NULL && Pdb !=3D PrevPdb) { - DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb)); - PrevPdb =3D Pdb; - } + Idx =3D 0; + for (Fp =3D RootFp; Fp[0] !=3D 0; Fp =3D (UINT64 *)Fp[0]) { + Pdb =3D GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); + if (Pdb !=3D NULL && Pdb !=3D PrevPdb) { + DEBUG ((EFI_D_ERROR, "[% 2d] %a\n", ++Idx, Pdb)); + PrevPdb =3D Pdb; } } } --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel