public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: devel@edk2.groups.io, rebecca@bsdio.com
Subject: Re: [edk2-devel] OVMF gdb seems to require "stone knives and bearskins" to debug code?
Date: Mon, 25 May 2020 20:11:52 -0700	[thread overview]
Message-ID: <492083F4-6955-4A32-BF56-FC5E3F04A8F0@apple.com> (raw)
In-Reply-To: <5ea5709b-aa92-84e5-463d-df4801635cd8@bsdio.com>



> On May 25, 2020, at 7:19 PM, Rebecca Cran <rebecca@bsdio.com> wrote:
> 
> On 5/24/20 9:30 PM, Andrew Fish via groups.io wrote:
> 
>> I could open source an lldb symbolication Python script and I'm happy to explain the common logic to some one to make it easier to port this  lldb command [3] to gdb. The command can load symbols for any address that is located in a loaded PE/COFF image, and when you import the command into lldb it symbolicates the current frame.
> 
> 
> As Laszlo has already explained, information about debugging with gdb is a bit scattered. I seem to recall there were discussion about getting the DebugPkg into edk2, but there was disagreement about it.
> 
> However, since I work on platforms which have lldb in base (FreeBSD) or are easily available (Linux), I'd certainly be interested if you were to open source the efi_symolicate.py script and I could learn how to use lldb.
> 

Rebecca,

Thanks for the feedback, and the help over the years.  When I get my other Xcode commits upstreamed I can commit the  lldb script if we can agree as a community the location of that new content. I've already refactored the lldb script to use a class to abstract lldb specifics, so that should make it much easier to port to gdb. 

FYI the magic to get lldb working with QEMU is:
$ curl -O https://raw.githubusercontent.com/llvm-mirror/lldb/master/examples/python/x86_64_target_definition.py
$ lldb -o "settings set plugin.process.gdb-remote.target-definition-file x86_64_target_definition.py" -o "gdb-remote 1234"   -o "command script import efi_symbolicate.py"

The issue is the lldb gdb-remote does not fall back to a primitive serial protocol so we need to point it at  x86_64_target_definition.py to know how to connect. This also gets rid of he need to point at an executable. If you remove importing my script that will give you assembly level debugging with QEMU. But source is more interesting, unless you are really stuck. 

This is a good place to start to learn lldb: http://lldb.llvm.org/use/map.html

Thanks,

Andrew Fish

> 
> -- 
> Rebecca Cran
> 
> 
> 
> 
> 


  reply	other threads:[~2020-05-26  3:12 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
2020-05-26 11:22     ` Laszlo Ersek
2020-05-26  2:19 ` Rebecca Cran
2020-05-26  3:11   ` Andrew Fish [this message]
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=492083F4-6955-4A32-BF56-FC5E3F04A8F0@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