From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.92.69.14]) by mx.groups.io with SMTP id smtpd.web10.5406.1572267692272649283 for ; Mon, 28 Oct 2019 06:01:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=sARVOPtH; spf=pass (domain: outlook.com, ip: 40.92.69.14, mailfrom: kilian_kegel@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MYMgGT+VjmN/18cUwS4LXQ9uEBVeUt11Ntdc0x1j++6HYerhE6Xu2SLBWMyiDzMtRDSq0/R1Dn2/8sUiFtuY/Z0HR/Cen4AhYxMeSNBZNbrBvPz4VGwf+OsdMwkpFBxaTb6YM2cwMXqMrQO5mugA2oUxjvhqvEAlcjXOTo+5/bxuB8lxaeJM75ag85lAjV7mJKVf9SCFJzd8f1Y7Fz10WCBm2gcB5EvvfAhFoi4HSCem7ajRDfaQKXyOOiXfLlwqAmJJh5Q2gu6XLEwnjaYaj2A9EOb/UE1JqPDPh9pgyXsisVCRE/j0B53k3qbVdJPOdmGTxCiPi8JycD6KP5BhXw== 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=DDDYffizfabNiLvsk+TeKTVilLhBQUrmOuiS79oWcWA=; b=ZpBMKuyXkySWsbCZvFM0M4ibxfurOK6Y6WwB7Q1qiH/fwdgYrgXP6zeedjTNxNDVRvJlJmzESETt05VRLKtZ5CkKhkLkzvqjJnFmGB1tQwM4u1vi4e8clhCk4KP/fU1BtFCEX8DcRBwz2QsyCIubQikFh+BxfuXEQNkTgm91TBnhySRefc0r4EccmlHhpyH7mOWXi7GFyu+l4Kl6yNaAbltoT20mrUmEvm9l4S/GbZoJMT2/MYhHsv20hVC4hdyjLk6Qyinrz7gyTI0L+J1NjWwJlsX+k5YdQ9jin4/t24nm2V2HZ7b34VWra7tVqYFxamKpT+YU72VeBPBZkvVjow== 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=DDDYffizfabNiLvsk+TeKTVilLhBQUrmOuiS79oWcWA=; b=sARVOPtHRvcK8OaERwmXSjKS1LOfg6kWfuguQx9qd02QPP+F9IXgs9Bi1UUASY3xB7jQCS9M5Ki5J6HEhUTT6aNIFtBCDn41/xh1ORTq0aF0BCvt4aalMwCZq2FLe+0vQy8XLqblXDlT1a2+/Ctt+YOV7Rb2TzOiIN64h42TnkPJW5S8m6SlkVzMaQbmDZF2QD99X18lHNqnRA9LYQFmeIGz8FEQ5Sf/oMopiyG1W3kWOrCmFtVlaRUG0XcP/u0WgX5y97NhVlI9LkOhkHzGmImmCzc3uUCR+1llQr4QQgPWSbDYYPEpV0beB+cm90GzNjdUkL16UEw673f+OUU0xA== Received: from HE1EUR02FT035.eop-EUR02.prod.protection.outlook.com (10.152.10.52) by HE1EUR02HT162.eop-EUR02.prod.protection.outlook.com (10.152.10.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2387.20; Mon, 28 Oct 2019 13:01:29 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com (10.152.10.58) by HE1EUR02FT035.mail.protection.outlook.com (10.152.10.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2387.20 via Frontend Transport; Mon, 28 Oct 2019 13:01:29 +0000 Received: from VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::d1ae:fb86:1c1a:b74]) by VI1PR0502MB3968.eurprd05.prod.outlook.com ([fe80::d1ae:fb86:1c1a:b74%5]) with mapi id 15.20.2387.021; Mon, 28 Oct 2019 13:01:23 +0000 From: "Kilian Kegel" To: "liming.gao@intel.com" CC: "devel@edk2.groups.io" , "Richardson, Brian" , "Kinney, Michael D" Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak() Thread-Topic: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak() Thread-Index: AQHVjY/MGMCILGZZT0Oc6Q9Dy/NV+Q== Date: Mon, 28 Oct 2019 13:01:23 +0000 Message-ID: References: <2d5ec4d308504c87b7b1390c1e2f1495@zhaoxin.com>,<4A89E2EF3DFEDB4C8BFDE51014F606A14E5325C1@SHSMSX104.ccr.corp.intel.com> In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E5325C1@SHSMSX104.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:74BFFBD805439529A767E23B9D5349C8B3A6069B1D15561A83F29C9FE113C74A;UpperCasedChecksum:D517A96C938B5C5D4B6A8E24BE4789A5ECA4EA72E1782216C92E7C9F34F683FB;SizeAsReceived:7024;Count:44 x-tmn: [/EBe4ddC+OjwnQq50GfOTLl+hLZ8u7aQ] x-ms-publictraffictype: Email x-incomingheadercount: 44 x-eopattributedmessage: 0 x-ms-traffictypediagnostic: HE1EUR02HT162: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: C91RbFu2gipVRi/4cg/790vShN159RJZcjnqn45Cxw9fmMJ+bm0PohE9yUJY/mYjC17JyE0KDyIXBwspfzezlvun5uLb+SEXRbfRezdb602bIKDBrokaR+Yg07AxL9XnE6zwRvAN1gN+HaFV8OEzjEdOB77wwbzycGdZv3asqwiEE0XAm6whqbcosnDjPG2L 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: a7438c21-78c8-42d5-0da2-08d75ba6ef7c X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Oct 2019 13:01:23.5748 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR02HT162 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_VI1PR0502MB3968C24D22A8A203539AC905EB660VI1PR0502MB3968_" --_000_VI1PR0502MB3968C24D22A8A203539AC905EB660VI1PR0502MB3968_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable 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 debug= 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 de= bugger 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 begi= nning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe t= o 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 + ALT= + P) --> WinHost.exe\n"); SecPrint("\t3. Break All (CTRL + ALT + Break) --> = WinHost.exe\n"); SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in li= ne 445\n"); SecPrint("\t5. and press ENTER in this command box\= n"); SecPrint("\t6. go back to Visual Studio an RUN/SING= LE STEP the application\n"); SecPrint("\t7. otherwise press enter to continue...= \n"); getchar(); // // 1. SET A SOFTWARE BREAKPOINT TO THE NEXT LINE of= code below -->> SecPrint(""); // 2. switch to the command box and press ENTER // 3. start single stepping the entire boot/emulati= on process, good luck... // SecPrint("");//now you can single step the entire b= oot/emulation process, good luck... } } } } --_000_VI1PR0502MB3968C24D22A8A203539AC905EB660VI1PR0502MB3968_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Hi Liming,

 

If have observed in newer Windows 10 versions, when = using __debugbreak()<= /b>in any

application that Windows just terminates the app, in= stead offering to debug 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 c= an 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 debugger at the very be= ginning of POST emulation\n");

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

 

        if(Argc > 1){<= /span>

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

            = ;    if(0 =3D=3D strcmp("/debug", Argv[i])){<= /o:p>

            = ;            //SecPr= int("IF YOU WANT TO DEBUG from the very beginning of the EMULATION:\n\= t1. start the TASKMGR\n\t2. connect WinHost.exe to the debugger\n\t3. and p= ress ENTER in this command box\nOR\n");

            = ;            SecPrin= t("\t1. start Visual Studio\n");

            = ;            SecPrin= t("\t2. DEBUG->ATTACH TO PROCESS (CTRL + ALT + P) --> Wi= nHost.exe\n");

            = ;            SecPrin= t("\t3. Break All  (CTRL + ALT + Break) --> WinHost.ex= e\n");

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

            = ;            SecPrin= t("\t5. and press ENTER in this command box\n");

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

            = ;            SecPrin= t("\t7. otherwise press enter to continue...\n");

            = ;            getchar= ();

            = ;            //=

            = ;            // 1. S= ET A SOFTWARE BREAKPOINT TO THE NEXT LINE of code below -->> SecPrint= ("");

            = ;            // 2. s= witch to the command box and press ENTER

            = ;            // 3. s= tart single stepping the entire boot/emulation process, good luck...

            = ;            //=

            = ;            SecPrin= t("");//now you can single step the entire boot/emulation process= , good luck...

            = ;       }

            }

        }

    }

--_000_VI1PR0502MB3968C24D22A8A203539AC905EB660VI1PR0502MB3968_--