Re: EmulatorPkg and the state of DlLoadImage()
The requiring *.pdb seems like something that rotted out and could be fixed.
This code is very very old. Notice the comment about gdb predates gdb Python support .
What happens if you comment out the DlLoadImage path? There seems to be some gdb scripts? The macOS path sets breakpoints on SecGdbScriptBreak() in an lldb script and loads symbols via that path. That his probably the best path forward for gdb too?
It looks like if you `build.sh run` you should launch the emulator under gdb and source the symbol loading file.
If you comment out the dlopen() path does it start working? Looks like breaking in with gdb should get symbols loaded?
EmulatorPkg/build.sh:221: /usr/bin/gdb $BUILD_ROOT_ARCH/Host -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg/Unix/GdbRun.sh
Not a 100% sure what you are asking? In a lot of cases you are debugging what is compatible with the OS? For example on macOS we build a mach-O and convert that to PE/COFF. We point the PDB entry at the mach-O file and that is what the debugger sees. As long as the PE/COFF lines up with the mach-O it does not really matter, as at the end of the day the debugger is just processing the dwarf debug info associated with addresses in system memory.
Not likely please file a BZ.
Note I’m working on getting a generic gdb debugging script into the edk2  and that should also work with the Emulator. I think you could replace the ` -x $WORKSPACE/EmulatorPkg/Unix/GdbRun.sh` with `-ex efi_gdb.py’. There is not a break hook in those scripts so you would have to run the `efi` command the 1st time you attach to load symbols. The efi_gdb.py script works on stock EFI so it does not depend on any of the hooks in the EmulatorPkg to work.