Discussion:
[edk2] Qestion about how to debug OVMF on QEMU
lidonglin
2015-05-25 01:14:38 UTC
Permalink
Hi all:
I want to know how to debug ovmf with QEMU + OVMF. I want to trace OVMF code flow. Who can give me some suggestion ? Thanks.
Blibbet
2015-05-25 01:50:02 UTC
Permalink
Post by lidonglin
I want to know how to debug ovmf with QEMU + OVMF.
I want to trace OVMF code flow. Who can give me some suggestion?
https://github.com/tianocore/tianocore.github.io/wiki/OVMF%20FAQ#How_do_I_enable_source_level_debugging_with_OVMF
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Source-Level-Debug

https://github.com/tianocore/edk2/tree/master/OvmfPkg
https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF
https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF

http://comments.gmane.org/gmane.comp.bios.tianocore.devel/6777
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6856
http://comments.gmane.org/gmane.comp.bios.tianocore.devel/2529
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6066

HTH
Neeraj Ladkani
2015-05-25 02:41:56 UTC
Permalink
in summary

1. Change the gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel = 0xFFFFFFFF

2. run build -D -D DEBUG_ON_SERIAL_PORT

3. install com2com ( to create virtual COM ports on your laptop in case you
dont have )

4. qemu-system-x86_64.exe -bios OVMF.fd -serial COM1
Post by Blibbet
Post by lidonglin
I want to know how to debug ovmf with QEMU + OVMF.
I want to trace OVMF code flow. Who can give me some suggestion?
https://github.com/tianocore/tianocore.github.io/wiki/OVMF%20FAQ#How_do_I_enable_source_level_debugging_with_OVMF
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Source-Level-Debug
https://github.com/tianocore/edk2/tree/master/OvmfPkg
https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF
https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF
http://comments.gmane.org/gmane.comp.bios.tianocore.devel/6777
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6856
http://comments.gmane.org/gmane.comp.bios.tianocore.devel/2529
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6066
HTH
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
https://lists.sourceforge.net/lists/listinfo/edk2-devel
--
Thanks
Neeraj
lidonglin
2015-05-25 03:30:40 UTC
Permalink
Thanks for your reply.
This method maybe only can print some log to serial. Is there any way to control ovmf work flow like step by step debug?

From: Neeraj Ladkani [mailto:***@gmail.com]
Sent: 2015幎5月25日 10:42
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] Qestion about how to debug OVMF on QEMU

in summary

1. Change the gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel = 0xFFFFFFFF

2. run build -D -D DEBUG_ON_SERIAL_PORT

3. install com2com ( to create virtual COM ports on your laptop in case you dont have )

4. qemu-system-x86_64.exe -bios OVMF.fd -serial COM1
Post by lidonglin
I want to know how to debug ovmf with QEMU + OVMF.
I want to trace OVMF code flow. Who can give me some suggestion?
https://github.com/tianocore/tianocore.github.io/wiki/OVMF%20FAQ#How_do_I_enable_source_level_debugging_with_OVMF
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Source-Level-Debug

https://github.com/tianocore/edk2/tree/master/OvmfPkg
https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF
https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF

http://comments.gmane.org/gmane.comp.bios.tianocore.devel/6777
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6856
http://comments.gmane.org/gmane.comp.bios.tianocore.devel/2529
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6066

HTH

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
--
Thanks
Neeraj
Fan, Jeff
2015-05-25 05:09:00 UTC
Permalink
Download UDK Debugger tools to setup source debugger environment per the software and document from the following link.

http://firmware.intel.com/develop/intel-uefi-tools-and-utilities/intel-uefi-development-kit-debugger-tool#overlay-context=develop


From: lidonglin [mailto:***@huawei.com]
Sent: Monday, May 25, 2015 11:31 AM
To: edk2-***@lists.sourceforge.net
Subject: Re: [edk2] Qestion about how to debug OVMF on QEMU

Thanks for your reply.
This method maybe only can print some log to serial. Is there any way to control ovmf work flow like step by step debug?

From: Neeraj Ladkani [mailto:***@gmail.com]
Sent: 2015幎5月25日 10:42
To: edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
Subject: Re: [edk2] Qestion about how to debug OVMF on QEMU

in summary

1. Change the gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel = 0xFFFFFFFF

2. run build -D -D DEBUG_ON_SERIAL_PORT

3. install com2com ( to create virtual COM ports on your laptop in case you dont have )

4. qemu-system-x86_64.exe -bios OVMF.fd -serial COM1
Post by lidonglin
I want to know how to debug ovmf with QEMU + OVMF.
I want to trace OVMF code flow. Who can give me some suggestion?
https://github.com/tianocore/tianocore.github.io/wiki/OVMF%20FAQ#How_do_I_enable_source_level_debugging_with_OVMF
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Source-Level-Debug

https://github.com/tianocore/edk2/tree/master/OvmfPkg
https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF
https://github.com/tianocore/tianocore.github.io/wiki/How-to-run-OVMF

http://comments.gmane.org/gmane.comp.bios.tianocore.devel/6777
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6856
http://comments.gmane.org/gmane.comp.bios.tianocore.devel/2529
http://permalink.gmane.org/gmane.comp.bios.tianocore.devel/6066

HTH

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-***@lists.sourceforge.net<mailto:edk2-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/edk2-devel
--
Thanks
Neeraj
B Cran
2015-05-25 06:02:03 UTC
Permalink
Post by lidonglin
Thanks for your reply.
This method maybe only can print some log to serial. Is there any way to
control ovmf work flow like step by step debug?

You can run qemu with the embedded gdb server and with a bit of setup using
scripts mentioned a while ago on this list be able to step through OVMF
code in gdb or any other gdb-compatible debugger with full symbols. I don't
have the details available right now but if you're interested I can find
them.

Bruce
Laszlo Ersek
2015-05-26 09:38:17 UTC
Permalink
Post by lidonglin
Post by lidonglin
Thanks for your reply.
This method maybe only can print some log to serial. Is there any way
to control ovmf work flow like step by step debug?
You can run qemu with the embedded gdb server and with a bit of setup
using scripts mentioned a while ago on this list be able to step through
OVMF code in gdb or any other gdb-compatible debugger with full symbols.
I don't have the details available right now but if you're interested I
can find them.
Bruce, what happened to the nice summary you had put up under:

http://edk2.bluestop.org/w/tianocore/debugging-with-gdb/

(announced in
<http://thread.gmane.org/gmane.comp.bios.tianocore.devel/12045/focus=12091>)?

Li Donglin, in any case, please see

http://thread.gmane.org/gmane.comp.bios.tianocore.devel/7424

FWIW, when hunting for a bug, I never bother to go through the hurdles
described in that email :)

I just add DEBUGs. They work very well. The trick is to insert *many*

DEBUG (("%a: %d\n", __FUNCTION__, __LINE__));

statements in a function that is known to be entered. Such statements
should be added at the boundaries of basic blocks
<http://en.wikipedia.org/wiki/Basic_block>.

Such a debug log is very useful for control flow analysis (especially
with a cscope- or ctags-compatible editor, when you can jump to
functions by name), plus one can easily dig down to other functions /
log other variables too, in the next round. In many cases I find it more
useful than traditional interactive debugging -- with interactive
debugging you frequently wish you had a log.

Laszlo
Laszlo Ersek
2015-07-06 17:33:24 UTC
Permalink
Post by Laszlo Ersek
http://edk2.bluestop.org/w/tianocore/debugging-with-gdb/
(announced in
<http://thread.gmane.org/gmane.comp.bios.tianocore.devel/12045/focus=12091>)?
I've finally got around to reinstalling it - it's now available at
https://edk2.bluestop.org/w/tianocore/debugging-with-gdb/ (note change
from http to https).
Thank you!
Post by Laszlo Ersek
I've also started working on a document about building under FreeBSD,
which is
at https://edk2.bluestop.org/w/tianocore/building-under-freebsd/ - an
initial patch against edk2 is
at http://bluestop.org/edk2/edk2_freebsd.diff (I switched from clang to
gcc after having problems with some of the utilities in the base system,
which may make some of the changes redundant).
Hm... memories memories memories... Yes. Are you aware of this:

http://people.freebsd.org/~wpaul/edk2/README.txt
Post by Laszlo Ersek
The edk2 repository browser is also available again
at https://edk2.bluestop.org/diffusion/EDK/ .
Can it do git-blame? (AFAIK github can't, and I've missed it occasionally.)

Cheers!
Laszlo
B Cran
2015-07-06 18:27:01 UTC
Permalink
(re-sending since I sent it from an address that’s not subscribed to edk2-devel)
http://people.freebsd.org/~wpaul/edk2/README.txt <http://people.freebsd.org/~wpaul/edk2/README.txt>
I’d read bits of it a few months ago, but it seemed rather complicated and a bit outdated so I started afresh.
I’m hoping I can get changes such as fixing “#! /bin/bash” to “#! /usr/bin/env bash” (non-default shells live in /usr/local/bin on BSD) committed so people won’t need to do quite as much patching in future.
Can it do git-blame? (AFAIK github can't, and I've missed it occasionally.)
Yup. Just browse to a file (in Diffusion) then click “Enable Blame” on the right-hand side - see Loading Image... <http://bluestop.org/edk2/GitBlamePhab.png> for an example.

—
Bruce
Bill Paul
2015-07-06 21:04:48 UTC
Permalink
Of all the gin joints in all the towns in all the world, B Cran had to walk
(re-sending since I sent it from an address that’s not subscribed to
edk2-devel)
Post by Laszlo Ersek
http://people.freebsd.org/~wpaul/edk2/README.txt
<http://people.freebsd.org/~wpaul/edk2/README.txt>
I’d read bits of it a few months ago, but it seemed rather complicated and
a bit outdated so I started afresh.
Er... it's not that complicated. It's only about 3 pages of instructions, and
the majority of them are just telling you what packages you need on your
system. :)

The only outdated thing is that I think they're using a newer version of the
OpenSSL package for doing secure boot. I did a fresh EDK build just a couple
weeks ago so these instructions can't be that stale.

I strongly prefer building a cross compile environment rather than trying to
use any of the system compiler tools or the packages. It doesn't really make
sense anyway since you're effectively cross-building a whole other OS in the
first place. And if you're running FreeBSD on a PPC/MIPS/ARM host instead of
i386/amd64, you're going to need to create your own cross build setup anyway.

Once you make sure you have the right packages and have downloaded the right
GCC and binutils sources, you should be good to go.

The one thing that would be really nice is to have the mingw-gcc-build.py
script updated to use newer versions of GCC and binutils. (Yes, I know I know:
"Gee Bill, that sounds like a great idea: why don't you do that and submit a
patch?" Sheesh, you guys...)
I’m hoping I can get changes such as
fixing “#! /bin/bash” to “#! /usr/bin/env bash” (non-default shells live
in /usr/local/bin on BSD) committed so people won’t need to do quite as
much patching in future.
What script in particular forces you to patch this? I don't recall having to
jigger any of the scripts to adjust the path of bash.

-Bill
Post by Laszlo Ersek
Can it do git-blame? (AFAIK github can't, and I've missed it
occasionally.)
Yup. Just browse to a file (in Diffusion) then click “Enable Blame” on the
right-hand side - see http://bluestop.org/edk2/GitBlamePhab.png
<http://bluestop.org/edk2/GitBlamePhab.png> for an example.

Bruce
--
=============================================================================
-Bill Paul (510) 749-2329 | Senior Member of Technical Staff,
***@windriver.com | Master of Unix-Fu - Wind River Systems
=============================================================================
"I put a dollar in a change machine. Nothing changed." - George Carlin
=============================================================================
Laszlo Ersek
2015-07-06 21:31:53 UTC
Permalink
Post by Laszlo Ersek
http://people.freebsd.org/~wpaul/edk2/README.txt
I’d read bits of it a few months ago, but it seemed rather complicated
and a bit outdated so I started afresh.
I’m hoping I can get changes such as fixing “#! /bin/bash” to “#!
/usr/bin/env bash” (non-default shells live in /usr/local/bin on BSD)
committed so people won’t need to do quite as much patching in future.
Post by Laszlo Ersek
Can it do git-blame? (AFAIK github can't, and I've missed it
occasionally.)
Yup. Just browse to a file (in Diffusion) then click “Enable Blame” on
the right-hand side - see http://bluestop.org/edk2/GitBlamePhab.png for
an example.
Sounds very nice, thanks!
Laszlo

Loading...