public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: Pete Batard <pete@akeo.ie>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH 0/2] MdeModulePkg/EbcDxe: add EBC Debugger
Date: Sat, 12 Nov 2016 07:48:28 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C50386CF9E0@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <d4472a96-3339-5aa3-c7eb-7dfa0014079d@akeo.ie>

HI Pete
I am glad that you like it. :)

I met some problem on extracting patch from email. So I reviewed the code in https://github.com/pbatard/EbcDebugger and I assume they are same.

However, the master contains some non-EBC-debugger related code.
The edk2-diff branch contains an old version of EBC driver code.

Next time, would you please post your V2 patches to a new branch, help me do the review efficiently?

Now I only checked the diff file. Here is some suggestion for your consideration:

1)      EFI_DEBUGGER_CONFIGURATION_PROTOCOL
Previously, we document a way to consume this protocol. In user manual:
https://sourceforge.net/projects/efidevkit/files/Documents/EBC%20Debugger%20User%20Manual.pdf/download
Appendix A. Configuring the EBC Debugger under EFI Shell.

But I cannot find the EbcDebuggerConfig application in EDKI. It brings you some confusing because you think no one is consuming this protocol.

So I post a EDK-I style APPLICATION to my personal git-hub - https://github.com/jyao1/EbcDebuggerApp
You can take a look. It is also BDS license code.

In order to make feature complete and match the user manual, I think we can:
1.A) Add DebuggerConfiguration.h to MdeModulePkg/Include/Protocol.
1.B) Keep EFI_DEBUGGER_CONFIGURATION_PROTOCOL in Ebc driver.
1.C) Port EbcDebuggerApp to EDKII and add it to MdeModulePkg/Application dir. Care need to be taken that EbcDebuggerApp should not depend on ShellPkg, the ARGC and ARGV can be got from SHELL_PARAMETERS_PROTOCOL.
1.D) I found the APP need EdbCommon.h to enable/disable debug , so I think we need expose some fields to the debug configuration protocol, such as:
  UINT32                                      EfiDebuggerRevision;
  UINT32                                      EbcVmRevision;
  UINT32                                      FeatureFlags;




2)      The code in EbdDebugger\*
I compare them with the previous one. Looks good to me.




3)      The update for original EbdDxe driver.
3.1) EFI_EBC_DEBUGGER_CODE()
Yes, I have similar thought as Mike.
In EDK-I, we do not have good infrastructure to enable/disable features. Using MACRO is the only choice.
In EDK-II, MACRO is not encouraged because it cannot cover build.
We may consider 2 options:
3.1.1) Use PCD - such as PcdEbcDebuggerEnable.
Then we can put all EbdDebugger related feature into this PCD.
This is an easy way, but it causes debugger code build every time.
As summary, we can:
3.1.1.A) Add a FeaturePcd:PcdEbcDebuggerEnable to MdeModulePkg.dec, and use this FeaturePcd to replace EFI_EBC_DEBUGGER_CODE.

3.1.2) Use Library - such EbcDebuggerLib.
The API in this library class is similar to the function in EbcDebuggerHook.h.
We can provide 2 instances: one is EbcDebuggerLib - real function one. The other is EbdDebuggerLibNull - null function one. The latter can be used by default to bring minimal build impact.

Personally, my preference is 3.1.2) because it can make code clean and align with our other debugger feature.
I found EbcDebugger code is using the OPCODE defined in EbcExecute.h. Maybe a better way is to move this UEFI specification define OPCODE to MdePkg Ebc.h. So that the EbcDebugger code does not need depend on EbcDriver.
As summary, we can:
3.1.2.A) Move UEFI specification defined EBC OPCODE from EbcExecute.h to MdePkg\Include\Protocol\Ebc.h
3.1.2.B) Add EbcDebuggerLib.h library class to MdeModulePkg/Include/Library
3.1.2.C) Add EbcDebuggerNullLib library instance to MdeModulePkg/Library/
3.1.2.D) Add EbcDebuggerLib library instance to MdeModulePkg/Library/



3.2) EbcExecute(), I cannot find below original code. Would you please double check?
    //
    // Verify the opcode is in range. Otherwise generate an exception.
    //
    if ((*VmPtr->Ip & OPCODE_M_OPCODE) >= (sizeof (mVmOpcodeTable) / sizeof (mVmOpcodeTable[0]))) {
      EbcDebugSignalException (EXCEPT_EBC_INVALID_OPCODE, EXCEPTION_FLAG_FATAL, VmPtr);
      Status = EFI_UNSUPPORTED;
      goto Done;
    }

3.3) ExecuteBREAK(), I cannot find below original code. Would you please double check?
  case 3:
    VmPtr->StopFlags |= STOPFLAG_BREAKPOINT;
    VmPtr->Ip += 2; <======== here
    //
    // See if someone has registered a handler
    //
    EbcDebugSignalException (
      EXCEPT_EBC_BREAKPOINT,
      EXCEPTION_FLAG_NONE,
      VmPtr
      );
return EFI_SUCCESS; <======== here
    break;

Thank You
Yao Jiewen



From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Pete Batard
Sent: Saturday, November 12, 2016 8:44 AM
To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH 0/2] MdeModulePkg/EbcDxe: add EBC Debugger

Hi Yao - good to hear from you.

On 2016.11.11 23:48, Yao, Jiewen wrote:
> I have worked on this for EDK-I, but just did not have resource to do the porting for EDK-II. Thank you for doing this.

I'll be glad if I can be of help.

The EBC Debugger has been tremendously useful during my development of
an EBC assembler as well as the troubleshooting of related EBC code. So,
while I understand that porting the EBC Debugger may not have been a
high priority for EDK2, I'm very thankful for the work you have done on
this in the past!

> Please give me some time, and I will review the patch soon.

Sounds good. I'll be trying to post a v2 early next week, that takes
into account the points Mike made. By the way, if you have some ideas
for what you'd prefer for the PCD, or any other potential improvements,
don't hesitate to let me know, since you're probably a lot more familiar
with all of this than I am.

Regards,

/Pete
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2016-11-12  7:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-11 15:50 [PATCH 0/2] MdeModulePkg/EbcDxe: add EBC Debugger Pete Batard
2016-11-11 17:41 ` Kinney, Michael D
2016-11-11 18:13   ` Pete Batard
2016-11-11 23:48 ` Yao, Jiewen
2016-11-12  0:43   ` Pete Batard
2016-11-12  7:48     ` Yao, Jiewen [this message]
2016-11-12 12:46       ` Pete Batard
2016-11-12 13:43         ` Yao, Jiewen
2016-11-12 19:49           ` Yao, Jiewen
2016-11-12 21:44             ` Yao, Jiewen
2016-11-12 22:17               ` Pete Batard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C50386CF9E0@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox