From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by mx.groups.io with SMTP id smtpd.web09.2182.1582627300353985666 for ; Tue, 25 Feb 2020 02:41:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VzsRx/RZ; spf=pass (domain: gmail.com, ip: 209.85.210.195, mailfrom: newexplorerj@gmail.com) Received: by mail-pf1-f195.google.com with SMTP id k29so6950279pfp.13 for ; Tue, 25 Feb 2020 02:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Mf5c4RhMQ9+KELUIQFvmXupYG0d+u8/5cM6M90MsRx4=; b=VzsRx/RZcIQQlol/MC79uHsqboTdARLxXSfxezEVR0UaFD9OYNd/wR4J6BRLGHPtz0 PQreU2aMqHSGehJwK2It/2bR4yHCGrxQ4l7qCSAflPvzYNAvsAPnaoiBsRCito/QCUY1 9nqwWTiQ4uRLDC/EC7rwPxVornXGteOyBfe/s4B0+Ro3KVQh54PLP1m5Ls/OO/uGW1nq Uf2Dh7YXuCvCn1EFy7lC4nF0NF6m48TpRbHSpzBEcGKff9DFSRcZW8Vo22FpMD4oyL47 AbndH58qJW7LuE7yNflmKCHXyOMs2VYM6uJP2RSECLXYG1KsUQ4wnFrgwZTbLjCYwyJf iniw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Mf5c4RhMQ9+KELUIQFvmXupYG0d+u8/5cM6M90MsRx4=; b=GDRrEpUXi5jecBz3uxBYeitijxa/cXrfB7a0Ssu/AYy3GewsbR8qWjNtsXhuYArHpI 1NJVKPa277PGlNHU3h67dzgOpXSCvDjN7pMs8PRIxV/5I9IW6poGGIK9ggmepalNfly+ rfVNXBsxqWRhxuYjbaMknAT4YhWIrsYy4zDrURD1Rs7aKpdBATdRt7BRJEk8blBvp+tP NUZfAQg4t17B6wijKL5PPTTsQoRBNrRVjvF5wsjAeh5JHWVvneFGP/LPDCeJADEXTEup OdWz67a78bzjHn67LV8W1AbPmHAKEH0/7779iDie+/fW52hj8IVb3RTIbKUqTixef3pB sKew== X-Gm-Message-State: APjAAAVl+jSsRxxb5QyCoQVhDVTsFoxByZJeFKUDKBvVdcgHtw5icC2w TwXz+OLX/1ggftrxccQ1rHVZ67qOE3fUVQ== X-Google-Smtp-Source: APXvYqyrbMpLth5macEyj0Ueqiy1TeyW56KwFqCW+yvxwabvTuE+71pJf7xZhfB38BdeWQAes3BhXA== X-Received: by 2002:a63:5b54:: with SMTP id l20mr20139017pgm.324.1582627299319; Tue, 25 Feb 2020 02:41:39 -0800 (PST) Return-Path: Received: from localhost.localdomain ([45.135.186.43]) by smtp.gmail.com with ESMTPSA id e9sm2653093pjt.16.2020.02.25.02.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2020 02:41:38 -0800 (PST) From: "GuoMinJ" To: devel@edk2.groups.io Cc: GuoMinJ Subject: [PATCH] EmulatorPkg/WinHost: Debug CpuBreakPoint. Date: Tue, 25 Feb 2020 18:41:15 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2319 __debugbreak() in any application will terminate the application on windows 10. add /debug option for debugging windows 10. Signed-off-by: GuoMinJ --- EmulatorPkg/Win/Host/WinHost.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/EmulatorPkg/Win/Host/WinHost.c b/EmulatorPkg/Win/Host/WinHost.c index cfee156b27..1e2a399c87 100644 --- a/EmulatorPkg/Win/Host/WinHost.c +++ b/EmulatorPkg/Win/Host/WinHost.c @@ -410,6 +410,36 @@ Returns: SecPrint ("\n\rEDK II WIN Host Emulation Environment from http://www.tianocore.org/edk2/\n\r"); + if (1) { + int i; + + 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 = 1; i < Argc; i++) { + if (0 == strcmp("/debug", Argv[i])) { + //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 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 line 445\n"); + SecPrint("\t5. and press ENTER in this command box\n"); + SecPrint("\t6. go back to Visual Studio an RUN/SINGLE 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/emulation process, good luck... + // + SecPrint("");//now you can single step the entire boot/emulation process, good luck... + } + } + } + } + // // Determine the first thread available to this process. // -- 2.17.1