From patchwork Fri Sep 9 07:35:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 75845 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp210775qgf; Fri, 9 Sep 2016 00:35:32 -0700 (PDT) X-Received: by 10.98.68.148 with SMTP id m20mr4109117pfi.0.1473406532895; Fri, 09 Sep 2016 00:35:32 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id m63si2632339pfb.137.2016.09.09.00.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Sep 2016 00:35:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 603FC1A1E4C; Fri, 9 Sep 2016 00:35:32 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 A67921A1DFE for ; Fri, 9 Sep 2016 00:35:30 -0700 (PDT) Received: by mail-wm0-x232.google.com with SMTP id b187so16058962wme.1 for ; Fri, 09 Sep 2016 00:35:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yNVz83sxNO6nUSuaxaVzCPh2Pg78V+HIkejIzdakW3c=; b=FOA0KDdJFZrIYm+dyD+mRpHgf+PXERtPXq8ukcHdPBA1KntEiMQhB3qAqnjki6Mh/z 8z3/3XZqKpImPC1q1mqx4ND5x8cK+N4jReRaWt32oky48OAFAjF4tfh5+JVvEASgqEqM pQFCiPlYXIa6ku3jcAO/yvNTSakvP3oBxUBbE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yNVz83sxNO6nUSuaxaVzCPh2Pg78V+HIkejIzdakW3c=; b=Kms+cVRYLIOoQxwOGkAxrJ208OI99UvpFkjdSj6t7sDSrZKYcDNRtgNa75RTVrlsAo qRW9KwcPeRJDyu7AVbMJeGXGlae7yfs9gh/wS0C0tQ93esQDb6Ol2leQNRv8vpTf4OEp 4gtE9RjlmyKERhuKbFdgvA0EWQ9FK6TCqTbheouquHfpTmRaCsFocW/LM9IVPxP0uTvT gJtv8DmYPiuUtVR9xMskpq3FwB47YF07wQUq+HTwTwazAInT/bgTOWDt6A2ba4byuH/z TafkLXTENPifW+tvKOzunMIvdrNOoQF0IJ5A5ayI9vdT3QT+BOdPvrbWIerFObTg6H6S kSzQ== X-Gm-Message-State: AE9vXwPZ+CsAXdi4dfIq3I0HHZqV3xiubedsrXV7BFnvH/E9PynpMMPofT72EhTQwdzyRAzY X-Received: by 10.194.240.39 with SMTP id vx7mr1688190wjc.38.1473406529283; Fri, 09 Sep 2016 00:35:29 -0700 (PDT) Received: from localhost.localdomain ([197.253.238.91]) by smtp.gmail.com with ESMTPSA id bc5sm1959729wjb.37.2016.09.09.00.35.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Sep 2016 00:35:28 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Fri, 9 Sep 2016 08:35:21 +0100 Message-Id: <1473406521-6216-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] ArmPkg/DefaultExceptionHandlerLib: trim module name in backtrace output X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: vishalo@qti.qualcomm.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" As reported by Vishal, the new backtrace output would be more useful if it did not contain the full absolute path of each module in the list. So strip off everything up to the last forward slash or backslash in the string. Example output: IRQ Exception at 0x000000005EF110E0 DxeCore.dll loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EF121F0) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EF1289C) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEFB6B4) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEFAA44) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEFB450) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEF938C) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEF8D04) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEFA8E8) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEF3C14) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEF3E48) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EF0C838) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEEF70C) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEEE93C) loaded at 0x000000005EEED000 called from DxeCore.dll (0x000000005EEEE024) loaded at 0x000000005EEED000 Suggested-by: "Oliyil Kunnil, Vishal" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c | 24 +++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c index 84b442f2b6f4..177231dbdb97 100644 --- a/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c @@ -119,6 +119,24 @@ DescribeExceptionSyndrome ( DEBUG ((EFI_D_ERROR, "\n %a \n", Message)); } +STATIC +CONST CHAR8 * +BaseName ( + IN CONST CHAR8 *FullName + ) +{ + CONST CHAR8 *Str; + + Str = FullName + AsciiStrLen (FullName); + + while (--Str > FullName) { + if (*Str == '/' || *Str == '\\') { + return Str + 1; + } + } + return Str; +} + /** This is the default action to take on an unexpected exception @@ -156,13 +174,13 @@ DefaultExceptionHandler ( Pdb = GetImageName (SystemContext.SystemContextAArch64->ELR, &ImageBase, &PeCoffSizeOfHeader); if (Pdb != NULL) { - DEBUG ((EFI_D_ERROR, "%a loaded at 0x%016lx \n", Pdb, ImageBase)); + DEBUG ((EFI_D_ERROR, "%a loaded at 0x%016lx \n", BaseName (Pdb), ImageBase)); Pdb = GetImageName (SystemContext.SystemContextAArch64->LR, &ImageBase, &PeCoffSizeOfHeader); if (Pdb != NULL) { DEBUG ((EFI_D_ERROR, "called from %a (0x%016lx) loaded at 0x%016lx \n", - Pdb, SystemContext.SystemContextAArch64->LR, ImageBase)); + BaseName (Pdb), SystemContext.SystemContextAArch64->LR, ImageBase)); } for (Fp = (UINT64 *)SystemContext.SystemContextAArch64->FP; *Fp != 0; @@ -173,7 +191,7 @@ DefaultExceptionHandler ( Pdb = GetImageName (Fp[1], &ImageBase, &PeCoffSizeOfHeader); if (Pdb != NULL) { DEBUG ((EFI_D_ERROR, "called from %a (0x%016lx) loaded at 0x%016lx \n", - Pdb, Fp[1], ImageBase)); + BaseName (Pdb), Fp[1], ImageBase)); } } }