public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: devel@edk2.groups.io, Rebecca Cran <rebecca@bsdio.com>,
	"Andrei Warkentin (VMWare address)" <awarkentin@vmware.com>
Subject: Re: [edk2-devel] OVMF gdb seems to require "stone knives and bearskins" to debug code?
Date: Mon, 25 May 2020 16:14:56 -0700	[thread overview]
Message-ID: <9734466F-4F9D-4E8B-9837-B53236051780@apple.com> (raw)
In-Reply-To: <01ce779e-825a-9fd3-fa7f-7db7ce589aee@redhat.com>



> On May 25, 2020, at 12:15 PM, Laszlo Ersek <lersek@redhat.com> wrote:
> 
> (+Rebecca, +Andrei)
> 
> On 05/25/20 05:30, Andrew Fish via groups.io wrote:
>> The full Star Trek quote from Spock is:  " I am endeavoring, ma'am, to construct a mnemonic memory circuit using stone knives and bearskins.", but I ran across this [1], and it felt like "stone knives and bearskins." vs my experience with lldb debugging EFI. 
>> 
>> So a few questions:
>> 1) Is this Wiki [1]  actually up to date? 
>> 2) Do we have a location to add debugger scripts to the edk2? If not what location should we chose?
>> 3) Is anyone interested in writing gdb scripts to do better?
> 
> Andrei used to have some utilities / scripts at
> <https://github.com/andreiw/andreiw-wip/tree/master/uefi/DebugPkg>, and
> Rebecca used to host an article on her website about those tools. Hm....
> the URL seems to be:
> <https://code.bsdio.com/w/tianocore/debugging-with-gdb/>.
> 
> I have those utilities (somewhat refreshed?) in one of my (frequently
> rebased) local branches, but I've never tried to upstream them (it's not
> my work, after all). But, I use gdb really rarely anyway; mostly I use
> DEBUGs. :)
> 
> 
> I think the last time we discussed this was in this thread:
> 
> https://edk2.groups.io/g/devel/message/40061
> 
> (alt link:
> <http://mid.mail-archive.com/19e9d54a-575a-ee5e-8039-900f466d473d@bluestop.org>)
> 

Laszlo,

I was thinking more of a workflow that looks like:
$ gdb -ex " target remote localhost:1234" -ex " source efi_symbolicate.py" 

And then you are sitting at a symbolicated stack frame when gdb launches. This is what I have working with lldb and OVMF. I'll see if I can abstract out the debugger from my script and make it easy to port to gdb.

This would imply we need a location to store the debugger script, and maybe a script to launch the debugger if the command line gets long, but we could land that convenience script in OvmfPkg/. 

I see Andrei's warning about needing to load a module to get gdb to behave. We might be able to load the DXE Core or some other module at its linked address (around zero) and then unloaded when we detect its actual load address. I've got something like this working in lldb. 

Thanks,

Andrew Fish

> 
> I don't remember ever relying on [1]
> <https://github.com/tianocore/tianocore.github.io/wiki/How-to-debug-OVMF-with-QEMU-using-GDB>.
> 
> Thanks
> Laszlo
> 


  reply	other threads:[~2020-05-25 23:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  3:30 OVMF gdb seems to require "stone knives and bearskins" to debug code? Andrew Fish
2020-05-25 19:15 ` [edk2-devel] " Laszlo Ersek
2020-05-25 23:14   ` Andrew Fish [this message]
2020-05-26 11:22     ` Laszlo Ersek
2020-05-26  2:19 ` Rebecca Cran
2020-05-26  3:11   ` Andrew Fish
2020-05-26  5:57     ` Andrei Warkentin

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=9734466F-4F9D-4E8B-9837-B53236051780@apple.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