[edk2-devel] OVMF gdb seems to require "stone knives and bearskins" to debug code?

Andrew Fish via groups.io afish=apple.com at groups.io
Tue May 26 03:11:52 UTC 2020



> On May 25, 2020, at 7:19 PM, Rebecca Cran <rebecca at 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
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#60237): https://edk2.groups.io/g/devel/message/60237
Mute This Topic: https://groups.io/mt/74450304/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list