From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 32FF61A1E13 for ; Fri, 9 Sep 2016 04:26:27 -0700 (PDT) Received: by mail-wm0-x236.google.com with SMTP id 1so27190862wmz.1 for ; Fri, 09 Sep 2016 04:26:27 -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=7UrPECiJrwtGCTDIJkww8Echldh9EDQqca0Xd3srV4o=; b=WItWqWLHFfaQMXnvNNIHTD6nEcPD57HsLyq+joRjE3KbYonSYXu15pzRlDg5XlI6fp RkT0Hb1iGYH2l2BzXIJvv0JrL6dRCOQm1uEg7NP8WXJSzxDsjuZl1HCBwmrr03FdNSF3 JG4WmI+2yig7JDz0lCmyYh4LokJcCSiA6AeVo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7UrPECiJrwtGCTDIJkww8Echldh9EDQqca0Xd3srV4o=; b=M56Td0lZC+jXtYp+HajzH/dmLxvcIgCoyfLGdKcF9mowJNC1++pbjWDKKn7PTUURS1 CWaiZsk9sNTAek0PayKDOfVpsTjaQ9ws6w6ePSqTxyut8fTcUrjHdIsGOesKwhsFyoiG RXpJG3uWI4YNsaDyV0XzQZ9XUe1O2PG4XADIEPju0HEMmYcnsR+oEizpP5iq8QuskIyp Tsb9L0q//0qNePEXEPWNPTDfVf3tA5apS8w26iWJC/ZT01sgZgQI9JEmzKW2a9tBp8VE GUJjh3zMurjkfjIKmriq8EojXUWPEKQmywsc2NJxkYvR1SjTNfJnJNFMmyGZUcK3mATQ lktg== X-Gm-Message-State: AE9vXwP4Gd7Xavgn5KzYJ12y+PncXgkMzonIsxjMMcjIzmhncJmWOLIQeJ3nO39tvx59lNlS X-Received: by 10.28.57.4 with SMTP id g4mr2353186wma.75.1473420385730; Fri, 09 Sep 2016 04:26:25 -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 t202sm2859102wmt.22.2016.09.09.04.26.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Sep 2016 04:26:25 -0700 (PDT) Date: Fri, 9 Sep 2016 12:26:23 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, vishalo@qti.qualcomm.com Message-ID: <20160909112623.GN16080@bivouac.eciton.net> References: <1473406521-6216-1-git-send-email-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <1473406521-6216-1-git-send-email-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [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: , X-List-Received-Date: Fri, 09 Sep 2016 11:26:27 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Sep 09, 2016 at 08:35:21AM +0100, Ard Biesheuvel wrote: > 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 Yes, that is cleaner. Reviewed-by: Leif Lindholm > --- > ArmPkg/Library/DefaultExceptionHandlerLib/AArch64/DefaultExceptionHandler.c | 24 +++++++++++++++++--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > 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)); > } > } > } > -- > 2.7.4 >