From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.92.67.10]) by mx.groups.io with SMTP id smtpd.web11.5.1573709033443646790 for ; Wed, 13 Nov 2019 21:23:54 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=iHnuhhIo; spf=pass (domain: outlook.com, ip: 40.92.67.10, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gPosEcjHHMgpH7owLz5YN0+C3juyqDEHtiXYp4DO+DIB5pUSKC/FbtEopNT54fiZssjz6rvCpDUGRNwBWRYBkrZ10BlcRUqhFWcYdeltnEFoG0PiVUSfzQNwKSnzLbKjuJgr3oTqA0EP8/SDgHvaiaVGa4XsVJvMYD1mLc95pBJO9+u0kr0RbceRWstYECQtACl5TGxxIF8etNq0msC+y4Bgu1pUgxxh0ok5Y6jNm9D36EpLaLLESrSrt1AdxNIzcvbPUtgt4eBgClGoKstLpWqGJHrZcNFyWTEM7nRI3XVw/hoAKjNX+qHnLjeDsYbAU19eZbgOrA6+9xWRzGW7mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PpXGhmGLx365H2hxWihYDDQp9+M+VlXKAXDc0RQh6Sg=; b=DMYHOUW7gjbuSpwixLe3MBfUHupoiPHygMVAB2QmF0yFbDmta4bZtDLip69kkRKopKTJlzZO5POeC5jYTbfzR9aUQo48xSPbdVmCz8DWfIDUpq1cirpEl56iff2AgTmAuoZHWfi/BodFn0u2dgyDvZyw680JPdQBak67EPP3fEy1pDpmsCaSo3DFX02yZh3sQAyJWe4uU28PP6U1yZw90nTTgzzPnMapz1zRYFZnfmw1vZhD5R8RvrxBT2JSR8WU0ad22EhWkWBH9brfMTT1nPkGrEciUXmgbX8Ah1MAYpSo7+9Sx4Qo2w8hu85uIlh+56ddeKcTyOr1O0u1WH58MA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PpXGhmGLx365H2hxWihYDDQp9+M+VlXKAXDc0RQh6Sg=; b=iHnuhhIoqx/YVSE4F60Rk1o5kGpNtscKdOkKIavJDH09ibLWbMSQG0vYQQnI0DzhOPddYARmBmm7nqDizBk8VdSOZMIUT0QAI88kM7LlI098oneqaieZlIgUipI3wPfQHoOcAMCCWefAqSPEav5LmVb3FyjVDzGtKdjYsquv/i0MFDUuNN8xKRoQFOnVDjtrCHfJkLY0en/YkdW+woWGp4FNz9rJxlwZujtpSH1PZmtVey29XCtsZTedmOrRjz/vqPYpV0Zqu9r3Z39nms94oj3Z3EIHSHMNfrOpry8ExgGXnwY6JmY4Qg7QTAc/26CjNtjWizIryYDoFcNAk54hEA== Received: from HE1EUR02FT054.eop-EUR02.prod.protection.outlook.com (10.152.10.51) by HE1EUR02HT030.eop-EUR02.prod.protection.outlook.com (10.152.11.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Thu, 14 Nov 2019 05:23:50 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com (10.152.10.55) by HE1EUR02FT054.mail.protection.outlook.com (10.152.11.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23 via Frontend Transport; Thu, 14 Nov 2019 05:23:50 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::4408:c7c7:aaa3:2a91]) by VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::4408:c7c7:aaa3:2a91%7]) with mapi id 15.20.2430.027; Thu, 14 Nov 2019 05:23:50 +0000 From: "Kilian Kegel" To: "Ni, Ray" , "devel@edk2.groups.io" , "Gao, Liming" CC: "Richardson, Brian" , "Kinney, Michael D" Subject: Re: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint Thread-Topic: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint Thread-Index: AQHVk/+J8z3CQarrTkqSuX+dN7iWMaeIVTyAgAAWngCAAb3M1Q== Date: Thu, 14 Nov 2019 05:23:50 +0000 Message-ID: References: <2d5ec4d308504c87b7b1390c1e2f1495@zhaoxin.com>,<4A89E2EF3DFEDB4C8BFDE51014F606A14E5325C1@SHSMSX104.ccr.corp.intel.com>, <4A89E2EF3DFEDB4C8BFDE51014F606A14E53EAA0@SHSMSX104.ccr.corp.intel.com>,<734D49CCEBEEF84792F5B80ED585239D5C35B652@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C35B652@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:350EEC9EBDC56E8E9F48B83B27ED48BAA830E4D43CB5025966920CFA5EB3A275;UpperCasedChecksum:87A7B58F4FCB1670E525F4DA1A3D9E017E899C987B6D00243F0347A2E37B8B32;SizeAsReceived:7494;Count:45 x-tmn: [WM97Kh8aChU/AL/PaB/TB9Xk1n97sZ6v] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 1f284bf6-321c-4220-9668-08d768c2d4e3 x-ms-traffictypediagnostic: HE1EUR02HT030: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: lr5R6hQHd+H28eI9JcG2zRglSsAPP++fej5g7pCAKFaWUshGYKeEMqsuulSVPyBac91dpY0D4AJ3hOjKRDGPswvW4Dl+NHIRK2IuIWfSZXArLaDDUn6xiFW+OEsHa9atRMynhg2IuL6Q0tACfLNRZSa0Q7nMVnUVHJFFLrS4zW4aqKtbNw5sS0V6Xuf9Ws79 x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 1f284bf6-321c-4220-9668-08d768c2d4e3 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Nov 2019 05:23:50.0253 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR02HT030 X-Groupsio-MsgNum: 50627 Content-Language: en-US Content-Type: multipart/related; boundary="_005_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_"; type="multipart/alternative" --_005_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_ Content-Type: multipart/alternative; boundary="_000_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_" --_000_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Hi Ray, [Ray] 1. Can you remove =93if(1)=94?: DONE Please define it in the begin of the function, and use edk2 data type and = coding style, such as UINTN Index. DONE [Ray] 2. strncmp assumes user may input =93/debugxxxxx=94. Is that a valid= assumption? I thought we only accept =93/debug=94 the whole word as input = parameter to trigger debugging. I have no preference at all here. We can also consider to use a stricmp() = to be case-in-sensitive=85 [Ray] 3. I prefer to break the long string to multiple lines of SecPrint()= call as what the code does in below. Removed the entire string, that came in per accident and was a comment onl= y =93//=94 Thanks, Kilian diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost= .c index 62a89f7617..0eeb5979ff 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -394,6 +394,7 @@ Returns: UINTN ProcessAffinityMask; UINTN SystemAffinityMask; INT32 LowBit; + INT32 i; // // Enable the privilege so that RTC driver can successfully run SetTime= () @@ -410,6 +411,26 @@ Returns: SecPrint ("\n\rEDK II WIN Host Emulation Environment from http://www.ti= anocore.org/edk2/\n\r"); + SecPrint ("############################################################= ##########################################\n"); + SecPrint ("add \"/debug\" command line switch, to connect to the debugg= er at the very beginning of POST emulation\n"); + SecPrint ("############################################################= ##########################################\n"); + if (Argc > 1) { + for (i =3D 1; i < Argc; i++) { + if (0 =3D=3D strcmp("/debug", Argv[i])) { + SecPrint("\t1. start your debug engine\n"); + SecPrint("\t2. attach to process WinHost.exe\n"); + SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 431\n"); + SecPrint("\t5. and press ENTER in the WinHost command box\n"); + SecPrint("\t6. go back to the debug engine and RUN/SINGLE STEP = the application\n"); + SecPrint("\t7. otherwise press enter to continue...\n"); + + getchar(); //wait for keyboard input + + SecPrint("");//now you can single step the entire boot/emulatio= n process, good luck... + } + } + } + // // Determine the first thread available to this process. // From: Ni, Ray Sent: Wednesday, November 13, 2019 03:27 AM To: devel@edk2.groups.io; Gao, Liming; KILIAN_KEGEL@OUTLOOK.COM Cc: Richardson, Brian; Kinney, Michael = D Subject: RE: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint Kilian, Thank you very much for enabling the better VS debugging experience. Minor comments below. From: devel@edk2.groups.io On Behalf Of Liming Gao Sent: Wednesday, November 13, 2019 9:07 AM To: devel@edk2.groups.io; KILIAN_KEGEL@OUTLOOK.COM Cc: Richardson, Brian ; Kinney, Michael D ; Gao, Liming Subject: Re: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint Kilian: Can you create the patch with the commit message? For the patch, I add my comments. From: devel@edk2.groups.io [mailto:devel@edk2= .groups.io] On Behalf Of Kilian Kegel Sent: Wednesday, November 06, 2019 1:36 AM To: Gao, Liming > Cc: devel@edk2.groups.io; Richardson, Brian <= brian.richardson@intel.com>; Kinney, Mic= hael D > Subject: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint Hi Liming, >Kilian: can you send the patch to edk2 mail list for code review? Regards, Kilian https://bugzilla.tianocore.org/show_bug.cgi?id=3D2319 diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost= .c index 62a89f7617..53cda86f9a 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -409,7 +409,30 @@ Returns: FirmwareVolumesStr =3D (CHAR16 *) PcdGetPtr (PcdEmuFirmwareVolume); SecPrint ("\n\rEDK II WIN Host Emulation Environment from http://www.ti= anocore.org/edk2/\n\r"); - + + if (1) { Please use TRUE instead of 1 [Ray] 1. Can you remove =93if(1)=94? + int i; Please define it in the begin of the function, and use edk2 data type and = coding style, such as UINTN Index. + SecPrint ("##########################################################= ############################################\n"); + SecPrint ("add \"/debug\" command line switch, to connect to the debu= gger at the very beginning of POST emulation\n"); + SecPrint ("##########################################################= ############################################\n"); + if (Argc > 1) { + for (i =3D 1; i < Argc; i++) { + if (0 =3D=3D strcmp("/debug", Argv[i])) { How about use strncmp? [Ray] 2. strncmp assumes user may input =93/debugxxxxx=94. Is that a valid= assumption? I thought we only accept =93/debug=94 the whole word as input = parameter to trigger debugging. Thanks Liming + //SecPrint("IF YOU WANT TO DEBUG from the very beginning of the= EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe to the debugg= er\n\t3. and press ENTER in this command box\nOR\n"); [Ray] 3. I prefer to break the long string to multiple lines of SecPrint()= call as what the code does in below. + SecPrint("\t1. start your debug engine\n"); + SecPrint("\t2. attache to process WinHost.exe\n"); + SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 431\n"); + SecPrint("\t5. and press ENTER in the WinHost command box\n"); + SecPrint("\t6. go back to the debug engine and RUN/SINGLE STEP = the application\n"); + SecPrint("\t7. otherwise press enter to continue...\n"); + + getchar(); //wait for keyboard input + + SecPrint("");//now you can single step the entire boot/emulatio= n process, good luck... + } + } + } + } // // Determine the first thread available to this process. // From: Kilian Kegel > Sent: Monday, October 28, 2019 2:01:23 PM To: liming.gao@intel.com > Cc: devel@edk2.groups.io >; Richardson, Brian >; Kinney, Michael D > Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak() Hi Liming, If have observed in newer Windows 10 versions, when using __debugbreak()in= any application that Windows just terminates the app, instead offering to debu= g it. So in WinHost.exe too. That=92s why I usually insert the code snippet below to run into getchar() when the program was started with the /debug command line switch. As long as the App waits for the next keystroke, I can start the debugger = (VS2019) and connect to WinHost.exe process for debugging. Do you have a better solution without modifying the source code? Thanks, Kilian if(1){ int i; SecPrint ("#######################################################= ###############################################\n"); SecPrint ("add \"/debug\" command line switch, to connect to the d= ebugger at the very beginning of POST emulation\n"); SecPrint ("#######################################################= ###############################################\n"); if(Argc > 1){ for(i =3D 1 ; i < Argc ; i++){ if(0 =3D=3D strcmp("/debug", Argv[i])){ //SecPrint("IF YOU WANT TO DEBUG from the very beg= inning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe = to the debugger\n\t3. and press ENTER in this command box\nOR\n"); SecPrint("\t1. start Visual Studio\n"); SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL + AL= T + P) --> WinHost.exe\n"); SecPrint("\t3. Break All (CTRL + ALT + Break) -->= WinHost.exe\n"); SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in l= ine 445\n"); SecPrint("\t5. and press ENTER in this command box= \n"); SecPrint("\t6. go back to Visual Studio an RUN/SIN= GLE STEP the application\n"); SecPrint("\t7. otherwise press enter to continue..= .\n"); getchar(); // // 1. SET A SOFTWARE BREAKPOINT TO THE NEXT LINE o= f code below -->> SecPrint(""); // 2. switch to the command box and press ENTER // 3. start single stepping the entire boot/emulat= ion process, good luck... // SecPrint("");//now you can single step the entire = boot/emulation process, good luck... } } } } --_000_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Hi Ray,

 

[Ray] 1. Can you remove =93if(1)=94?:

   &nb= sp;            DONE<= /o:p>

Please define it in t= he begin of the function, and use edk2 data type and coding style, such as = UINTN Index.

DONE

[Ray] 2. strncmp assumes user may input =93/debugxx= xxx=94. Is that a valid assumption? I thought we only accept =93/debug=94 t= he whole word as input parameter to trigger debugging.

I have no preference at all here. We can also consider to use a stricmp()= to be case-in-sensitive=85

[Ray] 3. I prefer to break the long string to multi= ple lines of SecPrint() call as what the code does in below.

Removed the entire string, that came in per accident and was a comment on= ly =93//=94

 

Thanks,

Kilian

 

diff --git a/EmulatorPkg/Win/Host/WinHost.c b/Emula= torPkg/Win/Host/WinHost.c

index 62a89f7617..0eeb5979ff 100644

--- a/EmulatorPkg/Win/Host/WinHost.c

+++ b/EmulatorPkg/Win/Host/WinHost.c

@@ -394,6 +394,7 @@ Returns:

   UINTN     &nb= sp;           ProcessAffi= nityMask;

   UINTN     &nb= sp;           SystemAffin= ityMask;

   INT32     &nb= sp;           LowBit;

+  INT32     &nbs= p;           i;

   //

   // Enable the privilege so that RTC dr= iver can successfully run SetTime()

@@ -410,6 +411,26 @@ Returns:

   SecPrint ("\n\rEDK II WIN Ho= st Emulation Environment from http://www.tianocore.org/edk2/\n\r");

+  SecPrint ("#######################= ###########################################################################= ####\n");

+  SecPrint ("add \"/debug\"= ; command line switch, to connect to the debugger at the very beginning of = POST emulation\n");

+  SecPrint ("#######################= ###########################################################################= ####\n");

+  if (Argc > 1) {

+    for (i =3D 1; i < Argc; = i++) {

+      if (0 =3D=3D st= rcmp("/debug", Argv[i])) {

+       &nbs= p;  SecPrint("\t1. start your debug engine\n");

+       &nbs= p;  SecPrint("\t2. attach to process WinHost.exe\n");

+        &nb= sp; SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 431\n&q= uot;);

+       &nbs= p;  SecPrint("\t5. and press ENTER in the WinHost command box\n&q= uot;);

+       &nbs= p;  SecPrint("\t6. go back to the debug engine and RUN/SINGLE STE= P the application\n");

+       &nbs= p;  SecPrint("\t7. otherwise press enter to continue...\n");=

+

+       &nbs= p;  getchar();    //wait for keyboard input

+

+       &nbs= p;  SecPrint("");//now you can single step the entire boot/e= mulation process, good luck...

+      }

+    }

+  }

+

   //

   // Determine the first thread availabl= e to this process.

   //

From: Ni, Ray
Sent: Wednesday, November 13, 2019 03:27 AM
To: devel@edk2.groups.io; Gao, Liming; KILIAN_KEGEL@= OUTLOOK.COM
Cc: Richardson, Brian= ; Kinney, Michael D
Subject: RE: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakP= oint

 

Kilian,

Thank you very much for enabling the better VS debu= gging experience.

 

Minor comments below.

 

From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of Liming Gao
Sent: Wednesday, November 13, 2019 9:07 AM
To: devel@edk2.groups.io; KILIAN_KEGEL@OUTLOOK.COM
Cc: Richardson, Brian <brian.richardson@intel.com>; Kinney, M= ichael D <michael.d.kinney@intel.com>; Gao, Liming <liming.gao@int= el.com>
Subject: Re: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakP= oint

 

Kilian:

  Can you create= the patch with the commit message?

 

  For the patch,= I add my comments.

 

 

From: devel@edk2.groups.io [mailto:= devel@edk2.groups.io] On Behalf Of Kilian Kegel
Sent: Wednesday, November 06, 2019 1:36 AM
To: Gao, Liming <liming.= gao@intel.com>
Cc: devel@edk2.groups.io; Richardson, Brian <bria= n.richardson@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [edk2-devel] [[PATCH 1/1]] EmulatorPkg using CpuBreakPoint=

 

Hi Liming,

>Kilian: can you send the patch to edk2 mail lis= t for code review?

Regards,

Kilian

 

https://bugzilla.tianocore.org/show_bug.cgi?id=3D2319

 

diff --git a/EmulatorPkg/Win/Host/WinHost.c b/Emula= torPkg/Win/Host/WinHost.c

index 62a89f7617..53cda86f9a 100644

--- a/EmulatorPkg/Win/Host/WinHost.c

+++ b/EmulatorPkg/Win/Host/WinHost.c

@@ -409,7 +409,30 @@ Returns:

   FirmwareVolumesStr =3D (CHAR16 *) PcdG= etPtr (PcdEmuFirmwareVolume);

   SecPrint ("\n\rEDK II WIN Host Em= ulation Environment from http://www.tianocore.org/edk= 2/\n\r");

-

+  if (1) {

Please use TRUE inste= ad of 1

[Ray] 1. Can you remove =93if(1)=94?

 

+    int i;

Please define it in t= he begin of the function, and use edk2 data type and coding style, such as = UINTN Index.

 

+    SecPrint ("###########= ###########################################################################= ################\n");

+    SecPrint ("add \"= /debug\" command line switch, to connect to the debugger at the very b= eginning of POST emulation\n");

+    SecPrint ("###########= ###########################################################################= ################\n");

+    if (Argc > 1) {

+      for (i =3D 1; i= < Argc; i++) {

+        if = (0 =3D=3D strcmp("/debug", Argv[i])) {

How about use strncmp= ?

[Ray] 2. strncmp assumes user may input =93/debugxx= xxx=94. Is that a valid assumption? I thought we only accept =93/debug=94 t= he whole word as input parameter to trigger debugging.

 

Thanks

Liming

+       &nbs= p;  //SecPrint("IF YOU WANT TO DEBUG from the very beginning of t= he EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe to the debu= gger\n\t3. and press ENTER in this command box\nOR\n");

[Ray] 3. I prefer to break the long string to multi= ple lines of SecPrint() call as what the code does in below.

 

+       &nbs= p;  SecPrint("\t1. start your debug engine\n");

+       &nbs= p;  SecPrint("\t2. attache to process WinHost.exe\n");<= /o:p>

+       &nbs= p;  SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 431\n&q= uot;);

+       &nbs= p;  SecPrint("\t5. and press ENTER in the WinHost command box\n&q= uot;);

+       &nbs= p;  SecPrint("\t6. go back to the debug engine and RUN/SINGLE STE= P the application\n");

+       &nbs= p;  SecPrint("\t7. otherwise press enter to continue...\n");=

+

+       &nbs= p;  getchar();    //wait for keyboard input<= /p>

+

+       &nbs= p;  SecPrint("");//now you can single step the entire boot/e= mulation process, good luck...

+        }

+      }

+    }

+  }

   //

   // Determine the first thread availabl= e to this process.

   //

 

From: Kilian Kegel <kilian_kegel@outlook.com>
Sent: Monday, October 28, 2019 2:01:23 PM
To: liming.gao@intel.com <liming.gao@intel.com><= br> Cc: devel@edk2.groups.io <devel@edk2.groups.io>;= Richardson, Brian <brian.= richardson@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

 

Hi Liming,

 

If have observed in newer Windows 10 versions, whe= n using __debugbreak()in any

application that Windows just terminates the app, = instead offering to debug it.

So in WinHost.exe too.

 

That=92s why I usually insert the code snippet bel= ow to run into getchar()

when the program was started with the /debug comma= nd line switch.

As long as the App waits for the next keystroke, I= can start the debugger (VS2019)

and connect to WinHost.exe process for debugging.<= /p>

 

Do you have a better solution without modifying th= e source code?

 

Thanks,

Kilian

    if(1){

        int = i;

 

        SecP= rint ("###############################################################= #######################################\n");

        SecP= rint ("add \"/debug\" command line switch, to connect to the= debugger at the very beginning of POST emulation\n");

        SecP= rint ("###############################################################= #######################################\n");

 

        if(A= rgc > 1){

        = ;    for(i =3D 1 ; i < Argc ; i++){

        = ;        if(0 =3D=3D strcmp("/debug= ", Argv[i])){

        = ;            &n= bsp;   //SecPrint("IF YOU WANT TO DEBUG from the very beginn= ing of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe to = the debugger\n\t3. and press ENTER in this command box\nOR\n");

        = ;            &n= bsp;   SecPrint("\t1. start Visual Studio\n");

        = ;            &n= bsp;   SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL += ; ALT + P) --> WinHost.exe\n");

        = ;            &n= bsp;   SecPrint("\t3. Break All  (CTRL + ALT + = Break) --> WinHost.exe\n");

        = ;             &= nbsp;  SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 445\= n");

        = ;            &n= bsp;   SecPrint("\t5. and press ENTER in this command box\n&= quot;);

        = ;            &n= bsp;   SecPrint("\t6. go back to Visual Studio an RUN/SINGLE= STEP the application\n");

        = ;            &n= bsp;   SecPrint("\t7. otherwise press enter to continue...\n= ");

        = ;            &n= bsp;   getchar();

        = ;            &n= bsp;   //

        = ;            &n= bsp;   // 1. SET A SOFTWARE BREAKPOINT TO THE NEXT LINE of code b= elow -->> SecPrint("");

        = ;            &n= bsp;   // 2. switch to the command box and press ENTER

        = ;            &n= bsp;   // 3. start single stepping the entire boot/emulation proc= ess, good luck...

        = ;            &n= bsp;   //

        = ;            &n= bsp;   SecPrint("");//now you can single step the entir= e boot/emulation process, good luck...

        = ;           }

        = ;    }

        }

    }

 

--_000_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_-- --_005_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_ Content-Type: image/png; name="74255A10120D420EB8522DEBF7EC5C88.png" Content-Description: 74255A10120D420EB8522DEBF7EC5C88.png Content-Disposition: inline; filename="74255A10120D420EB8522DEBF7EC5C88.png"; size=144; creation-date="Thu, 14 Nov 2019 05:23:21 GMT"; modification-date="Thu, 14 Nov 2019 05:23:21 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAArYAAAACCAYAAACtx5+mAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAlSURBVFhH7cMBDQAABAAw/UtJIIEw5GD/9gAA gBeyelRV9faeBRsQNwwY9nKzAAAAAElFTkSuQmCC --_005_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_ Content-Type: image/png; name="0D9AA6AECAB349549FF9F835489DA942.png" Content-Description: 0D9AA6AECAB349549FF9F835489DA942.png Content-Disposition: inline; filename="0D9AA6AECAB349549FF9F835489DA942.png"; size=144; creation-date="Thu, 14 Nov 2019 05:23:21 GMT"; modification-date="Thu, 14 Nov 2019 05:23:21 GMT" Content-ID: Content-Transfer-Encoding: base64 iVBORw0KGgoAAAANSUhEUgAAAsQAAAACCAYAAABfe8oDAAAAAXNSR0IArs4c6QAAAARnQU1BAACx jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAlSURBVFhH7cMBDQAACAMg+5cygQkeRoMIGwUA AK/1ZFVV9efsAW0/ZqCCeHKlAAAAAElFTkSuQmCC --_005_VI1PR0502MB3968C6BD5A0916097EF3D038EB710VI1PR0502MB3968_--