public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "GuoMinJ" <newexplorerj@gmail.com>
To: devel@edk2.groups.io
Cc: GuoMinJ <newexplorerj@gmail.com>
Subject: [PATCH] EmulatorPkg/WinHost: Debug CpuBreakPoint.
Date: Tue, 25 Feb 2020 18:41:15 +0800	[thread overview]
Message-ID: <fc3ea1776f0d449191e31e4fd971c72e14c01b57.1582627264.git.newexplorerj@gmail.com> (raw)

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 <newexplorerj@gmail.com>
---
 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


                 reply	other threads:[~2020-02-25 10:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=fc3ea1776f0d449191e31e4fd971c72e14c01b57.1582627264.git.newexplorerj@gmail.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