From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by mx.groups.io with SMTP id smtpd.web11.10316.1686148477893794939 for ; Wed, 07 Jun 2023 07:34:38 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=ObapGEmB; spf=pass (domain: gmail.com, ip: 209.85.208.46, mailfrom: xzavierpower@gmail.com) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5169f920a9dso1117472a12.0 for ; Wed, 07 Jun 2023 07:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686148476; x=1688740476; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=dxkI60Zl67om3E2TDxOXvX6Ev+HrIiyiobD8Nfn3d2M=; b=ObapGEmBFZm3+F4Fur/iDgWzrZk5+wcxdqWr6EP4Yz/qEeL3Q/YzmGQ/wPXguzl2vH 5+HtGySzW8Mlv67m9HWrID2BMs410KKgGiowPAqj2HswgxFjP6xifD5UWIF5JupRJ6G4 zXKO8bZF82Jl0zwG9BzuYlaVaHJNAanFEZEbp71NquBdRw9NS7pJa6A6C+bJM3sNKaqj AnPbFiptM039pj299icTbK5Vgn6etWVKjtyzI5KTBi0lowVo6EEimoacBQhFAWvcVhtU 2Cr6PwqSn2b/FYRAWRpRFcjdEl3wmOfRCO1r0NBhCwLoE/zmHnv8/y0Zh41NR6R6YExQ Noog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686148476; x=1688740476; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dxkI60Zl67om3E2TDxOXvX6Ev+HrIiyiobD8Nfn3d2M=; b=Qs2MBdfmMdFzbSn1P3FQ1K3gePx/JoY4mRPW38cYUlvasIyTs3HXcGtRgJP96st1N3 5fKZl3m0Ek8Y1uuYUJhHxceiaQAHuklvutCssPszcTSghDGPAyJB8T+YdQHDzanLNYL6 4gtAZLnP0nKCPiwjvdKWelP2N9RPeq55z19lYJgw4XKDHFoFJg+qai/BP9A9pHu6ZViV K7lppGRh3DJwTWPtANLML9KPA7FXVmXClnOtIFzq7daHDRweqty3H3VwMTc5ify9H2ly 1iE891FiadYus/c8z5RKJZdEnkW5HonCqApFlfTZIQhHq1s1ZNiNR6ZB5GoXMa76Q2XK YS3Q== X-Gm-Message-State: AC+VfDz++aLsXNanXoIv+XNfKz9D9wW3CtjBkxVYttK44zX2Vu8COwEt bUjX9s995bKrtusTUiI8RmkaDbuajQH3wkPIZiCF4hS+b5TyHQ== X-Google-Smtp-Source: ACHHUZ72Rvt5jdgBDiRjwJBT6iZc0nx+wq36NSmohgGa4DNbnKuqAZUdm6+dqWx3oeatO/uwKzWpXqkb+HGjiDWkVOM= X-Received: by 2002:aa7:cd16:0:b0:50b:c456:a72a with SMTP id b22-20020aa7cd16000000b0050bc456a72amr5813495edw.19.1686148475712; Wed, 07 Jun 2023 07:34:35 -0700 (PDT) MIME-Version: 1.0 From: "M.T." Date: Wed, 7 Jun 2023 10:34:24 -0400 Message-ID: Subject: enable MemoryProfile for uefi shell app To: edk2-devel-groups-io Content-Type: multipart/alternative; boundary="000000000000eefa6d05fd8b08ff" --000000000000eefa6d05fd8b08ff Content-Type: text/plain; charset="UTF-8" Hello group I'm looking for some help with MemoryProfile to catch some memory leaks in a custom uefi application. I followed the instructions found on: https://github.com/tianocore/tianocore.github.io/wiki/Memory-leak-detection-with-memory-profile-feature However I can't seem to get this to work, let me paint a more complete picture. My uefi app is standalone, it is not a part of any other package and has its own .dsc file and this is where I make all the changes to enable Memory Profiler. The memory I want to watch for is UEFI_APPLICATION, any calls to Allocate* functions to make sure everything has been freed accordingly, I suspect it has not hence the leak. So my debug build has the following Libs: MemoryAllocationLib|MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf MemoryProfileLib|MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf PCDs are set like this: gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask|0x1 gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType|0x60 gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileDriverPath|{0x04, 0x06, 0x14, 0x00, 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1, 0x7F, 0xFF, 0x04, 0x00} In Components I added: MdeModulePkg/Application/MemoryProfileInfo/MemoryProfileInfo.inf This also required that I add DxeServiceLib Everything builds without issues, my app runs as expected, however when I try to run MemoryProfileInfo.efi, I only get the following: UefiMemoryProfile: Locate MemoryProfile protocol - Not Found GetUefiMemoryProfileData - Not Found SmramProfile: Locate SmmCommunication protocol - Not Found GetSmramProfileData - Not Found Couple of questions about this: Is MemoryProfileInfo.efi supposed to be run after my app exits? Or is it more like a wrapper for my app (ie. valgrind)? The errors seem to indicate that the libs are still missing, are they supposed to be linked into the OVMF image as well perhaps, or anywhere else aside for my app? Appreciate any help, debugging third party libs has become a major headache and I hope memoryProfiler can help with this. Cheers mt --000000000000eefa6d05fd8b08ff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello group

I'm looking for some he= lp with MemoryProfile to catch some memory leaks in a custom uefi applicati= on.

I followed the instructions found on:=C2=A0https://github.com/tianocore/tianocor= e.github.io/wiki/Memory-leak-detection-with-memory-profile-feature

However I can't seem to get this to work, let me p= aint a more complete picture.

My uefi app is stand= alone, it is not a part of any other package and has its own .dsc file and = this is where I make=C2=A0all the changes to enable Memory Profiler.
<= div>The memory I want to watch for is UEFI_APPLICATION, any calls to Alloca= te* functions to make sure everything has been freed accordingly, I suspect= it has not hence the leak.

So my debug build has = the following Libs:
MemoryAllocationLib|MdeModulePkg/Library/Uefi= MemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf
MemoryProf= ileLib|MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAlloca= tionProfileLib.inf

PCDs are set like this:
gEfiMdeMod= ulePkgTokenSpaceGuid.PcdMemoryProfilePropertyMask|0x1
gEfiMdeModulePkgTokenSpaceGuid.PcdMemoryProfileMemoryType|0x60=
gEfiMdeModulePkgTokenSpaceGuid.PcdMemory= ProfileDriverPath|{0x04, 0x06, 0x14, 0x00, =C2=A00x83, 0xA5, 0x04, 0x7C, 0x= 3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1, 0x7F,= 0xFF, 0x04, 0x00}

In Components I added:
= MdeModulePkg/Application/Memor= yProfileInfo/MemoryProfileInfo.inf

This also required that I add DxeServi= ceLib

Everything builds without issues, my app runs as expected, however w= hen I try to run
MemoryProfileInfo.efi, I only get the following:
UefiMemoryProfile: Locate MemoryProfile protocol - Not Fo= und
GetUefiMemoryProfileData - Not Found
SmramProfile: Locate SmmComm= unication protocol - Not Found
GetSmramProfileData - Not Found

Couple of questions about this:
Is = MemoryProfileInfo.efi supposed to be run after my app exits?
Or is it more like a wrapper for my app (ie. valgrind)?

The errors seem to indicate that the lib= s are still missing, are they supposed
to be linked in= to the OVMF image as well perhaps, or anywhere else aside for my app?
=

Appreciate any help, debugging th= ird party libs has become a major headache and I hope
= memoryProfiler can help with this.

Cheers
mt

--000000000000eefa6d05fd8b08ff--